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.
 
 
 
 
 

30232 lines
813 KiB

  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  3. typeof define === 'function' && define.amd ? define(factory) :
  4. (global = global || self, global.PagedPolyfill = factory());
  5. }(this, (function () { 'use strict';
  6. function createCommonjsModule(fn, module) {
  7. return module = { exports: {} }, fn(module, module.exports), module.exports;
  8. }
  9. function getCjsExportFromNamespace (n) {
  10. return n && n['default'] || n;
  11. }
  12. var isImplemented = function () {
  13. var assign = Object.assign, obj;
  14. if (typeof assign !== "function") return false;
  15. obj = { foo: "raz" };
  16. assign(obj, { bar: "dwa" }, { trzy: "trzy" });
  17. return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy";
  18. };
  19. var isImplemented$1 = function () {
  20. try {
  21. Object.keys("primitive");
  22. return true;
  23. } catch (e) {
  24. return false;
  25. }
  26. };
  27. // eslint-disable-next-line no-empty-function
  28. var noop = function () {};
  29. var _undefined = noop(); // Support ES3 engines
  30. var isValue = function (val) {
  31. return (val !== _undefined) && (val !== null);
  32. };
  33. var keys = Object.keys;
  34. var shim = function (object) {
  35. return keys(isValue(object) ? Object(object) : object);
  36. };
  37. var keys$1 = isImplemented$1()
  38. ? Object.keys
  39. : shim;
  40. var validValue = function (value) {
  41. if (!isValue(value)) throw new TypeError("Cannot use null or undefined");
  42. return value;
  43. };
  44. var max = Math.max;
  45. var shim$1 = function (dest, src /*, …srcn*/) {
  46. var error, i, length = max(arguments.length, 2), assign;
  47. dest = Object(validValue(dest));
  48. assign = function (key) {
  49. try {
  50. dest[key] = src[key];
  51. } catch (e) {
  52. if (!error) error = e;
  53. }
  54. };
  55. for (i = 1; i < length; ++i) {
  56. src = arguments[i];
  57. keys$1(src).forEach(assign);
  58. }
  59. if (error !== undefined) throw error;
  60. return dest;
  61. };
  62. var assign = isImplemented()
  63. ? Object.assign
  64. : shim$1;
  65. var forEach = Array.prototype.forEach, create = Object.create;
  66. var process = function (src, obj) {
  67. var key;
  68. for (key in src) obj[key] = src[key];
  69. };
  70. // eslint-disable-next-line no-unused-vars
  71. var normalizeOptions = function (opts1 /*, …options*/) {
  72. var result = create(null);
  73. forEach.call(arguments, function (options) {
  74. if (!isValue(options)) return;
  75. process(Object(options), result);
  76. });
  77. return result;
  78. };
  79. // Deprecated
  80. var isCallable = function (obj) {
  81. return typeof obj === "function";
  82. };
  83. var str = "razdwatrzy";
  84. var isImplemented$2 = function () {
  85. if (typeof str.contains !== "function") return false;
  86. return (str.contains("dwa") === true) && (str.contains("foo") === false);
  87. };
  88. var indexOf = String.prototype.indexOf;
  89. var shim$2 = function (searchString/*, position*/) {
  90. return indexOf.call(this, searchString, arguments[1]) > -1;
  91. };
  92. var contains = isImplemented$2()
  93. ? String.prototype.contains
  94. : shim$2;
  95. var d_1 = createCommonjsModule(function (module) {
  96. var d;
  97. d = module.exports = function (dscr, value/*, options*/) {
  98. var c, e, w, options, desc;
  99. if ((arguments.length < 2) || (typeof dscr !== 'string')) {
  100. options = value;
  101. value = dscr;
  102. dscr = null;
  103. } else {
  104. options = arguments[2];
  105. }
  106. if (dscr == null) {
  107. c = w = true;
  108. e = false;
  109. } else {
  110. c = contains.call(dscr, 'c');
  111. e = contains.call(dscr, 'e');
  112. w = contains.call(dscr, 'w');
  113. }
  114. desc = { value: value, configurable: c, enumerable: e, writable: w };
  115. return !options ? desc : assign(normalizeOptions(options), desc);
  116. };
  117. d.gs = function (dscr, get, set/*, options*/) {
  118. var c, e, options, desc;
  119. if (typeof dscr !== 'string') {
  120. options = set;
  121. set = get;
  122. get = dscr;
  123. dscr = null;
  124. } else {
  125. options = arguments[3];
  126. }
  127. if (get == null) {
  128. get = undefined;
  129. } else if (!isCallable(get)) {
  130. options = get;
  131. get = set = undefined;
  132. } else if (set == null) {
  133. set = undefined;
  134. } else if (!isCallable(set)) {
  135. options = set;
  136. set = undefined;
  137. }
  138. if (dscr == null) {
  139. c = true;
  140. e = false;
  141. } else {
  142. c = contains.call(dscr, 'c');
  143. e = contains.call(dscr, 'e');
  144. }
  145. desc = { get: get, set: set, configurable: c, enumerable: e };
  146. return !options ? desc : assign(normalizeOptions(options), desc);
  147. };
  148. });
  149. var validCallable = function (fn) {
  150. if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
  151. return fn;
  152. };
  153. var eventEmitter = createCommonjsModule(function (module, exports) {
  154. var apply = Function.prototype.apply, call = Function.prototype.call
  155. , create = Object.create, defineProperty = Object.defineProperty
  156. , defineProperties = Object.defineProperties
  157. , hasOwnProperty = Object.prototype.hasOwnProperty
  158. , descriptor = { configurable: true, enumerable: false, writable: true }
  159. , on, once, off, emit, methods, descriptors, base;
  160. on = function (type, listener) {
  161. var data;
  162. validCallable(listener);
  163. if (!hasOwnProperty.call(this, '__ee__')) {
  164. data = descriptor.value = create(null);
  165. defineProperty(this, '__ee__', descriptor);
  166. descriptor.value = null;
  167. } else {
  168. data = this.__ee__;
  169. }
  170. if (!data[type]) data[type] = listener;
  171. else if (typeof data[type] === 'object') data[type].push(listener);
  172. else data[type] = [data[type], listener];
  173. return this;
  174. };
  175. once = function (type, listener) {
  176. var once, self;
  177. validCallable(listener);
  178. self = this;
  179. on.call(this, type, once = function () {
  180. off.call(self, type, once);
  181. apply.call(listener, this, arguments);
  182. });
  183. once.__eeOnceListener__ = listener;
  184. return this;
  185. };
  186. off = function (type, listener) {
  187. var data, listeners, candidate, i;
  188. validCallable(listener);
  189. if (!hasOwnProperty.call(this, '__ee__')) return this;
  190. data = this.__ee__;
  191. if (!data[type]) return this;
  192. listeners = data[type];
  193. if (typeof listeners === 'object') {
  194. for (i = 0; (candidate = listeners[i]); ++i) {
  195. if ((candidate === listener) ||
  196. (candidate.__eeOnceListener__ === listener)) {
  197. if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
  198. else listeners.splice(i, 1);
  199. }
  200. }
  201. } else {
  202. if ((listeners === listener) ||
  203. (listeners.__eeOnceListener__ === listener)) {
  204. delete data[type];
  205. }
  206. }
  207. return this;
  208. };
  209. emit = function (type) {
  210. var i, l, listener, listeners, args;
  211. if (!hasOwnProperty.call(this, '__ee__')) return;
  212. listeners = this.__ee__[type];
  213. if (!listeners) return;
  214. if (typeof listeners === 'object') {
  215. l = arguments.length;
  216. args = new Array(l - 1);
  217. for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
  218. listeners = listeners.slice();
  219. for (i = 0; (listener = listeners[i]); ++i) {
  220. apply.call(listener, this, args);
  221. }
  222. } else {
  223. switch (arguments.length) {
  224. case 1:
  225. call.call(listeners, this);
  226. break;
  227. case 2:
  228. call.call(listeners, this, arguments[1]);
  229. break;
  230. case 3:
  231. call.call(listeners, this, arguments[1], arguments[2]);
  232. break;
  233. default:
  234. l = arguments.length;
  235. args = new Array(l - 1);
  236. for (i = 1; i < l; ++i) {
  237. args[i - 1] = arguments[i];
  238. }
  239. apply.call(listeners, this, args);
  240. }
  241. }
  242. };
  243. methods = {
  244. on: on,
  245. once: once,
  246. off: off,
  247. emit: emit
  248. };
  249. descriptors = {
  250. on: d_1(on),
  251. once: d_1(once),
  252. off: d_1(off),
  253. emit: d_1(emit)
  254. };
  255. base = defineProperties({}, descriptors);
  256. module.exports = exports = function (o) {
  257. return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
  258. };
  259. exports.methods = methods;
  260. });
  261. var eventEmitter_1 = eventEmitter.methods;
  262. /**
  263. * Hooks allow for injecting functions that must all complete in order before finishing
  264. * They will execute in parallel but all must finish before continuing
  265. * Functions may return a promise if they are asycn.
  266. * From epubjs/src/utils/hooks
  267. * @param {any} context scope of this
  268. * @example this.content = new Hook(this);
  269. */
  270. class Hook {
  271. constructor(context){
  272. this.context = context || this;
  273. this.hooks = [];
  274. }
  275. /**
  276. * Adds a function to be run before a hook completes
  277. * @example this.content.register(function(){...});
  278. * @return {undefined} void
  279. */
  280. register(){
  281. for(var i = 0; i < arguments.length; ++i) {
  282. if (typeof arguments[i] === "function") {
  283. this.hooks.push(arguments[i]);
  284. } else {
  285. // unpack array
  286. for(var j = 0; j < arguments[i].length; ++j) {
  287. this.hooks.push(arguments[i][j]);
  288. }
  289. }
  290. }
  291. }
  292. /**
  293. * Triggers a hook to run all functions
  294. * @example this.content.trigger(args).then(function(){...});
  295. * @return {Promise} results
  296. */
  297. trigger(){
  298. var args = arguments;
  299. var context = this.context;
  300. var promises = [];
  301. this.hooks.forEach(function(task) {
  302. var executing = task.apply(context, args);
  303. if(executing && typeof executing["then"] === "function") {
  304. // Task is a function that returns a promise
  305. promises.push(executing);
  306. }
  307. // Otherwise Task resolves immediately, add resolved promise with result
  308. promises.push(new Promise((resolve, reject) => {
  309. resolve(executing);
  310. }));
  311. });
  312. return Promise.all(promises);
  313. }
  314. /**
  315. * Triggers a hook to run all functions synchronously
  316. * @example this.content.trigger(args).then(function(){...});
  317. * @return {Array} results
  318. */
  319. triggerSync(){
  320. var args = arguments;
  321. var context = this.context;
  322. var results = [];
  323. this.hooks.forEach(function(task) {
  324. var executing = task.apply(context, args);
  325. results.push(executing);
  326. });
  327. return results;
  328. }
  329. // Adds a function to be run before a hook completes
  330. list(){
  331. return this.hooks;
  332. }
  333. clear(){
  334. return this.hooks = [];
  335. }
  336. }
  337. function getBoundingClientRect(element) {
  338. if (!element) {
  339. return;
  340. }
  341. let rect;
  342. if (typeof element.getBoundingClientRect !== "undefined") {
  343. rect = element.getBoundingClientRect();
  344. } else {
  345. let range = document.createRange();
  346. range.selectNode(element);
  347. rect = range.getBoundingClientRect();
  348. }
  349. return rect;
  350. }
  351. function getClientRects(element) {
  352. if (!element) {
  353. return;
  354. }
  355. let rect;
  356. if (typeof element.getClientRects !== "undefined") {
  357. rect = element.getClientRects();
  358. } else {
  359. let range = document.createRange();
  360. range.selectNode(element);
  361. rect = range.getClientRects();
  362. }
  363. return rect;
  364. }
  365. /**
  366. * Generates a UUID
  367. * based on: http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
  368. * @returns {string} uuid
  369. */
  370. function UUID() {
  371. var d = new Date().getTime();
  372. if (typeof performance !== "undefined" && typeof performance.now === "function") {
  373. d += performance.now(); //use high-precision timer if available
  374. }
  375. return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
  376. var r = (d + Math.random() * 16) % 16 | 0;
  377. d = Math.floor(d / 16);
  378. return (c === "x" ? r : (r & 0x3 | 0x8)).toString(16);
  379. });
  380. }
  381. function attr(element, attributes) {
  382. for (var i = 0; i < attributes.length; i++) {
  383. if (element.hasAttribute(attributes[i])) {
  384. return element.getAttribute(attributes[i]);
  385. }
  386. }
  387. }
  388. /* Based on by https://mths.be/cssescape v1.5.1 by @mathias | MIT license
  389. * Allows # and .
  390. */
  391. function querySelectorEscape(value) {
  392. if (arguments.length == 0) {
  393. throw new TypeError("`CSS.escape` requires an argument.");
  394. }
  395. var string = String(value);
  396. var length = string.length;
  397. var index = -1;
  398. var codeUnit;
  399. var result = "";
  400. var firstCodeUnit = string.charCodeAt(0);
  401. while (++index < length) {
  402. codeUnit = string.charCodeAt(index);
  403. // Note: there’s no need to special-case astral symbols, surrogate
  404. // pairs, or lone surrogates.
  405. // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
  406. // (U+FFFD).
  407. if (codeUnit == 0x0000) {
  408. result += "\uFFFD";
  409. continue;
  410. }
  411. if (
  412. // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
  413. // U+007F, […]
  414. (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
  415. // If the character is the first character and is in the range [0-9]
  416. // (U+0030 to U+0039), […]
  417. (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
  418. // If the character is the second character and is in the range [0-9]
  419. // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
  420. (
  421. index == 1 &&
  422. codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
  423. firstCodeUnit == 0x002D
  424. )
  425. ) {
  426. // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
  427. result += "\\" + codeUnit.toString(16) + " ";
  428. continue;
  429. }
  430. if (
  431. // If the character is the first character and is a `-` (U+002D), and
  432. // there is no second character, […]
  433. index == 0 &&
  434. length == 1 &&
  435. codeUnit == 0x002D
  436. ) {
  437. result += "\\" + string.charAt(index);
  438. continue;
  439. }
  440. // support for period character in id
  441. if (codeUnit == 0x002E) {
  442. if (string.charAt(0) == "#") {
  443. result += "\\.";
  444. continue;
  445. }
  446. }
  447. // If the character is not handled by one of the above rules and is
  448. // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
  449. // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
  450. // U+005A), or [a-z] (U+0061 to U+007A), […]
  451. if (
  452. codeUnit >= 0x0080 ||
  453. codeUnit == 0x002D ||
  454. codeUnit == 0x005F ||
  455. codeUnit == 35 || // Allow #
  456. codeUnit == 46 || // Allow .
  457. codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
  458. codeUnit >= 0x0041 && codeUnit <= 0x005A ||
  459. codeUnit >= 0x0061 && codeUnit <= 0x007A
  460. ) {
  461. // the character itself
  462. result += string.charAt(index);
  463. continue;
  464. }
  465. // Otherwise, the escaped character.
  466. // https://drafts.csswg.org/cssom/#escape-a-character
  467. result += "\\" + string.charAt(index);
  468. }
  469. return result;
  470. }
  471. /**
  472. * Creates a new pending promise and provides methods to resolve or reject it.
  473. * From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible
  474. * @returns {object} defered
  475. */
  476. function defer() {
  477. this.resolve = null;
  478. this.reject = null;
  479. this.id = UUID();
  480. this.promise = new Promise((resolve, reject) => {
  481. this.resolve = resolve;
  482. this.reject = reject;
  483. });
  484. Object.freeze(this);
  485. }
  486. const requestIdleCallback = typeof window !== "undefined" && ("requestIdleCallback" in window ? window.requestIdleCallback : window.requestAnimationFrame);
  487. function CSSValueToString(obj) {
  488. return obj.value + (obj.unit || "");
  489. }
  490. function isElement(node) {
  491. return node && node.nodeType === 1;
  492. }
  493. function isText(node) {
  494. return node && node.nodeType === 3;
  495. }
  496. function *walk(start, limiter) {
  497. let node = start;
  498. while (node) {
  499. yield node;
  500. if (node.childNodes.length) {
  501. node = node.firstChild;
  502. } else if (node.nextSibling) {
  503. if (limiter && node === limiter) {
  504. node = undefined;
  505. break;
  506. }
  507. node = node.nextSibling;
  508. } else {
  509. while (node) {
  510. node = node.parentNode;
  511. if (limiter && node === limiter) {
  512. node = undefined;
  513. break;
  514. }
  515. if (node && node.nextSibling) {
  516. node = node.nextSibling;
  517. break;
  518. }
  519. }
  520. }
  521. }
  522. }
  523. function nodeAfter(node, limiter) {
  524. let after = node;
  525. if (after.nextSibling) {
  526. if (limiter && node === limiter) {
  527. return;
  528. }
  529. after = after.nextSibling;
  530. } else {
  531. while (after) {
  532. after = after.parentNode;
  533. if (limiter && after === limiter) {
  534. after = undefined;
  535. break;
  536. }
  537. if (after && after.nextSibling) {
  538. after = after.nextSibling;
  539. break;
  540. }
  541. }
  542. }
  543. return after;
  544. }
  545. function nodeBefore(node, limiter) {
  546. let before = node;
  547. if (before.previousSibling) {
  548. if (limiter && node === limiter) {
  549. return;
  550. }
  551. before = before.previousSibling;
  552. } else {
  553. while (before) {
  554. before = before.parentNode;
  555. if (limiter && before === limiter) {
  556. before = undefined;
  557. break;
  558. }
  559. if (before && before.previousSibling) {
  560. before = before.previousSibling;
  561. break;
  562. }
  563. }
  564. }
  565. return before;
  566. }
  567. function elementAfter(node, limiter) {
  568. let after = nodeAfter(node);
  569. while (after && after.nodeType !== 1) {
  570. after = nodeAfter(after);
  571. }
  572. return after;
  573. }
  574. function rebuildAncestors(node) {
  575. let parent, ancestor;
  576. let ancestors = [];
  577. let added = [];
  578. let fragment = document.createDocumentFragment();
  579. // Gather all ancestors
  580. let element = node;
  581. while(element.parentNode && element.parentNode.nodeType === 1) {
  582. ancestors.unshift(element.parentNode);
  583. element = element.parentNode;
  584. }
  585. for (var i = 0; i < ancestors.length; i++) {
  586. ancestor = ancestors[i];
  587. parent = ancestor.cloneNode(false);
  588. parent.setAttribute("data-split-from", parent.getAttribute("data-ref"));
  589. // ancestor.setAttribute("data-split-to", parent.getAttribute("data-ref"));
  590. if (parent.hasAttribute("id")) {
  591. let dataID = parent.getAttribute("id");
  592. parent.setAttribute("data-id", dataID);
  593. parent.removeAttribute("id");
  594. }
  595. // This is handled by css :not, but also tidied up here
  596. if (parent.hasAttribute("data-break-before")) {
  597. parent.removeAttribute("data-break-before");
  598. }
  599. if (parent.hasAttribute("data-previous-break-after")) {
  600. parent.removeAttribute("data-previous-break-after");
  601. }
  602. if (added.length) {
  603. let container = added[added.length-1];
  604. container.appendChild(parent);
  605. } else {
  606. fragment.appendChild(parent);
  607. }
  608. added.push(parent);
  609. }
  610. added = undefined;
  611. return fragment;
  612. }
  613. /*
  614. export function split(bound, cutElement, breakAfter) {
  615. let needsRemoval = [];
  616. let index = indexOf(cutElement);
  617. if (!breakAfter && index === 0) {
  618. return;
  619. }
  620. if (breakAfter && index === (cutElement.parentNode.children.length - 1)) {
  621. return;
  622. }
  623. // Create a fragment with rebuilt ancestors
  624. let fragment = rebuildAncestors(cutElement);
  625. // Clone cut
  626. if (!breakAfter) {
  627. let clone = cutElement.cloneNode(true);
  628. let ref = cutElement.parentNode.getAttribute('data-ref');
  629. let parent = fragment.querySelector("[data-ref='" + ref + "']");
  630. parent.appendChild(clone);
  631. needsRemoval.push(cutElement);
  632. }
  633. // Remove all after cut
  634. let next = nodeAfter(cutElement, bound);
  635. while (next) {
  636. let clone = next.cloneNode(true);
  637. let ref = next.parentNode.getAttribute('data-ref');
  638. let parent = fragment.querySelector("[data-ref='" + ref + "']");
  639. parent.appendChild(clone);
  640. needsRemoval.push(next);
  641. next = nodeAfter(next, bound);
  642. }
  643. // Remove originals
  644. needsRemoval.forEach((node) => {
  645. if (node) {
  646. node.remove();
  647. }
  648. });
  649. // Insert after bounds
  650. bound.parentNode.insertBefore(fragment, bound.nextSibling);
  651. return [bound, bound.nextSibling];
  652. }
  653. */
  654. function needsBreakBefore(node) {
  655. if( typeof node !== "undefined" &&
  656. typeof node.dataset !== "undefined" &&
  657. typeof node.dataset.breakBefore !== "undefined" &&
  658. (node.dataset.breakBefore === "always" ||
  659. node.dataset.breakBefore === "page" ||
  660. node.dataset.breakBefore === "left" ||
  661. node.dataset.breakBefore === "right" ||
  662. node.dataset.breakBefore === "recto" ||
  663. node.dataset.breakBefore === "verso")
  664. ) {
  665. return true;
  666. }
  667. return false;
  668. }
  669. function needsPreviousBreakAfter(node) {
  670. if( typeof node !== "undefined" &&
  671. typeof node.dataset !== "undefined" &&
  672. typeof node.dataset.previousBreakAfter !== "undefined" &&
  673. (node.dataset.previousBreakAfter === "always" ||
  674. node.dataset.previousBreakAfter === "page" ||
  675. node.dataset.previousBreakAfter === "left" ||
  676. node.dataset.previousBreakAfter === "right" ||
  677. node.dataset.previousBreakAfter === "recto" ||
  678. node.dataset.previousBreakAfter === "verso")
  679. ) {
  680. return true;
  681. }
  682. return false;
  683. }
  684. function needsPageBreak(node) {
  685. if( typeof node !== "undefined" &&
  686. typeof node.dataset !== "undefined" &&
  687. (node.dataset.page || node.dataset.afterPage)
  688. ) {
  689. return true;
  690. }
  691. return false;
  692. }
  693. function *words(node) {
  694. let currentText = node.nodeValue;
  695. let max = currentText.length;
  696. let currentOffset = 0;
  697. let currentLetter;
  698. let range;
  699. while(currentOffset < max) {
  700. currentLetter = currentText[currentOffset];
  701. if (/^[\S\u202F\u00A0]$/.test(currentLetter)) {
  702. if (!range) {
  703. range = document.createRange();
  704. range.setStart(node, currentOffset);
  705. }
  706. } else {
  707. if (range) {
  708. range.setEnd(node, currentOffset);
  709. yield range;
  710. range = undefined;
  711. }
  712. }
  713. currentOffset += 1;
  714. }
  715. if (range) {
  716. range.setEnd(node, currentOffset);
  717. yield range;
  718. range = undefined;
  719. }
  720. }
  721. function *letters(wordRange) {
  722. let currentText = wordRange.startContainer;
  723. let max = currentText.length;
  724. let currentOffset = wordRange.startOffset;
  725. // let currentLetter;
  726. let range;
  727. while(currentOffset < max) {
  728. // currentLetter = currentText[currentOffset];
  729. range = document.createRange();
  730. range.setStart(currentText, currentOffset);
  731. range.setEnd(currentText, currentOffset+1);
  732. yield range;
  733. currentOffset += 1;
  734. }
  735. }
  736. function isContainer(node) {
  737. let container;
  738. if (typeof node.tagName === "undefined") {
  739. return true;
  740. }
  741. if (node.style.display === "none") {
  742. return false;
  743. }
  744. switch (node.tagName) {
  745. // Inline
  746. case "A":
  747. case "ABBR":
  748. case "ACRONYM":
  749. case "B":
  750. case "BDO":
  751. case "BIG":
  752. case "BR":
  753. case "BUTTON":
  754. case "CITE":
  755. case "CODE":
  756. case "DFN":
  757. case "EM":
  758. case "I":
  759. case "IMG":
  760. case "INPUT":
  761. case "KBD":
  762. case "LABEL":
  763. case "MAP":
  764. case "OBJECT":
  765. case "Q":
  766. case "SAMP":
  767. case "SCRIPT":
  768. case "SELECT":
  769. case "SMALL":
  770. case "SPAN":
  771. case "STRONG":
  772. case "SUB":
  773. case "SUP":
  774. case "TEXTAREA":
  775. case "TIME":
  776. case "TT":
  777. case "VAR":
  778. case "P":
  779. case "H1":
  780. case "H2":
  781. case "H3":
  782. case "H4":
  783. case "H5":
  784. case "H6":
  785. case "FIGCAPTION":
  786. case "BLOCKQUOTE":
  787. case "PRE":
  788. case "LI":
  789. case "TR":
  790. case "DT":
  791. case "DD":
  792. case "VIDEO":
  793. case "CANVAS":
  794. container = false;
  795. break;
  796. default:
  797. container = true;
  798. }
  799. return container;
  800. }
  801. function cloneNode(n, deep=false) {
  802. return n.cloneNode(deep);
  803. }
  804. function findElement(node, doc) {
  805. const ref = node.getAttribute("data-ref");
  806. return findRef(ref, doc);
  807. }
  808. function findRef(ref, doc) {
  809. return doc.querySelector(`[data-ref='${ref}']`);
  810. }
  811. function validNode(node) {
  812. if (isText(node)) {
  813. return true;
  814. }
  815. if (isElement(node) && node.dataset.ref) {
  816. return true;
  817. }
  818. return false;
  819. }
  820. function prevValidNode(node) {
  821. while (!validNode(node)) {
  822. if (node.previousSibling) {
  823. node = node.previousSibling;
  824. } else {
  825. node = node.parentNode;
  826. }
  827. if (!node) {
  828. break;
  829. }
  830. }
  831. return node;
  832. }
  833. function indexOf$1(node) {
  834. let parent = node.parentNode;
  835. if (!parent) {
  836. return 0;
  837. }
  838. return Array.prototype.indexOf.call(parent.childNodes, node);
  839. }
  840. function child(node, index) {
  841. return node.childNodes[index];
  842. }
  843. function hasContent(node) {
  844. if (isElement(node)) {
  845. return true;
  846. } else if (isText(node) &&
  847. node.textContent.trim().length) {
  848. return true;
  849. }
  850. return false;
  851. }
  852. function indexOfTextNode(node, parent) {
  853. if (!isText(node)) {
  854. return -1;
  855. }
  856. let nodeTextContent = node.textContent;
  857. let child;
  858. let index = -1;
  859. for (var i = 0; i < parent.childNodes.length; i++) {
  860. child = parent.childNodes[i];
  861. if (child.nodeType === 3) {
  862. let text = parent.childNodes[i].textContent;
  863. if (text.includes(nodeTextContent)) {
  864. index = i;
  865. break;
  866. }
  867. }
  868. }
  869. return index;
  870. }
  871. const MAX_CHARS_PER_BREAK = 1500;
  872. /**
  873. * Layout
  874. * @class
  875. */
  876. class Layout {
  877. constructor(element, hooks, options) {
  878. this.element = element;
  879. this.bounds = this.element.getBoundingClientRect();
  880. if (hooks) {
  881. this.hooks = hooks;
  882. } else {
  883. this.hooks = {};
  884. this.hooks.layout = new Hook();
  885. this.hooks.renderNode = new Hook();
  886. this.hooks.layoutNode = new Hook();
  887. this.hooks.beforeOverflow = new Hook();
  888. this.hooks.onOverflow = new Hook();
  889. this.hooks.onBreakToken = new Hook();
  890. }
  891. this.settings = options || {};
  892. this.maxChars = this.settings.maxChars || MAX_CHARS_PER_BREAK;
  893. }
  894. async renderTo(wrapper, source, breakToken, bounds=this.bounds) {
  895. let start = this.getStart(source, breakToken);
  896. let walker = walk(start, source);
  897. let node;
  898. let done;
  899. let next;
  900. let hasRenderedContent = false;
  901. let newBreakToken;
  902. let length = 0;
  903. while (!done && !newBreakToken) {
  904. next = walker.next();
  905. node = next.value;
  906. done = next.done;
  907. if (!node) {
  908. this.hooks && this.hooks.layout.trigger(wrapper, this);
  909. let imgs = wrapper.querySelectorAll("img");
  910. if (imgs.length) {
  911. await this.waitForImages(imgs);
  912. }
  913. newBreakToken = this.findBreakToken(wrapper, source, bounds);
  914. return newBreakToken;
  915. }
  916. this.hooks && this.hooks.layoutNode.trigger(node);
  917. // Check if the rendered element has a break set
  918. if (hasRenderedContent && this.shouldBreak(node)) {
  919. this.hooks && this.hooks.layout.trigger(wrapper, this);
  920. let imgs = wrapper.querySelectorAll("img");
  921. if (imgs.length) {
  922. await this.waitForImages(imgs);
  923. }
  924. newBreakToken = this.findBreakToken(wrapper, source, bounds);
  925. if (!newBreakToken) {
  926. newBreakToken = this.breakAt(node);
  927. }
  928. length = 0;
  929. break;
  930. }
  931. // Should the Node be a shallow or deep clone
  932. let shallow = isContainer(node);
  933. let rendered = this.append(node, wrapper, breakToken, shallow);
  934. length += rendered.textContent.length;
  935. // Check if layout has content yet
  936. if (!hasRenderedContent) {
  937. hasRenderedContent = hasContent(node);
  938. }
  939. // Skip to the next node if a deep clone was rendered
  940. if (!shallow) {
  941. walker = walk(nodeAfter(node, source), source);
  942. }
  943. // Only check x characters
  944. if (length >= this.maxChars) {
  945. this.hooks && this.hooks.layout.trigger(wrapper, this);
  946. let imgs = wrapper.querySelectorAll("img");
  947. if (imgs.length) {
  948. await this.waitForImages(imgs);
  949. }
  950. newBreakToken = this.findBreakToken(wrapper, source, bounds);
  951. if (newBreakToken) {
  952. length = 0;
  953. }
  954. }
  955. }
  956. return newBreakToken;
  957. }
  958. breakAt(node, offset=0) {
  959. return {
  960. node,
  961. offset
  962. };
  963. }
  964. shouldBreak(node) {
  965. let previousSibling = node.previousSibling;
  966. let parentNode = node.parentNode;
  967. let parentBreakBefore = needsBreakBefore(node) && parentNode && !previousSibling && needsBreakBefore(parentNode);
  968. let doubleBreakBefore;
  969. if (parentBreakBefore) {
  970. doubleBreakBefore = node.dataset.breakBefore === parentNode.dataset.breakBefore;
  971. }
  972. return !doubleBreakBefore && needsBreakBefore(node) || needsPreviousBreakAfter(node) || needsPageBreak(node);
  973. }
  974. getStart(source, breakToken) {
  975. let start;
  976. let node = breakToken && breakToken.node;
  977. if (node) {
  978. start = node;
  979. } else {
  980. start = source.firstChild;
  981. }
  982. return start;
  983. }
  984. append(node, dest, breakToken, shallow=true, rebuild=true) {
  985. let clone = cloneNode(node, !shallow);
  986. if (node.parentNode && isElement(node.parentNode)) {
  987. let parent = findElement(node.parentNode, dest);
  988. // Rebuild chain
  989. if (parent) {
  990. parent.appendChild(clone);
  991. } else if (rebuild) {
  992. let fragment = rebuildAncestors(node);
  993. parent = findElement(node.parentNode, fragment);
  994. if (!parent) {
  995. dest.appendChild(clone);
  996. } else if (breakToken && isText(breakToken.node) && breakToken.offset > 0) {
  997. clone.textContent = clone.textContent.substring(breakToken.offset);
  998. parent.appendChild(clone);
  999. } else {
  1000. parent.appendChild(clone);
  1001. }
  1002. dest.appendChild(fragment);
  1003. } else {
  1004. dest.appendChild(clone);
  1005. }
  1006. } else {
  1007. dest.appendChild(clone);
  1008. }
  1009. let nodeHooks = this.hooks.renderNode.triggerSync(clone, node);
  1010. nodeHooks.forEach((newNode) => {
  1011. if (typeof newNode != "undefined") {
  1012. clone = newNode;
  1013. }
  1014. });
  1015. return clone;
  1016. }
  1017. async waitForImages(imgs) {
  1018. let results = Array.from(imgs).map(async (img) => {
  1019. return this.awaitImageLoaded(img);
  1020. });
  1021. await Promise.all(results);
  1022. }
  1023. async awaitImageLoaded(image) {
  1024. return new Promise(resolve => {
  1025. if (image.complete !== true) {
  1026. image.onload = function() {
  1027. let { width, height } = window.getComputedStyle(image);
  1028. resolve(width, height);
  1029. };
  1030. image.onerror = function(e) {
  1031. let { width, height } = window.getComputedStyle(image);
  1032. resolve(width, height, e);
  1033. };
  1034. } else {
  1035. let { width, height } = window.getComputedStyle(image);
  1036. resolve(width, height);
  1037. }
  1038. });
  1039. }
  1040. avoidBreakInside(node, limiter) {
  1041. let breakNode;
  1042. if (node === limiter) {
  1043. return;
  1044. }
  1045. while (node.parentNode) {
  1046. node = node.parentNode;
  1047. if (node === limiter) {
  1048. break;
  1049. }
  1050. if(window.getComputedStyle(node)["break-inside"] === "avoid") {
  1051. breakNode = node;
  1052. break;
  1053. }
  1054. }
  1055. return breakNode;
  1056. }
  1057. createBreakToken(overflow, rendered, source) {
  1058. let container = overflow.startContainer;
  1059. let offset = overflow.startOffset;
  1060. let node, renderedNode, parent, index, temp;
  1061. if (isElement(container)) {
  1062. temp = child(container, offset);
  1063. if (isElement(temp)) {
  1064. renderedNode = findElement(temp, rendered);
  1065. if (!renderedNode) {
  1066. // Find closest element with data-ref
  1067. renderedNode = findElement(prevValidNode(temp), rendered);
  1068. // Check if temp is the last rendered node at its level.
  1069. if (!temp.nextSibling) {
  1070. // We need to ensure that the previous sibling of temp is fully rendered.
  1071. const renderedNodeFromSource = findElement(renderedNode, source);
  1072. const walker = document.createTreeWalker(renderedNodeFromSource, NodeFilter.SHOW_ELEMENT);
  1073. const lastChildOfRenderedNodeFromSource = walker.lastChild();
  1074. const lastChildOfRenderedNodeMatchingFromRendered = findElement(lastChildOfRenderedNodeFromSource, rendered);
  1075. // Check if we found that the last child in source
  1076. if (!lastChildOfRenderedNodeMatchingFromRendered) {
  1077. // Pending content to be rendered before virtual break token
  1078. return;
  1079. }
  1080. // Otherwise we will return a break token as per below
  1081. }
  1082. // renderedNode is actually the last unbroken box that does not overflow.
  1083. // Break Token is therefore the next sibling of renderedNode within source node.
  1084. node = findElement(renderedNode, source).nextSibling;
  1085. offset = 0;
  1086. } else {
  1087. node = findElement(renderedNode, source);
  1088. offset = 0;
  1089. }
  1090. } else {
  1091. renderedNode = findElement(container, rendered);
  1092. if (!renderedNode) {
  1093. renderedNode = findElement(prevValidNode(container), rendered);
  1094. }
  1095. parent = findElement(renderedNode, source);
  1096. index = indexOfTextNode(temp, parent);
  1097. node = child(parent, index);
  1098. offset = 0;
  1099. }
  1100. } else {
  1101. renderedNode = findElement(container.parentNode, rendered);
  1102. if (!renderedNode) {
  1103. renderedNode = findElement(prevValidNode(container.parentNode), rendered);
  1104. }
  1105. parent = findElement(renderedNode, source);
  1106. index = indexOfTextNode(container, parent);
  1107. if (index === -1) {
  1108. return;
  1109. }
  1110. node = child(parent, index);
  1111. offset += node.textContent.indexOf(container.textContent);
  1112. }
  1113. if (!node) {
  1114. return;
  1115. }
  1116. return {
  1117. node,
  1118. offset
  1119. };
  1120. }
  1121. findBreakToken(rendered, source, bounds=this.bounds, extract=true) {
  1122. let overflow = this.findOverflow(rendered, bounds);
  1123. let breakToken, breakLetter;
  1124. let overflowHooks = this.hooks.onOverflow.triggerSync(overflow, rendered, bounds, this);
  1125. overflowHooks.forEach((newOverflow) => {
  1126. if (typeof newOverflow != "undefined") {
  1127. overflow = newOverflow;
  1128. }
  1129. });
  1130. if (overflow) {
  1131. breakToken = this.createBreakToken(overflow, rendered, source);
  1132. // breakToken is nullable
  1133. if (breakToken && breakToken["node"] && breakToken["offset"] && breakToken["node"].textContent) {
  1134. breakLetter = breakToken["node"].textContent.charAt(breakToken["offset"]);
  1135. } else {
  1136. breakLetter = undefined;
  1137. }
  1138. let breakHooks = this.hooks.onBreakToken.triggerSync(breakToken, overflow, rendered, this);
  1139. breakHooks.forEach((newToken) => {
  1140. if (typeof newToken != "undefined") {
  1141. breakToken = newToken;
  1142. }
  1143. });
  1144. if (breakToken && breakToken.node && extract) {
  1145. this.removeOverflow(overflow, breakLetter);
  1146. }
  1147. }
  1148. return breakToken;
  1149. }
  1150. hasOverflow(element, bounds=this.bounds) {
  1151. let constrainingElement = element && element.parentNode; // this gets the element, instead of the wrapper for the width workaround
  1152. let { width } = element.getBoundingClientRect();
  1153. let scrollWidth = constrainingElement ? constrainingElement.scrollWidth : 0;
  1154. return Math.max(Math.floor(width), scrollWidth) > Math.round(bounds.width);
  1155. }
  1156. findOverflow(rendered, bounds=this.bounds) {
  1157. if (!this.hasOverflow(rendered, bounds)) return;
  1158. let start = Math.round(bounds.left);
  1159. let end = Math.round(bounds.right);
  1160. let range;
  1161. let walker = walk(rendered.firstChild, rendered);
  1162. // Find Start
  1163. let next, done, node, offset, skip, breakAvoid, prev, br;
  1164. while (!done) {
  1165. next = walker.next();
  1166. done = next.done;
  1167. node = next.value;
  1168. skip = false;
  1169. breakAvoid = false;
  1170. prev = undefined;
  1171. br = undefined;
  1172. if (node) {
  1173. let pos = getBoundingClientRect(node);
  1174. let left = Math.round(pos.left);
  1175. let right = Math.floor(pos.right);
  1176. if (!range && left >= end) {
  1177. // Check if it is a float
  1178. let isFloat = false;
  1179. if (isElement(node) ) {
  1180. let styles = window.getComputedStyle(node);
  1181. isFloat = styles.getPropertyValue("float") !== "none";
  1182. skip = styles.getPropertyValue("break-inside") === "avoid";
  1183. breakAvoid = node.dataset.breakBefore === "avoid" || node.dataset.previousBreakAfter === "avoid";
  1184. prev = breakAvoid && nodeBefore(node, rendered);
  1185. br = node.tagName === "BR" || node.tagName === "WBR";
  1186. }
  1187. if (prev) {
  1188. range = document.createRange();
  1189. range.setStartBefore(prev);
  1190. break;
  1191. }
  1192. if (!br && !isFloat && isElement(node)) {
  1193. range = document.createRange();
  1194. range.setStartBefore(node);
  1195. break;
  1196. }
  1197. if (isText(node) && node.textContent.trim().length) {
  1198. range = document.createRange();
  1199. range.setStartBefore(node);
  1200. break;
  1201. }
  1202. }
  1203. if (!range && isText(node) &&
  1204. node.textContent.trim().length &&
  1205. window.getComputedStyle(node.parentNode)["break-inside"] !== "avoid") {
  1206. let rects = getClientRects(node);
  1207. let rect;
  1208. left = 0;
  1209. for (var i = 0; i != rects.length; i++) {
  1210. rect = rects[i];
  1211. if (rect.width > 0 && (!left || rect.left > left)) {
  1212. left = rect.left;
  1213. }
  1214. }
  1215. if(left >= end) {
  1216. range = document.createRange();
  1217. offset = this.textBreak(node, start, end);
  1218. if (!offset) {
  1219. range = undefined;
  1220. } else {
  1221. range.setStart(node, offset);
  1222. }
  1223. break;
  1224. }
  1225. }
  1226. // Skip children
  1227. if (skip || right <= end) {
  1228. next = nodeAfter(node, rendered);
  1229. if (next) {
  1230. walker = walk(next, rendered);
  1231. }
  1232. }
  1233. }
  1234. }
  1235. // Find End
  1236. if (range) {
  1237. range.setEndAfter(rendered.lastChild);
  1238. return range;
  1239. }
  1240. }
  1241. findEndToken(rendered, source, bounds=this.bounds) {
  1242. if (rendered.childNodes.length === 0) {
  1243. return;
  1244. }
  1245. let lastChild = rendered.lastChild;
  1246. let lastNodeIndex;
  1247. while (lastChild && lastChild.lastChild) {
  1248. if (!validNode(lastChild)) {
  1249. // Only get elements with refs
  1250. lastChild = lastChild.previousSibling;
  1251. } else if(!validNode(lastChild.lastChild)) {
  1252. // Deal with invalid dom items
  1253. lastChild = prevValidNode(lastChild.lastChild);
  1254. break;
  1255. } else {
  1256. lastChild = lastChild.lastChild;
  1257. }
  1258. }
  1259. if (isText(lastChild)) {
  1260. if (lastChild.parentNode.dataset.ref) {
  1261. lastNodeIndex = indexOf$1(lastChild);
  1262. lastChild = lastChild.parentNode;
  1263. } else {
  1264. lastChild = lastChild.previousSibling;
  1265. }
  1266. }
  1267. let original = findElement(lastChild, source);
  1268. if (lastNodeIndex) {
  1269. original = original.childNodes[lastNodeIndex];
  1270. }
  1271. let after = nodeAfter(original);
  1272. return this.breakAt(after);
  1273. }
  1274. textBreak(node, start, end) {
  1275. let wordwalker = words(node);
  1276. let left = 0;
  1277. let right = 0;
  1278. let word, next, done, pos;
  1279. let offset;
  1280. while (!done) {
  1281. next = wordwalker.next();
  1282. word = next.value;
  1283. done = next.done;
  1284. if (!word) {
  1285. break;
  1286. }
  1287. pos = getBoundingClientRect(word);
  1288. left = Math.floor(pos.left);
  1289. right = Math.floor(pos.right);
  1290. if (left >= end) {
  1291. offset = word.startOffset;
  1292. break;
  1293. }
  1294. if (right > end) {
  1295. let letterwalker = letters(word);
  1296. let letter, nextLetter, doneLetter;
  1297. while (!doneLetter) {
  1298. nextLetter = letterwalker.next();
  1299. letter = nextLetter.value;
  1300. doneLetter = nextLetter.done;
  1301. if (!letter) {
  1302. break;
  1303. }
  1304. pos = getBoundingClientRect(letter);
  1305. left = Math.floor(pos.left);
  1306. if (left >= end) {
  1307. offset = letter.startOffset;
  1308. done = true;
  1309. break;
  1310. }
  1311. }
  1312. }
  1313. }
  1314. return offset;
  1315. }
  1316. removeOverflow(overflow, breakLetter) {
  1317. let {startContainer} = overflow;
  1318. let extracted = overflow.extractContents();
  1319. this.hyphenateAtBreak(startContainer, breakLetter);
  1320. return extracted;
  1321. }
  1322. hyphenateAtBreak(startContainer, breakLetter) {
  1323. if (isText(startContainer)) {
  1324. let startText = startContainer.textContent;
  1325. let prevLetter = startText[startText.length-1];
  1326. // Add a hyphen if previous character is a letter or soft hyphen
  1327. if (
  1328. (breakLetter && /^\w|\u00AD$/.test(prevLetter) && /^\w|\u00AD$/.test(breakLetter)) ||
  1329. (!breakLetter && /^\w|\u00AD$/.test(prevLetter))
  1330. ) {
  1331. startContainer.parentNode.classList.add("pagedjs_hyphen");
  1332. startContainer.textContent += this.settings.hyphenGlyph || "\u2011";
  1333. }
  1334. }
  1335. }
  1336. }
  1337. eventEmitter(Layout.prototype);
  1338. /**
  1339. * Render a page
  1340. * @class
  1341. */
  1342. class Page {
  1343. constructor(pagesArea, pageTemplate, blank, hooks) {
  1344. this.pagesArea = pagesArea;
  1345. this.pageTemplate = pageTemplate;
  1346. this.blank = blank;
  1347. this.width = undefined;
  1348. this.height = undefined;
  1349. this.hooks = hooks;
  1350. // this.element = this.create(this.pageTemplate);
  1351. }
  1352. create(template, after) {
  1353. //let documentFragment = document.createRange().createContextualFragment( TEMPLATE );
  1354. //let page = documentFragment.children[0];
  1355. let clone = document.importNode(this.pageTemplate.content, true);
  1356. let page, index;
  1357. if (after) {
  1358. this.pagesArea.insertBefore(clone, after.nextElementSibling);
  1359. index = Array.prototype.indexOf.call(this.pagesArea.children, after.nextElementSibling);
  1360. page = this.pagesArea.children[index];
  1361. } else {
  1362. this.pagesArea.appendChild(clone);
  1363. page = this.pagesArea.lastChild;
  1364. }
  1365. let pagebox = page.querySelector(".pagedjs_pagebox");
  1366. let area = page.querySelector(".pagedjs_page_content");
  1367. let size = area.getBoundingClientRect();
  1368. area.style.columnWidth = Math.round(size.width) + "px";
  1369. area.style.columnGap = "calc(var(--pagedjs-margin-right) + var(--pagedjs-margin-left))";
  1370. // area.style.overflow = "scroll";
  1371. this.width = Math.round(size.width);
  1372. this.height = Math.round(size.height);
  1373. this.element = page;
  1374. this.pagebox = pagebox;
  1375. this.area = area;
  1376. return page;
  1377. }
  1378. createWrapper() {
  1379. let wrapper = document.createElement("div");
  1380. this.area.appendChild(wrapper);
  1381. this.wrapper = wrapper;
  1382. return wrapper;
  1383. }
  1384. index(pgnum) {
  1385. this.position = pgnum;
  1386. let page = this.element;
  1387. // let pagebox = this.pagebox;
  1388. let index = pgnum+1;
  1389. let id = `page-${index}`;
  1390. this.id = id;
  1391. // page.dataset.pageNumber = index;
  1392. page.dataset.pageNumber = index;
  1393. page.setAttribute("id", id);
  1394. if (this.name) {
  1395. page.classList.add("pagedjs_" + this.name + "_page");
  1396. }
  1397. if (this.blank) {
  1398. page.classList.add("pagedjs_blank_page");
  1399. }
  1400. if (pgnum === 0) {
  1401. page.classList.add("pagedjs_first_page");
  1402. }
  1403. if (pgnum % 2 !== 1) {
  1404. page.classList.remove("pagedjs_left_page");
  1405. page.classList.add("pagedjs_right_page");
  1406. } else {
  1407. page.classList.remove("pagedjs_right_page");
  1408. page.classList.add("pagedjs_left_page");
  1409. }
  1410. }
  1411. /*
  1412. size(width, height) {
  1413. if (width === this.width && height === this.height) {
  1414. return;
  1415. }
  1416. this.width = width;
  1417. this.height = height;
  1418. this.element.style.width = Math.round(width) + "px";
  1419. this.element.style.height = Math.round(height) + "px";
  1420. this.element.style.columnWidth = Math.round(width) + "px";
  1421. }
  1422. */
  1423. async layout(contents, breakToken, maxChars) {
  1424. this.clear();
  1425. this.startToken = breakToken;
  1426. this.layoutMethod = new Layout(this.area, this.hooks, maxChars);
  1427. let newBreakToken = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken);
  1428. this.addListeners(contents);
  1429. this.endToken = newBreakToken;
  1430. return newBreakToken;
  1431. }
  1432. async append(contents, breakToken) {
  1433. if (!this.layoutMethod) {
  1434. return this.layout(contents, breakToken);
  1435. }
  1436. let newBreakToken = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken);
  1437. this.endToken = newBreakToken;
  1438. return newBreakToken;
  1439. }
  1440. getByParent(ref, entries) {
  1441. let e;
  1442. for (var i = 0; i < entries.length; i++) {
  1443. e = entries[i];
  1444. if(e.dataset.ref === ref) {
  1445. return e;
  1446. }
  1447. }
  1448. }
  1449. onOverflow(func) {
  1450. this._onOverflow = func;
  1451. }
  1452. onUnderflow(func) {
  1453. this._onUnderflow = func;
  1454. }
  1455. clear() {
  1456. this.removeListeners();
  1457. this.wrapper && this.wrapper.remove();
  1458. this.createWrapper();
  1459. }
  1460. addListeners(contents) {
  1461. if (typeof ResizeObserver !== "undefined") {
  1462. this.addResizeObserver(contents);
  1463. } else {
  1464. this._checkOverflowAfterResize = this.checkOverflowAfterResize.bind(this, contents);
  1465. this.element.addEventListener("overflow", this._checkOverflowAfterResize, false);
  1466. this.element.addEventListener("underflow", this._checkOverflowAfterResize, false);
  1467. }
  1468. // TODO: fall back to mutation observer?
  1469. this._onScroll = function() {
  1470. if(this.listening) {
  1471. this.element.scrollLeft = 0;
  1472. }
  1473. }.bind(this);
  1474. // Keep scroll left from changing
  1475. this.element.addEventListener("scroll", this._onScroll);
  1476. this.listening = true;
  1477. return true;
  1478. }
  1479. removeListeners() {
  1480. this.listening = false;
  1481. if (typeof ResizeObserver !== "undefined" && this.ro) {
  1482. this.ro.disconnect();
  1483. } else if (this.element) {
  1484. this.element.removeEventListener("overflow", this._checkOverflowAfterResize, false);
  1485. this.element.removeEventListener("underflow", this._checkOverflowAfterResize, false);
  1486. }
  1487. this.element &&this.element.removeEventListener("scroll", this._onScroll);
  1488. }
  1489. addResizeObserver(contents) {
  1490. let wrapper = this.wrapper;
  1491. let prevHeight = wrapper.getBoundingClientRect().height;
  1492. this.ro = new ResizeObserver( entries => {
  1493. if (!this.listening) {
  1494. return;
  1495. }
  1496. for (let entry of entries) {
  1497. const cr = entry.contentRect;
  1498. if (cr.height > prevHeight) {
  1499. this.checkOverflowAfterResize(contents);
  1500. prevHeight = wrapper.getBoundingClientRect().height;
  1501. } else if (cr.height < prevHeight ) { // TODO: calc line height && (prevHeight - cr.height) >= 22
  1502. this.checkUnderflowAfterResize(contents);
  1503. prevHeight = cr.height;
  1504. }
  1505. }
  1506. });
  1507. this.ro.observe(wrapper);
  1508. }
  1509. checkOverflowAfterResize(contents) {
  1510. if (!this.listening || !this.layoutMethod) {
  1511. return;
  1512. }
  1513. let newBreakToken = this.layoutMethod.findBreakToken(this.wrapper, contents);
  1514. if (newBreakToken) {
  1515. this.endToken = newBreakToken;
  1516. this._onOverflow && this._onOverflow(newBreakToken);
  1517. }
  1518. }
  1519. checkUnderflowAfterResize(contents) {
  1520. if (!this.listening || !this.layoutMethod) {
  1521. return;
  1522. }
  1523. let endToken = this.layoutMethod.findEndToken(this.wrapper, contents);
  1524. // let newBreakToken = this.layoutMethod.findBreakToken(this.wrapper, contents);
  1525. if (endToken) {
  1526. this._onUnderflow && this._onUnderflow(endToken);
  1527. }
  1528. }
  1529. destroy() {
  1530. this.removeListeners();
  1531. this.element.remove();
  1532. this.element = undefined;
  1533. this.wrapper = undefined;
  1534. }
  1535. }
  1536. eventEmitter(Page.prototype);
  1537. /**
  1538. * Render a flow of text offscreen
  1539. * @class
  1540. */
  1541. class ContentParser {
  1542. constructor(content, cb) {
  1543. if (content && content.nodeType) {
  1544. // handle dom
  1545. this.dom = this.add(content);
  1546. } else if (typeof content === "string") {
  1547. this.dom = this.parse(content);
  1548. }
  1549. return this.dom;
  1550. }
  1551. parse(markup, mime) {
  1552. let range = document.createRange();
  1553. let fragment = range.createContextualFragment(markup);
  1554. this.addRefs(fragment);
  1555. this.removeEmpty(fragment);
  1556. return fragment;
  1557. }
  1558. add(contents) {
  1559. // let fragment = document.createDocumentFragment();
  1560. //
  1561. // let children = [...contents.childNodes];
  1562. // for (let child of children) {
  1563. // let clone = child.cloneNode(true);
  1564. // fragment.appendChild(clone);
  1565. // }
  1566. this.addRefs(contents);
  1567. this.removeEmpty(contents);
  1568. return contents;
  1569. }
  1570. addRefs(content) {
  1571. var treeWalker = document.createTreeWalker(
  1572. content,
  1573. NodeFilter.SHOW_ELEMENT,
  1574. { acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
  1575. false
  1576. );
  1577. let node = treeWalker.nextNode();
  1578. while(node) {
  1579. if (!node.hasAttribute("data-ref")) {
  1580. let uuid = UUID();
  1581. node.setAttribute("data-ref", uuid);
  1582. }
  1583. if (node.id) {
  1584. node.setAttribute("data-id", node.id);
  1585. }
  1586. // node.setAttribute("data-children", node.childNodes.length);
  1587. // node.setAttribute("data-text", node.textContent.trim().length);
  1588. node = treeWalker.nextNode();
  1589. }
  1590. }
  1591. removeEmpty(content) {
  1592. var treeWalker = document.createTreeWalker(
  1593. content,
  1594. NodeFilter.SHOW_TEXT,
  1595. { acceptNode: function(node) {
  1596. // Only remove more than a single space
  1597. if (node.textContent.length > 1 && !node.textContent.trim()) {
  1598. // Don't touch whitespace if text is preformated
  1599. let parent = node.parentNode;
  1600. let pre = isElement(parent) && parent.closest("pre");
  1601. if (pre) {
  1602. return NodeFilter.FILTER_REJECT;
  1603. }
  1604. return NodeFilter.FILTER_ACCEPT;
  1605. } else {
  1606. return NodeFilter.FILTER_REJECT;
  1607. }
  1608. } },
  1609. false
  1610. );
  1611. let node;
  1612. let current;
  1613. node = treeWalker.nextNode();
  1614. while(node) {
  1615. current = node;
  1616. node = treeWalker.nextNode();
  1617. // if (!current.nextSibling || (current.nextSibling && current.nextSibling.nodeType === 1)) {
  1618. current.parentNode.removeChild(current);
  1619. // }
  1620. }
  1621. }
  1622. find(ref) {
  1623. return this.refs[ref];
  1624. }
  1625. // isWrapper(element) {
  1626. // return wrappersRegex.test(element.nodeName);
  1627. // }
  1628. isText(node) {
  1629. return node.tagName === "TAG";
  1630. }
  1631. isElement(node) {
  1632. return node.nodeType === 1;
  1633. }
  1634. hasChildren(node) {
  1635. return node.childNodes && node.childNodes.length;
  1636. }
  1637. destroy() {
  1638. this.refs = undefined;
  1639. this.dom = undefined;
  1640. }
  1641. }
  1642. /**
  1643. * Queue for handling tasks one at a time
  1644. * @class
  1645. * @param {scope} context what this will resolve to in the tasks
  1646. */
  1647. class Queue {
  1648. constructor(context){
  1649. this._q = [];
  1650. this.context = context;
  1651. this.tick = requestAnimationFrame;
  1652. this.running = false;
  1653. this.paused = false;
  1654. }
  1655. /**
  1656. * Add an item to the queue
  1657. * @return {Promise} enqueued
  1658. */
  1659. enqueue() {
  1660. var deferred, promise;
  1661. var queued;
  1662. var task = [].shift.call(arguments);
  1663. var args = arguments;
  1664. // Handle single args without context
  1665. // if(args && !Array.isArray(args)) {
  1666. // args = [args];
  1667. // }
  1668. if(!task) {
  1669. throw new Error("No Task Provided");
  1670. }
  1671. if(typeof task === "function"){
  1672. deferred = new defer();
  1673. promise = deferred.promise;
  1674. queued = {
  1675. "task" : task,
  1676. "args" : args,
  1677. //"context" : context,
  1678. "deferred" : deferred,
  1679. "promise" : promise
  1680. };
  1681. } else {
  1682. // Task is a promise
  1683. queued = {
  1684. "promise" : task
  1685. };
  1686. }
  1687. this._q.push(queued);
  1688. // Wait to start queue flush
  1689. if (this.paused == false && !this.running) {
  1690. this.run();
  1691. }
  1692. return queued.promise;
  1693. }
  1694. /**
  1695. * Run one item
  1696. * @return {Promise} dequeued
  1697. */
  1698. dequeue(){
  1699. var inwait, task, result;
  1700. if(this._q.length && !this.paused) {
  1701. inwait = this._q.shift();
  1702. task = inwait.task;
  1703. if(task){
  1704. // console.log(task)
  1705. result = task.apply(this.context, inwait.args);
  1706. if(result && typeof result["then"] === "function") {
  1707. // Task is a function that returns a promise
  1708. return result.then(function(){
  1709. inwait.deferred.resolve.apply(this.context, arguments);
  1710. }.bind(this), function() {
  1711. inwait.deferred.reject.apply(this.context, arguments);
  1712. }.bind(this));
  1713. } else {
  1714. // Task resolves immediately
  1715. inwait.deferred.resolve.apply(this.context, result);
  1716. return inwait.promise;
  1717. }
  1718. } else if(inwait.promise) {
  1719. // Task is a promise
  1720. return inwait.promise;
  1721. }
  1722. } else {
  1723. inwait = new defer();
  1724. inwait.deferred.resolve();
  1725. return inwait.promise;
  1726. }
  1727. }
  1728. // Run All Immediately
  1729. dump(){
  1730. while(this._q.length) {
  1731. this.dequeue();
  1732. }
  1733. }
  1734. /**
  1735. * Run all tasks sequentially, at convince
  1736. * @return {Promise} all run
  1737. */
  1738. run(){
  1739. if(!this.running){
  1740. this.running = true;
  1741. this.defered = new defer();
  1742. }
  1743. this.tick.call(window, () => {
  1744. if(this._q.length) {
  1745. this.dequeue()
  1746. .then(function(){
  1747. this.run();
  1748. }.bind(this));
  1749. } else {
  1750. this.defered.resolve();
  1751. this.running = undefined;
  1752. }
  1753. });
  1754. // Unpause
  1755. if(this.paused == true) {
  1756. this.paused = false;
  1757. }
  1758. return this.defered.promise;
  1759. }
  1760. /**
  1761. * Flush all, as quickly as possible
  1762. * @return {Promise} ran
  1763. */
  1764. flush(){
  1765. if(this.running){
  1766. return this.running;
  1767. }
  1768. if(this._q.length) {
  1769. this.running = this.dequeue()
  1770. .then(function(){
  1771. this.running = undefined;
  1772. return this.flush();
  1773. }.bind(this));
  1774. return this.running;
  1775. }
  1776. }
  1777. /**
  1778. * Clear all items in wait
  1779. * @return {void}
  1780. */
  1781. clear(){
  1782. this._q = [];
  1783. }
  1784. /**
  1785. * Get the number of tasks in the queue
  1786. * @return {number} tasks
  1787. */
  1788. length(){
  1789. return this._q.length;
  1790. }
  1791. /**
  1792. * Pause a running queue
  1793. * @return {void}
  1794. */
  1795. pause(){
  1796. this.paused = true;
  1797. }
  1798. /**
  1799. * End the queue
  1800. * @return {void}
  1801. */
  1802. stop(){
  1803. this._q = [];
  1804. this.running = false;
  1805. this.paused = true;
  1806. }
  1807. }
  1808. const TEMPLATE = `
  1809. <div class="pagedjs_page">
  1810. <div class="pagedjs_sheet">
  1811. <div class="pagedjs_bleed pagedjs_bleed-top">
  1812. <div class="pagedjs_marks-crop"></div>
  1813. <div class="pagedjs_marks-middle">
  1814. <div class="pagedjs_marks-cross"></div>
  1815. </div>
  1816. <div class="pagedjs_marks-crop"></div>
  1817. </div>
  1818. <div class="pagedjs_bleed pagedjs_bleed-bottom">
  1819. <div class="pagedjs_marks-crop"></div>
  1820. <div class="pagedjs_marks-middle">
  1821. <div class="pagedjs_marks-cross"></div>
  1822. </div> <div class="pagedjs_marks-crop"></div>
  1823. </div>
  1824. <div class="pagedjs_bleed pagedjs_bleed-left">
  1825. <div class="pagedjs_marks-crop"></div>
  1826. <div class="pagedjs_marks-middle">
  1827. <div class="pagedjs_marks-cross"></div>
  1828. </div> <div class="pagedjs_marks-crop"></div>
  1829. </div>
  1830. <div class="pagedjs_bleed pagedjs_bleed-right">
  1831. <div class="pagedjs_marks-crop"></div>
  1832. <div class="pagedjs_marks-middle">
  1833. <div class="pagedjs_marks-cross"></div>
  1834. </div>
  1835. <div class="pagedjs_marks-crop"></div>
  1836. </div>
  1837. <div class="pagedjs_pagebox">
  1838. <div class="pagedjs_margin-top-left-corner-holder">
  1839. <div class="pagedjs_margin pagedjs_margin-top-left-corner"><div class="pagedjs_margin-content"></div></div>
  1840. </div>
  1841. <div class="pagedjs_margin-top">
  1842. <div class="pagedjs_margin pagedjs_margin-top-left"><div class="pagedjs_margin-content"></div></div>
  1843. <div class="pagedjs_margin pagedjs_margin-top-center"><div class="pagedjs_margin-content"></div></div>
  1844. <div class="pagedjs_margin pagedjs_margin-top-right"><div class="pagedjs_margin-content"></div></div>
  1845. </div>
  1846. <div class="pagedjs_margin-top-right-corner-holder">
  1847. <div class="pagedjs_margin pagedjs_margin-top-right-corner"><div class="pagedjs_margin-content"></div></div>
  1848. </div>
  1849. <div class="pagedjs_margin-right">
  1850. <div class="pagedjs_margin pagedjs_margin-right-top"><div class="pagedjs_margin-content"></div></div>
  1851. <div class="pagedjs_margin pagedjs_margin-right-middle"><div class="pagedjs_margin-content"></div></div>
  1852. <div class="pagedjs_margin pagedjs_margin-right-bottom"><div class="pagedjs_margin-content"></div></div>
  1853. </div>
  1854. <div class="pagedjs_margin-left">
  1855. <div class="pagedjs_margin pagedjs_margin-left-top"><div class="pagedjs_margin-content"></div></div>
  1856. <div class="pagedjs_margin pagedjs_margin-left-middle"><div class="pagedjs_margin-content"></div></div>
  1857. <div class="pagedjs_margin pagedjs_margin-left-bottom"><div class="pagedjs_margin-content"></div></div>
  1858. </div>
  1859. <div class="pagedjs_margin-bottom-left-corner-holder">
  1860. <div class="pagedjs_margin pagedjs_margin-bottom-left-corner"><div class="pagedjs_margin-content"></div></div>
  1861. </div>
  1862. <div class="pagedjs_margin-bottom">
  1863. <div class="pagedjs_margin pagedjs_margin-bottom-left"><div class="pagedjs_margin-content"></div></div>
  1864. <div class="pagedjs_margin pagedjs_margin-bottom-center"><div class="pagedjs_margin-content"></div></div>
  1865. <div class="pagedjs_margin pagedjs_margin-bottom-right"><div class="pagedjs_margin-content"></div></div>
  1866. </div>
  1867. <div class="pagedjs_margin-bottom-right-corner-holder">
  1868. <div class="pagedjs_margin pagedjs_margin-bottom-right-corner"><div class="pagedjs_margin-content"></div></div>
  1869. </div>
  1870. <div class="pagedjs_area">
  1871. <div class="pagedjs_page_content"></div>
  1872. </div>
  1873. </div>
  1874. </div>
  1875. </div>`;
  1876. /**
  1877. * Chop up text into flows
  1878. * @class
  1879. */
  1880. class Chunker {
  1881. constructor(content, renderTo, options) {
  1882. // this.preview = preview;
  1883. this.settings = options || {};
  1884. this.hooks = {};
  1885. this.hooks.beforeParsed = new Hook(this);
  1886. this.hooks.afterParsed = new Hook(this);
  1887. this.hooks.beforePageLayout = new Hook(this);
  1888. this.hooks.layout = new Hook(this);
  1889. this.hooks.renderNode = new Hook(this);
  1890. this.hooks.layoutNode = new Hook(this);
  1891. this.hooks.onOverflow = new Hook(this);
  1892. this.hooks.onBreakToken = new Hook();
  1893. this.hooks.afterPageLayout = new Hook(this);
  1894. this.hooks.afterRendered = new Hook(this);
  1895. this.pages = [];
  1896. this.total = 0;
  1897. this.q = new Queue(this);
  1898. this.stopped = false;
  1899. this.rendered = false;
  1900. this.content = content;
  1901. this.charsPerBreak = [];
  1902. this.maxChars;
  1903. if (content) {
  1904. this.flow(content, renderTo);
  1905. }
  1906. }
  1907. setup(renderTo) {
  1908. this.pagesArea = document.createElement("div");
  1909. this.pagesArea.classList.add("pagedjs_pages");
  1910. if (renderTo) {
  1911. renderTo.appendChild(this.pagesArea);
  1912. } else {
  1913. document.querySelector("body").appendChild(this.pagesArea);
  1914. }
  1915. this.pageTemplate = document.createElement("template");
  1916. this.pageTemplate.innerHTML = TEMPLATE;
  1917. }
  1918. async flow(content, renderTo) {
  1919. let parsed;
  1920. await this.hooks.beforeParsed.trigger(content, this);
  1921. parsed = new ContentParser(content);
  1922. this.source = parsed;
  1923. this.breakToken = undefined;
  1924. if (this.pagesArea && this.pageTemplate) {
  1925. this.q.clear();
  1926. this.removePages();
  1927. } else {
  1928. this.setup(renderTo);
  1929. }
  1930. this.emit("rendering", content);
  1931. await this.hooks.afterParsed.trigger(parsed, this);
  1932. await this.loadFonts();
  1933. let rendered = await this.render(parsed, this.breakToken);
  1934. while (rendered.canceled) {
  1935. this.start();
  1936. rendered = await this.render(parsed, this.breakToken);
  1937. }
  1938. this.rendered = true;
  1939. this.pagesArea.style.setProperty("--pagedjs-page-count", this.total);
  1940. await this.hooks.afterRendered.trigger(this.pages, this);
  1941. this.emit("rendered", this.pages);
  1942. return this;
  1943. }
  1944. // oversetPages() {
  1945. // let overset = [];
  1946. // for (let i = 0; i < this.pages.length; i++) {
  1947. // let page = this.pages[i];
  1948. // if (page.overset) {
  1949. // overset.push(page);
  1950. // // page.overset = false;
  1951. // }
  1952. // }
  1953. // return overset;
  1954. // }
  1955. //
  1956. // async handleOverset(parsed) {
  1957. // let overset = this.oversetPages();
  1958. // if (overset.length) {
  1959. // console.log("overset", overset);
  1960. // let index = this.pages.indexOf(overset[0]) + 1;
  1961. // console.log("INDEX", index);
  1962. //
  1963. // // Remove pages
  1964. // // this.removePages(index);
  1965. //
  1966. // // await this.render(parsed, overset[0].overset);
  1967. //
  1968. // // return this.handleOverset(parsed);
  1969. // }
  1970. // }
  1971. async render(parsed, startAt) {
  1972. let renderer = this.layout(parsed, startAt, this.settings);
  1973. let done = false;
  1974. let result;
  1975. while (!done) {
  1976. result = await this.q.enqueue(() => { return this.renderAsync(renderer); });
  1977. done = result.done;
  1978. }
  1979. return result;
  1980. }
  1981. start() {
  1982. this.rendered = false;
  1983. this.stopped = false;
  1984. }
  1985. stop() {
  1986. this.stopped = true;
  1987. // this.q.clear();
  1988. }
  1989. renderOnIdle(renderer) {
  1990. return new Promise(resolve => {
  1991. requestIdleCallback(async () => {
  1992. if (this.stopped) {
  1993. return resolve({ done: true, canceled: true });
  1994. }
  1995. let result = await renderer.next();
  1996. if (this.stopped) {
  1997. resolve({ done: true, canceled: true });
  1998. } else {
  1999. resolve(result);
  2000. }
  2001. });
  2002. });
  2003. }
  2004. async renderAsync(renderer) {
  2005. if (this.stopped) {
  2006. return { done: true, canceled: true };
  2007. }
  2008. let result = await renderer.next();
  2009. if (this.stopped) {
  2010. return { done: true, canceled: true };
  2011. } else {
  2012. return result;
  2013. }
  2014. }
  2015. async handleBreaks(node) {
  2016. let currentPage = this.total + 1;
  2017. let currentPosition = currentPage % 2 === 0 ? "left" : "right";
  2018. // TODO: Recto and Verso should reverse for rtl languages
  2019. let currentSide = currentPage % 2 === 0 ? "verso" : "recto";
  2020. let previousBreakAfter;
  2021. let breakBefore;
  2022. let page;
  2023. if (currentPage === 1) {
  2024. return;
  2025. }
  2026. if (node &&
  2027. typeof node.dataset !== "undefined" &&
  2028. typeof node.dataset.previousBreakAfter !== "undefined") {
  2029. previousBreakAfter = node.dataset.previousBreakAfter;
  2030. }
  2031. if (node &&
  2032. typeof node.dataset !== "undefined" &&
  2033. typeof node.dataset.breakBefore !== "undefined") {
  2034. breakBefore = node.dataset.breakBefore;
  2035. }
  2036. if( previousBreakAfter &&
  2037. (previousBreakAfter === "left" || previousBreakAfter === "right") &&
  2038. previousBreakAfter !== currentPosition) {
  2039. page = this.addPage(true);
  2040. } else if( previousBreakAfter &&
  2041. (previousBreakAfter === "verso" || previousBreakAfter === "recto") &&
  2042. previousBreakAfter !== currentSide) {
  2043. page = this.addPage(true);
  2044. } else if( breakBefore &&
  2045. (breakBefore === "left" || breakBefore === "right") &&
  2046. breakBefore !== currentPosition) {
  2047. page = this.addPage(true);
  2048. } else if( breakBefore &&
  2049. (breakBefore === "verso" || breakBefore === "recto") &&
  2050. breakBefore !== currentSide) {
  2051. page = this.addPage(true);
  2052. }
  2053. if (page) {
  2054. await this.hooks.beforePageLayout.trigger(page, undefined, undefined, this);
  2055. this.emit("page", page);
  2056. // await this.hooks.layout.trigger(page.element, page, undefined, this);
  2057. await this.hooks.afterPageLayout.trigger(page.element, page, undefined, this);
  2058. this.emit("renderedPage", page);
  2059. }
  2060. }
  2061. async *layout(content, startAt) {
  2062. let breakToken = startAt || false;
  2063. while (breakToken !== undefined && ( true)) {
  2064. if (breakToken && breakToken.node) {
  2065. await this.handleBreaks(breakToken.node);
  2066. } else {
  2067. await this.handleBreaks(content.firstChild);
  2068. }
  2069. let page = this.addPage();
  2070. await this.hooks.beforePageLayout.trigger(page, content, breakToken, this);
  2071. this.emit("page", page);
  2072. // Layout content in the page, starting from the breakToken
  2073. breakToken = await page.layout(content, breakToken, this.maxChars);
  2074. await this.hooks.afterPageLayout.trigger(page.element, page, breakToken, this);
  2075. this.emit("renderedPage", page);
  2076. this.recoredCharLength(page.wrapper.textContent.length);
  2077. yield breakToken;
  2078. // Stop if we get undefined, showing we have reached the end of the content
  2079. }
  2080. }
  2081. recoredCharLength(length) {
  2082. if (length === 0) {
  2083. return;
  2084. }
  2085. this.charsPerBreak.push(length);
  2086. // Keep the length of the last few breaks
  2087. if (this.charsPerBreak.length > 4) {
  2088. this.charsPerBreak.shift();
  2089. }
  2090. this.maxChars = this.charsPerBreak.reduce((a, b) => a + b, 0) / (this.charsPerBreak.length);
  2091. }
  2092. removePages(fromIndex=0) {
  2093. if (fromIndex >= this.pages.length) {
  2094. return;
  2095. }
  2096. // Remove pages
  2097. for (let i = fromIndex; i < this.pages.length; i++) {
  2098. this.pages[i].destroy();
  2099. }
  2100. if (fromIndex > 0) {
  2101. this.pages.splice(fromIndex);
  2102. } else {
  2103. this.pages = [];
  2104. }
  2105. this.total = this.pages.length;
  2106. }
  2107. addPage(blank) {
  2108. let lastPage = this.pages[this.pages.length - 1];
  2109. // Create a new page from the template
  2110. let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks);
  2111. this.pages.push(page);
  2112. // Create the pages
  2113. page.create(undefined, lastPage && lastPage.element);
  2114. page.index(this.total);
  2115. if (!blank) {
  2116. // Listen for page overflow
  2117. page.onOverflow((overflowToken) => {
  2118. console.warn("overflow on", page.id, overflowToken);
  2119. // Only reflow while rendering
  2120. if (this.rendered) {
  2121. return;
  2122. }
  2123. let index = this.pages.indexOf(page) + 1;
  2124. // Stop the rendering
  2125. this.stop();
  2126. // Set the breakToken to resume at
  2127. this.breakToken = overflowToken;
  2128. // Remove pages
  2129. this.removePages(index);
  2130. if (this.rendered === true) {
  2131. this.rendered = false;
  2132. this.q.enqueue(async () => {
  2133. this.start();
  2134. await this.render(this.source, this.breakToken);
  2135. this.rendered = true;
  2136. });
  2137. }
  2138. });
  2139. page.onUnderflow((overflowToken) => {
  2140. // console.log("underflow on", page.id, overflowToken);
  2141. // page.append(this.source, overflowToken);
  2142. });
  2143. }
  2144. this.total = this.pages.length;
  2145. return page;
  2146. }
  2147. /*
  2148. insertPage(index, blank) {
  2149. let lastPage = this.pages[index];
  2150. // Create a new page from the template
  2151. let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks);
  2152. let total = this.pages.splice(index, 0, page);
  2153. // Create the pages
  2154. page.create(undefined, lastPage && lastPage.element);
  2155. page.index(index + 1);
  2156. for (let i = index + 2; i < this.pages.length; i++) {
  2157. this.pages[i].index(i);
  2158. }
  2159. if (!blank) {
  2160. // Listen for page overflow
  2161. page.onOverflow((overflowToken) => {
  2162. if (total < this.pages.length) {
  2163. this.pages[total].layout(this.source, overflowToken);
  2164. } else {
  2165. let newPage = this.addPage();
  2166. newPage.layout(this.source, overflowToken);
  2167. }
  2168. });
  2169. page.onUnderflow(() => {
  2170. // console.log("underflow on", page.id);
  2171. });
  2172. }
  2173. this.total += 1;
  2174. return page;
  2175. }
  2176. */
  2177. loadFonts() {
  2178. let fontPromises = [];
  2179. (document.fonts || []).forEach((fontFace) => {
  2180. if (fontFace.status !== "loaded") {
  2181. let fontLoaded = fontFace.load().then((r) => {
  2182. return fontFace.family;
  2183. }, (r) => {
  2184. console.warn("Failed to preload font-family:", fontFace.family);
  2185. return fontFace.family;
  2186. });
  2187. fontPromises.push(fontLoaded);
  2188. }
  2189. });
  2190. return Promise.all(fontPromises).catch((err) => {
  2191. console.warn(err);
  2192. });
  2193. }
  2194. destroy() {
  2195. this.pagesArea.remove();
  2196. this.pageTemplate.remove();
  2197. }
  2198. }
  2199. eventEmitter(Chunker.prototype);
  2200. //
  2201. // list
  2202. // ┌──────┐
  2203. // ┌──────────────┼─head │
  2204. // │ │ tail─┼──────────────┐
  2205. // │ └──────┘ │
  2206. // ▼ ▼
  2207. // item item item item
  2208. // ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
  2209. // null ◀──┼─prev │◀───┼─prev │◀───┼─prev │◀───┼─prev │
  2210. // │ next─┼───▶│ next─┼───▶│ next─┼───▶│ next─┼──▶ null
  2211. // ├──────┤ ├──────┤ ├──────┤ ├──────┤
  2212. // │ data │ │ data │ │ data │ │ data │
  2213. // └──────┘ └──────┘ └──────┘ └──────┘
  2214. //
  2215. function createItem(data) {
  2216. return {
  2217. prev: null,
  2218. next: null,
  2219. data: data
  2220. };
  2221. }
  2222. function allocateCursor(node, prev, next) {
  2223. var cursor;
  2224. if (cursors !== null) {
  2225. cursor = cursors;
  2226. cursors = cursors.cursor;
  2227. cursor.prev = prev;
  2228. cursor.next = next;
  2229. cursor.cursor = node.cursor;
  2230. } else {
  2231. cursor = {
  2232. prev: prev,
  2233. next: next,
  2234. cursor: node.cursor
  2235. };
  2236. }
  2237. node.cursor = cursor;
  2238. return cursor;
  2239. }
  2240. function releaseCursor(node) {
  2241. var cursor = node.cursor;
  2242. node.cursor = cursor.cursor;
  2243. cursor.prev = null;
  2244. cursor.next = null;
  2245. cursor.cursor = cursors;
  2246. cursors = cursor;
  2247. }
  2248. var cursors = null;
  2249. var List = function() {
  2250. this.cursor = null;
  2251. this.head = null;
  2252. this.tail = null;
  2253. };
  2254. List.createItem = createItem;
  2255. List.prototype.createItem = createItem;
  2256. List.prototype.updateCursors = function(prevOld, prevNew, nextOld, nextNew) {
  2257. var cursor = this.cursor;
  2258. while (cursor !== null) {
  2259. if (cursor.prev === prevOld) {
  2260. cursor.prev = prevNew;
  2261. }
  2262. if (cursor.next === nextOld) {
  2263. cursor.next = nextNew;
  2264. }
  2265. cursor = cursor.cursor;
  2266. }
  2267. };
  2268. List.prototype.getSize = function() {
  2269. var size = 0;
  2270. var cursor = this.head;
  2271. while (cursor) {
  2272. size++;
  2273. cursor = cursor.next;
  2274. }
  2275. return size;
  2276. };
  2277. List.prototype.fromArray = function(array) {
  2278. var cursor = null;
  2279. this.head = null;
  2280. for (var i = 0; i < array.length; i++) {
  2281. var item = createItem(array[i]);
  2282. if (cursor !== null) {
  2283. cursor.next = item;
  2284. } else {
  2285. this.head = item;
  2286. }
  2287. item.prev = cursor;
  2288. cursor = item;
  2289. }
  2290. this.tail = cursor;
  2291. return this;
  2292. };
  2293. List.prototype.toArray = function() {
  2294. var cursor = this.head;
  2295. var result = [];
  2296. while (cursor) {
  2297. result.push(cursor.data);
  2298. cursor = cursor.next;
  2299. }
  2300. return result;
  2301. };
  2302. List.prototype.toJSON = List.prototype.toArray;
  2303. List.prototype.isEmpty = function() {
  2304. return this.head === null;
  2305. };
  2306. List.prototype.first = function() {
  2307. return this.head && this.head.data;
  2308. };
  2309. List.prototype.last = function() {
  2310. return this.tail && this.tail.data;
  2311. };
  2312. List.prototype.each = function(fn, context) {
  2313. var item;
  2314. if (context === undefined) {
  2315. context = this;
  2316. }
  2317. // push cursor
  2318. var cursor = allocateCursor(this, null, this.head);
  2319. while (cursor.next !== null) {
  2320. item = cursor.next;
  2321. cursor.next = item.next;
  2322. fn.call(context, item.data, item, this);
  2323. }
  2324. // pop cursor
  2325. releaseCursor(this);
  2326. };
  2327. List.prototype.forEach = List.prototype.each;
  2328. List.prototype.eachRight = function(fn, context) {
  2329. var item;
  2330. if (context === undefined) {
  2331. context = this;
  2332. }
  2333. // push cursor
  2334. var cursor = allocateCursor(this, this.tail, null);
  2335. while (cursor.prev !== null) {
  2336. item = cursor.prev;
  2337. cursor.prev = item.prev;
  2338. fn.call(context, item.data, item, this);
  2339. }
  2340. // pop cursor
  2341. releaseCursor(this);
  2342. };
  2343. List.prototype.forEachRight = List.prototype.eachRight;
  2344. List.prototype.nextUntil = function(start, fn, context) {
  2345. if (start === null) {
  2346. return;
  2347. }
  2348. var item;
  2349. if (context === undefined) {
  2350. context = this;
  2351. }
  2352. // push cursor
  2353. var cursor = allocateCursor(this, null, start);
  2354. while (cursor.next !== null) {
  2355. item = cursor.next;
  2356. cursor.next = item.next;
  2357. if (fn.call(context, item.data, item, this)) {
  2358. break;
  2359. }
  2360. }
  2361. // pop cursor
  2362. releaseCursor(this);
  2363. };
  2364. List.prototype.prevUntil = function(start, fn, context) {
  2365. if (start === null) {
  2366. return;
  2367. }
  2368. var item;
  2369. if (context === undefined) {
  2370. context = this;
  2371. }
  2372. // push cursor
  2373. var cursor = allocateCursor(this, start, null);
  2374. while (cursor.prev !== null) {
  2375. item = cursor.prev;
  2376. cursor.prev = item.prev;
  2377. if (fn.call(context, item.data, item, this)) {
  2378. break;
  2379. }
  2380. }
  2381. // pop cursor
  2382. releaseCursor(this);
  2383. };
  2384. List.prototype.some = function(fn, context) {
  2385. var cursor = this.head;
  2386. if (context === undefined) {
  2387. context = this;
  2388. }
  2389. while (cursor !== null) {
  2390. if (fn.call(context, cursor.data, cursor, this)) {
  2391. return true;
  2392. }
  2393. cursor = cursor.next;
  2394. }
  2395. return false;
  2396. };
  2397. List.prototype.map = function(fn, context) {
  2398. var result = new List();
  2399. var cursor = this.head;
  2400. if (context === undefined) {
  2401. context = this;
  2402. }
  2403. while (cursor !== null) {
  2404. result.appendData(fn.call(context, cursor.data, cursor, this));
  2405. cursor = cursor.next;
  2406. }
  2407. return result;
  2408. };
  2409. List.prototype.filter = function(fn, context) {
  2410. var result = new List();
  2411. var cursor = this.head;
  2412. if (context === undefined) {
  2413. context = this;
  2414. }
  2415. while (cursor !== null) {
  2416. if (fn.call(context, cursor.data, cursor, this)) {
  2417. result.appendData(cursor.data);
  2418. }
  2419. cursor = cursor.next;
  2420. }
  2421. return result;
  2422. };
  2423. List.prototype.clear = function() {
  2424. this.head = null;
  2425. this.tail = null;
  2426. };
  2427. List.prototype.copy = function() {
  2428. var result = new List();
  2429. var cursor = this.head;
  2430. while (cursor !== null) {
  2431. result.insert(createItem(cursor.data));
  2432. cursor = cursor.next;
  2433. }
  2434. return result;
  2435. };
  2436. List.prototype.prepend = function(item) {
  2437. // head
  2438. // ^
  2439. // item
  2440. this.updateCursors(null, item, this.head, item);
  2441. // insert to the beginning of the list
  2442. if (this.head !== null) {
  2443. // new item <- first item
  2444. this.head.prev = item;
  2445. // new item -> first item
  2446. item.next = this.head;
  2447. } else {
  2448. // if list has no head, then it also has no tail
  2449. // in this case tail points to the new item
  2450. this.tail = item;
  2451. }
  2452. // head always points to new item
  2453. this.head = item;
  2454. return this;
  2455. };
  2456. List.prototype.prependData = function(data) {
  2457. return this.prepend(createItem(data));
  2458. };
  2459. List.prototype.append = function(item) {
  2460. return this.insert(item);
  2461. };
  2462. List.prototype.appendData = function(data) {
  2463. return this.insert(createItem(data));
  2464. };
  2465. List.prototype.insert = function(item, before) {
  2466. if (before !== undefined && before !== null) {
  2467. // prev before
  2468. // ^
  2469. // item
  2470. this.updateCursors(before.prev, item, before, item);
  2471. if (before.prev === null) {
  2472. // insert to the beginning of list
  2473. if (this.head !== before) {
  2474. throw new Error('before doesn\'t belong to list');
  2475. }
  2476. // since head points to before therefore list doesn't empty
  2477. // no need to check tail
  2478. this.head = item;
  2479. before.prev = item;
  2480. item.next = before;
  2481. this.updateCursors(null, item);
  2482. } else {
  2483. // insert between two items
  2484. before.prev.next = item;
  2485. item.prev = before.prev;
  2486. before.prev = item;
  2487. item.next = before;
  2488. }
  2489. } else {
  2490. // tail
  2491. // ^
  2492. // item
  2493. this.updateCursors(this.tail, item, null, item);
  2494. // insert to the ending of the list
  2495. if (this.tail !== null) {
  2496. // last item -> new item
  2497. this.tail.next = item;
  2498. // last item <- new item
  2499. item.prev = this.tail;
  2500. } else {
  2501. // if list has no tail, then it also has no head
  2502. // in this case head points to new item
  2503. this.head = item;
  2504. }
  2505. // tail always points to new item
  2506. this.tail = item;
  2507. }
  2508. return this;
  2509. };
  2510. List.prototype.insertData = function(data, before) {
  2511. return this.insert(createItem(data), before);
  2512. };
  2513. List.prototype.remove = function(item) {
  2514. // item
  2515. // ^
  2516. // prev next
  2517. this.updateCursors(item, item.prev, item, item.next);
  2518. if (item.prev !== null) {
  2519. item.prev.next = item.next;
  2520. } else {
  2521. if (this.head !== item) {
  2522. throw new Error('item doesn\'t belong to list');
  2523. }
  2524. this.head = item.next;
  2525. }
  2526. if (item.next !== null) {
  2527. item.next.prev = item.prev;
  2528. } else {
  2529. if (this.tail !== item) {
  2530. throw new Error('item doesn\'t belong to list');
  2531. }
  2532. this.tail = item.prev;
  2533. }
  2534. item.prev = null;
  2535. item.next = null;
  2536. return item;
  2537. };
  2538. List.prototype.push = function(data) {
  2539. this.insert(createItem(data));
  2540. };
  2541. List.prototype.pop = function() {
  2542. if (this.tail !== null) {
  2543. return this.remove(this.tail);
  2544. }
  2545. };
  2546. List.prototype.unshift = function(data) {
  2547. this.prepend(createItem(data));
  2548. };
  2549. List.prototype.shift = function() {
  2550. if (this.head !== null) {
  2551. return this.remove(this.head);
  2552. }
  2553. };
  2554. List.prototype.prependList = function(list) {
  2555. return this.insertList(list, this.head);
  2556. };
  2557. List.prototype.appendList = function(list) {
  2558. return this.insertList(list);
  2559. };
  2560. List.prototype.insertList = function(list, before) {
  2561. // ignore empty lists
  2562. if (list.head === null) {
  2563. return this;
  2564. }
  2565. if (before !== undefined && before !== null) {
  2566. this.updateCursors(before.prev, list.tail, before, list.head);
  2567. // insert in the middle of dist list
  2568. if (before.prev !== null) {
  2569. // before.prev <-> list.head
  2570. before.prev.next = list.head;
  2571. list.head.prev = before.prev;
  2572. } else {
  2573. this.head = list.head;
  2574. }
  2575. before.prev = list.tail;
  2576. list.tail.next = before;
  2577. } else {
  2578. this.updateCursors(this.tail, list.tail, null, list.head);
  2579. // insert to end of the list
  2580. if (this.tail !== null) {
  2581. // if destination list has a tail, then it also has a head,
  2582. // but head doesn't change
  2583. // dest tail -> source head
  2584. this.tail.next = list.head;
  2585. // dest tail <- source head
  2586. list.head.prev = this.tail;
  2587. } else {
  2588. // if list has no a tail, then it also has no a head
  2589. // in this case points head to new item
  2590. this.head = list.head;
  2591. }
  2592. // tail always start point to new item
  2593. this.tail = list.tail;
  2594. }
  2595. list.head = null;
  2596. list.tail = null;
  2597. return this;
  2598. };
  2599. List.prototype.replace = function(oldItem, newItemOrList) {
  2600. if ('head' in newItemOrList) {
  2601. this.insertList(newItemOrList, oldItem);
  2602. } else {
  2603. this.insert(newItemOrList, oldItem);
  2604. }
  2605. this.remove(oldItem);
  2606. };
  2607. var List_1 = List;
  2608. var createCustomError = function createCustomError(name, message) {
  2609. // use Object.create(), because some VMs prevent setting line/column otherwise
  2610. // (iOS Safari 10 even throws an exception)
  2611. var error = Object.create(SyntaxError.prototype);
  2612. var errorStack = new Error();
  2613. error.name = name;
  2614. error.message = message;
  2615. Object.defineProperty(error, 'stack', {
  2616. get: function() {
  2617. return (errorStack.stack || '').replace(/^(.+\n){1,3}/, name + ': ' + message + '\n');
  2618. }
  2619. });
  2620. return error;
  2621. };
  2622. var MAX_LINE_LENGTH = 100;
  2623. var OFFSET_CORRECTION = 60;
  2624. var TAB_REPLACEMENT = ' ';
  2625. function sourceFragment(error, extraLines) {
  2626. function processLines(start, end) {
  2627. return lines.slice(start, end).map(function(line, idx) {
  2628. var num = String(start + idx + 1);
  2629. while (num.length < maxNumLength) {
  2630. num = ' ' + num;
  2631. }
  2632. return num + ' |' + line;
  2633. }).join('\n');
  2634. }
  2635. var lines = error.source.split(/\r\n?|\n|\f/);
  2636. var line = error.line;
  2637. var column = error.column;
  2638. var startLine = Math.max(1, line - extraLines) - 1;
  2639. var endLine = Math.min(line + extraLines, lines.length + 1);
  2640. var maxNumLength = Math.max(4, String(endLine).length) + 1;
  2641. var cutLeft = 0;
  2642. // column correction according to replaced tab before column
  2643. column += (TAB_REPLACEMENT.length - 1) * (lines[line - 1].substr(0, column - 1).match(/\t/g) || []).length;
  2644. if (column > MAX_LINE_LENGTH) {
  2645. cutLeft = column - OFFSET_CORRECTION + 3;
  2646. column = OFFSET_CORRECTION - 2;
  2647. }
  2648. for (var i = startLine; i <= endLine; i++) {
  2649. if (i >= 0 && i < lines.length) {
  2650. lines[i] = lines[i].replace(/\t/g, TAB_REPLACEMENT);
  2651. lines[i] =
  2652. (cutLeft > 0 && lines[i].length > cutLeft ? '\u2026' : '') +
  2653. lines[i].substr(cutLeft, MAX_LINE_LENGTH - 2) +
  2654. (lines[i].length > cutLeft + MAX_LINE_LENGTH - 1 ? '\u2026' : '');
  2655. }
  2656. }
  2657. return [
  2658. processLines(startLine, line),
  2659. new Array(column + maxNumLength + 2).join('-') + '^',
  2660. processLines(line, endLine)
  2661. ].filter(Boolean).join('\n');
  2662. }
  2663. var SyntaxError$1 = function(message, source, offset, line, column) {
  2664. var error = createCustomError('SyntaxError', message);
  2665. error.source = source;
  2666. error.offset = offset;
  2667. error.line = line;
  2668. error.column = column;
  2669. error.sourceFragment = function(extraLines) {
  2670. return sourceFragment(error, isNaN(extraLines) ? 0 : extraLines);
  2671. };
  2672. Object.defineProperty(error, 'formattedMessage', {
  2673. get: function() {
  2674. return (
  2675. 'Parse error: ' + error.message + '\n' +
  2676. sourceFragment(error, 2)
  2677. );
  2678. }
  2679. });
  2680. // for backward capability
  2681. error.parseError = {
  2682. offset: offset,
  2683. line: line,
  2684. column: column
  2685. };
  2686. return error;
  2687. };
  2688. var _SyntaxError = SyntaxError$1;
  2689. // CSS Syntax Module Level 3
  2690. // https://www.w3.org/TR/css-syntax-3/
  2691. var TYPE = {
  2692. EOF: 0, // <EOF-token>
  2693. Ident: 1, // <ident-token>
  2694. Function: 2, // <function-token>
  2695. AtKeyword: 3, // <at-keyword-token>
  2696. Hash: 4, // <hash-token>
  2697. String: 5, // <string-token>
  2698. BadString: 6, // <bad-string-token>
  2699. Url: 7, // <url-token>
  2700. BadUrl: 8, // <bad-url-token>
  2701. Delim: 9, // <delim-token>
  2702. Number: 10, // <number-token>
  2703. Percentage: 11, // <percentage-token>
  2704. Dimension: 12, // <dimension-token>
  2705. WhiteSpace: 13, // <whitespace-token>
  2706. CDO: 14, // <CDO-token>
  2707. CDC: 15, // <CDC-token>
  2708. Colon: 16, // <colon-token> :
  2709. Semicolon: 17, // <semicolon-token> ;
  2710. Comma: 18, // <comma-token> ,
  2711. LeftSquareBracket: 19, // <[-token>
  2712. RightSquareBracket: 20, // <]-token>
  2713. LeftParenthesis: 21, // <(-token>
  2714. RightParenthesis: 22, // <)-token>
  2715. LeftCurlyBracket: 23, // <{-token>
  2716. RightCurlyBracket: 24, // <}-token>
  2717. Comment: 25
  2718. };
  2719. var NAME = Object.keys(TYPE).reduce(function(result, key) {
  2720. result[TYPE[key]] = key;
  2721. return result;
  2722. }, {});
  2723. var _const = {
  2724. TYPE: TYPE,
  2725. NAME: NAME
  2726. };
  2727. var EOF = 0;
  2728. // https://drafts.csswg.org/css-syntax-3/
  2729. // § 4.2. Definitions
  2730. // digit
  2731. // A code point between U+0030 DIGIT ZERO (0) and U+0039 DIGIT NINE (9).
  2732. function isDigit(code) {
  2733. return code >= 0x0030 && code <= 0x0039;
  2734. }
  2735. // hex digit
  2736. // A digit, or a code point between U+0041 LATIN CAPITAL LETTER A (A) and U+0046 LATIN CAPITAL LETTER F (F),
  2737. // or a code point between U+0061 LATIN SMALL LETTER A (a) and U+0066 LATIN SMALL LETTER F (f).
  2738. function isHexDigit(code) {
  2739. return (
  2740. isDigit(code) || // 0 .. 9
  2741. (code >= 0x0041 && code <= 0x0046) || // A .. F
  2742. (code >= 0x0061 && code <= 0x0066) // a .. f
  2743. );
  2744. }
  2745. // uppercase letter
  2746. // A code point between U+0041 LATIN CAPITAL LETTER A (A) and U+005A LATIN CAPITAL LETTER Z (Z).
  2747. function isUppercaseLetter(code) {
  2748. return code >= 0x0041 && code <= 0x005A;
  2749. }
  2750. // lowercase letter
  2751. // A code point between U+0061 LATIN SMALL LETTER A (a) and U+007A LATIN SMALL LETTER Z (z).
  2752. function isLowercaseLetter(code) {
  2753. return code >= 0x0061 && code <= 0x007A;
  2754. }
  2755. // letter
  2756. // An uppercase letter or a lowercase letter.
  2757. function isLetter(code) {
  2758. return isUppercaseLetter(code) || isLowercaseLetter(code);
  2759. }
  2760. // non-ASCII code point
  2761. // A code point with a value equal to or greater than U+0080 <control>.
  2762. function isNonAscii(code) {
  2763. return code >= 0x0080;
  2764. }
  2765. // name-start code point
  2766. // A letter, a non-ASCII code point, or U+005F LOW LINE (_).
  2767. function isNameStart(code) {
  2768. return isLetter(code) || isNonAscii(code) || code === 0x005F;
  2769. }
  2770. // name code point
  2771. // A name-start code point, a digit, or U+002D HYPHEN-MINUS (-).
  2772. function isName(code) {
  2773. return isNameStart(code) || isDigit(code) || code === 0x002D;
  2774. }
  2775. // non-printable code point
  2776. // A code point between U+0000 NULL and U+0008 BACKSPACE, or U+000B LINE TABULATION,
  2777. // or a code point between U+000E SHIFT OUT and U+001F INFORMATION SEPARATOR ONE, or U+007F DELETE.
  2778. function isNonPrintable(code) {
  2779. return (
  2780. (code >= 0x0000 && code <= 0x0008) ||
  2781. (code === 0x000B) ||
  2782. (code >= 0x000E && code <= 0x001F) ||
  2783. (code === 0x007F)
  2784. );
  2785. }
  2786. // newline
  2787. // U+000A LINE FEED. Note that U+000D CARRIAGE RETURN and U+000C FORM FEED are not included in this definition,
  2788. // as they are converted to U+000A LINE FEED during preprocessing.
  2789. // TODO: we doesn't do a preprocessing, so check a code point for U+000D CARRIAGE RETURN and U+000C FORM FEED
  2790. function isNewline(code) {
  2791. return code === 0x000A || code === 0x000D || code === 0x000C;
  2792. }
  2793. // whitespace
  2794. // A newline, U+0009 CHARACTER TABULATION, or U+0020 SPACE.
  2795. function isWhiteSpace(code) {
  2796. return isNewline(code) || code === 0x0020 || code === 0x0009;
  2797. }
  2798. // § 4.3.8. Check if two code points are a valid escape
  2799. function isValidEscape(first, second) {
  2800. // If the first code point is not U+005C REVERSE SOLIDUS (\), return false.
  2801. if (first !== 0x005C) {
  2802. return false;
  2803. }
  2804. // Otherwise, if the second code point is a newline or EOF, return false.
  2805. if (isNewline(second) || second === EOF) {
  2806. return false;
  2807. }
  2808. // Otherwise, return true.
  2809. return true;
  2810. }
  2811. // § 4.3.9. Check if three code points would start an identifier
  2812. function isIdentifierStart(first, second, third) {
  2813. // Look at the first code point:
  2814. // U+002D HYPHEN-MINUS
  2815. if (first === 0x002D) {
  2816. // If the second code point is a name-start code point or a U+002D HYPHEN-MINUS,
  2817. // or the second and third code points are a valid escape, return true. Otherwise, return false.
  2818. return (
  2819. isNameStart(second) ||
  2820. second === 0x002D ||
  2821. isValidEscape(second, third)
  2822. );
  2823. }
  2824. // name-start code point
  2825. if (isNameStart(first)) {
  2826. // Return true.
  2827. return true;
  2828. }
  2829. // U+005C REVERSE SOLIDUS (\)
  2830. if (first === 0x005C) {
  2831. // If the first and second code points are a valid escape, return true. Otherwise, return false.
  2832. return isValidEscape(first, second);
  2833. }
  2834. // anything else
  2835. // Return false.
  2836. return false;
  2837. }
  2838. // § 4.3.10. Check if three code points would start a number
  2839. function isNumberStart(first, second, third) {
  2840. // Look at the first code point:
  2841. // U+002B PLUS SIGN (+)
  2842. // U+002D HYPHEN-MINUS (-)
  2843. if (first === 0x002B || first === 0x002D) {
  2844. // If the second code point is a digit, return true.
  2845. if (isDigit(second)) {
  2846. return 2;
  2847. }
  2848. // Otherwise, if the second code point is a U+002E FULL STOP (.)
  2849. // and the third code point is a digit, return true.
  2850. // Otherwise, return false.
  2851. return second === 0x002E && isDigit(third) ? 3 : 0;
  2852. }
  2853. // U+002E FULL STOP (.)
  2854. if (first === 0x002E) {
  2855. // If the second code point is a digit, return true. Otherwise, return false.
  2856. return isDigit(second) ? 2 : 0;
  2857. }
  2858. // digit
  2859. if (isDigit(first)) {
  2860. // Return true.
  2861. return 1;
  2862. }
  2863. // anything else
  2864. // Return false.
  2865. return 0;
  2866. }
  2867. //
  2868. // Misc
  2869. //
  2870. // detect BOM (https://en.wikipedia.org/wiki/Byte_order_mark)
  2871. function isBOM(code) {
  2872. // UTF-16BE
  2873. if (code === 0xFEFF) {
  2874. return 1;
  2875. }
  2876. // UTF-16LE
  2877. if (code === 0xFFFE) {
  2878. return 1;
  2879. }
  2880. return 0;
  2881. }
  2882. // Fast code category
  2883. //
  2884. // https://drafts.csswg.org/css-syntax/#tokenizer-definitions
  2885. // > non-ASCII code point
  2886. // > A code point with a value equal to or greater than U+0080 <control>
  2887. // > name-start code point
  2888. // > A letter, a non-ASCII code point, or U+005F LOW LINE (_).
  2889. // > name code point
  2890. // > A name-start code point, a digit, or U+002D HYPHEN-MINUS (-)
  2891. // That means only ASCII code points has a special meaning and we define a maps for 0..127 codes only
  2892. var CATEGORY = new Array(0x80);
  2893. charCodeCategory.Eof = 0x80;
  2894. charCodeCategory.WhiteSpace = 0x82;
  2895. charCodeCategory.Digit = 0x83;
  2896. charCodeCategory.NameStart = 0x84;
  2897. charCodeCategory.NonPrintable = 0x85;
  2898. for (var i = 0; i < CATEGORY.length; i++) {
  2899. switch (true) {
  2900. case isWhiteSpace(i):
  2901. CATEGORY[i] = charCodeCategory.WhiteSpace;
  2902. break;
  2903. case isDigit(i):
  2904. CATEGORY[i] = charCodeCategory.Digit;
  2905. break;
  2906. case isNameStart(i):
  2907. CATEGORY[i] = charCodeCategory.NameStart;
  2908. break;
  2909. case isNonPrintable(i):
  2910. CATEGORY[i] = charCodeCategory.NonPrintable;
  2911. break;
  2912. default:
  2913. CATEGORY[i] = i || charCodeCategory.Eof;
  2914. }
  2915. }
  2916. function charCodeCategory(code) {
  2917. return code < 0x80 ? CATEGORY[code] : charCodeCategory.NameStart;
  2918. }
  2919. var charCodeDefinitions = {
  2920. isDigit: isDigit,
  2921. isHexDigit: isHexDigit,
  2922. isUppercaseLetter: isUppercaseLetter,
  2923. isLowercaseLetter: isLowercaseLetter,
  2924. isLetter: isLetter,
  2925. isNonAscii: isNonAscii,
  2926. isNameStart: isNameStart,
  2927. isName: isName,
  2928. isNonPrintable: isNonPrintable,
  2929. isNewline: isNewline,
  2930. isWhiteSpace: isWhiteSpace,
  2931. isValidEscape: isValidEscape,
  2932. isIdentifierStart: isIdentifierStart,
  2933. isNumberStart: isNumberStart,
  2934. isBOM: isBOM,
  2935. charCodeCategory: charCodeCategory
  2936. };
  2937. var isDigit$1 = charCodeDefinitions.isDigit;
  2938. var isHexDigit$1 = charCodeDefinitions.isHexDigit;
  2939. var isUppercaseLetter$1 = charCodeDefinitions.isUppercaseLetter;
  2940. var isName$1 = charCodeDefinitions.isName;
  2941. var isWhiteSpace$1 = charCodeDefinitions.isWhiteSpace;
  2942. var isValidEscape$1 = charCodeDefinitions.isValidEscape;
  2943. function getCharCode(source, offset) {
  2944. return offset < source.length ? source.charCodeAt(offset) : 0;
  2945. }
  2946. function getNewlineLength(source, offset, code) {
  2947. if (code === 13 /* \r */ && getCharCode(source, offset + 1) === 10 /* \n */) {
  2948. return 2;
  2949. }
  2950. return 1;
  2951. }
  2952. function cmpChar(testStr, offset, referenceCode) {
  2953. var code = testStr.charCodeAt(offset);
  2954. // code.toLowerCase() for A..Z
  2955. if (isUppercaseLetter$1(code)) {
  2956. code = code | 32;
  2957. }
  2958. return code === referenceCode;
  2959. }
  2960. function cmpStr(testStr, start, end, referenceStr) {
  2961. if (end - start !== referenceStr.length) {
  2962. return false;
  2963. }
  2964. if (start < 0 || end > testStr.length) {
  2965. return false;
  2966. }
  2967. for (var i = start; i < end; i++) {
  2968. var testCode = testStr.charCodeAt(i);
  2969. var referenceCode = referenceStr.charCodeAt(i - start);
  2970. // testCode.toLowerCase() for A..Z
  2971. if (isUppercaseLetter$1(testCode)) {
  2972. testCode = testCode | 32;
  2973. }
  2974. if (testCode !== referenceCode) {
  2975. return false;
  2976. }
  2977. }
  2978. return true;
  2979. }
  2980. function findWhiteSpaceStart(source, offset) {
  2981. for (; offset >= 0; offset--) {
  2982. if (!isWhiteSpace$1(source.charCodeAt(offset))) {
  2983. break;
  2984. }
  2985. }
  2986. return offset + 1;
  2987. }
  2988. function findWhiteSpaceEnd(source, offset) {
  2989. for (; offset < source.length; offset++) {
  2990. if (!isWhiteSpace$1(source.charCodeAt(offset))) {
  2991. break;
  2992. }
  2993. }
  2994. return offset;
  2995. }
  2996. function findDecimalNumberEnd(source, offset) {
  2997. for (; offset < source.length; offset++) {
  2998. if (!isDigit$1(source.charCodeAt(offset))) {
  2999. break;
  3000. }
  3001. }
  3002. return offset;
  3003. }
  3004. // § 4.3.7. Consume an escaped code point
  3005. function consumeEscaped(source, offset) {
  3006. // It assumes that the U+005C REVERSE SOLIDUS (\) has already been consumed and
  3007. // that the next input code point has already been verified to be part of a valid escape.
  3008. offset += 2;
  3009. // hex digit
  3010. if (isHexDigit$1(getCharCode(source, offset - 1))) {
  3011. // Consume as many hex digits as possible, but no more than 5.
  3012. // Note that this means 1-6 hex digits have been consumed in total.
  3013. for (var maxOffset = Math.min(source.length, offset + 5); offset < maxOffset; offset++) {
  3014. if (!isHexDigit$1(getCharCode(source, offset))) {
  3015. break;
  3016. }
  3017. }
  3018. // If the next input code point is whitespace, consume it as well.
  3019. var code = getCharCode(source, offset);
  3020. if (isWhiteSpace$1(code)) {
  3021. offset += getNewlineLength(source, offset, code);
  3022. }
  3023. }
  3024. return offset;
  3025. }
  3026. // §4.3.11. Consume a name
  3027. // Note: This algorithm does not do the verification of the first few code points that are necessary
  3028. // to ensure the returned code points would constitute an <ident-token>. If that is the intended use,
  3029. // ensure that the stream starts with an identifier before calling this algorithm.
  3030. function consumeName(source, offset) {
  3031. // Let result initially be an empty string.
  3032. // Repeatedly consume the next input code point from the stream:
  3033. for (; offset < source.length; offset++) {
  3034. var code = source.charCodeAt(offset);
  3035. // name code point
  3036. if (isName$1(code)) {
  3037. // Append the code point to result.
  3038. continue;
  3039. }
  3040. // the stream starts with a valid escape
  3041. if (isValidEscape$1(code, getCharCode(source, offset + 1))) {
  3042. // Consume an escaped code point. Append the returned code point to result.
  3043. offset = consumeEscaped(source, offset) - 1;
  3044. continue;
  3045. }
  3046. // anything else
  3047. // Reconsume the current input code point. Return result.
  3048. break;
  3049. }
  3050. return offset;
  3051. }
  3052. // §4.3.12. Consume a number
  3053. function consumeNumber(source, offset) {
  3054. var code = source.charCodeAt(offset);
  3055. // 2. If the next input code point is U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-),
  3056. // consume it and append it to repr.
  3057. if (code === 0x002B || code === 0x002D) {
  3058. code = source.charCodeAt(offset += 1);
  3059. }
  3060. // 3. While the next input code point is a digit, consume it and append it to repr.
  3061. if (isDigit$1(code)) {
  3062. offset = findDecimalNumberEnd(source, offset + 1);
  3063. code = source.charCodeAt(offset);
  3064. }
  3065. // 4. If the next 2 input code points are U+002E FULL STOP (.) followed by a digit, then:
  3066. if (code === 0x002E && isDigit$1(source.charCodeAt(offset + 1))) {
  3067. // 4.1 Consume them.
  3068. // 4.2 Append them to repr.
  3069. code = source.charCodeAt(offset += 2);
  3070. // 4.3 Set type to "number".
  3071. // TODO
  3072. // 4.4 While the next input code point is a digit, consume it and append it to repr.
  3073. offset = findDecimalNumberEnd(source, offset);
  3074. }
  3075. // 5. If the next 2 or 3 input code points are U+0045 LATIN CAPITAL LETTER E (E)
  3076. // or U+0065 LATIN SMALL LETTER E (e), ... , followed by a digit, then:
  3077. if (cmpChar(source, offset, 101 /* e */)) {
  3078. var sign = 0;
  3079. code = source.charCodeAt(offset + 1);
  3080. // ... optionally followed by U+002D HYPHEN-MINUS (-) or U+002B PLUS SIGN (+) ...
  3081. if (code === 0x002D || code === 0x002B) {
  3082. sign = 1;
  3083. code = source.charCodeAt(offset + 2);
  3084. }
  3085. // ... followed by a digit
  3086. if (isDigit$1(code)) {
  3087. // 5.1 Consume them.
  3088. // 5.2 Append them to repr.
  3089. // 5.3 Set type to "number".
  3090. // TODO
  3091. // 5.4 While the next input code point is a digit, consume it and append it to repr.
  3092. offset = findDecimalNumberEnd(source, offset + 1 + sign + 1);
  3093. }
  3094. }
  3095. return offset;
  3096. }
  3097. // § 4.3.14. Consume the remnants of a bad url
  3098. // ... its sole use is to consume enough of the input stream to reach a recovery point
  3099. // where normal tokenizing can resume.
  3100. function consumeBadUrlRemnants(source, offset) {
  3101. // Repeatedly consume the next input code point from the stream:
  3102. for (; offset < source.length; offset++) {
  3103. var code = source.charCodeAt(offset);
  3104. // U+0029 RIGHT PARENTHESIS ())
  3105. // EOF
  3106. if (code === 0x0029) {
  3107. // Return.
  3108. offset++;
  3109. break;
  3110. }
  3111. if (isValidEscape$1(code, getCharCode(source, offset + 1))) {
  3112. // Consume an escaped code point.
  3113. // Note: This allows an escaped right parenthesis ("\)") to be encountered
  3114. // without ending the <bad-url-token>. This is otherwise identical to
  3115. // the "anything else" clause.
  3116. offset = consumeEscaped(source, offset);
  3117. }
  3118. }
  3119. return offset;
  3120. }
  3121. var utils = {
  3122. consumeEscaped: consumeEscaped,
  3123. consumeName: consumeName,
  3124. consumeNumber: consumeNumber,
  3125. consumeBadUrlRemnants: consumeBadUrlRemnants,
  3126. cmpChar: cmpChar,
  3127. cmpStr: cmpStr,
  3128. getNewlineLength: getNewlineLength,
  3129. findWhiteSpaceStart: findWhiteSpaceStart,
  3130. findWhiteSpaceEnd: findWhiteSpaceEnd
  3131. };
  3132. var TYPE$1 = _const.TYPE;
  3133. var NAME$1 = _const.NAME;
  3134. var cmpStr$1 = utils.cmpStr;
  3135. var EOF$1 = TYPE$1.EOF;
  3136. var WHITESPACE = TYPE$1.WhiteSpace;
  3137. var COMMENT = TYPE$1.Comment;
  3138. var OFFSET_MASK = 0x00FFFFFF;
  3139. var TYPE_SHIFT = 24;
  3140. var TokenStream = function() {
  3141. this.offsetAndType = null;
  3142. this.balance = null;
  3143. this.reset();
  3144. };
  3145. TokenStream.prototype = {
  3146. reset: function() {
  3147. this.eof = false;
  3148. this.tokenIndex = -1;
  3149. this.tokenType = 0;
  3150. this.tokenStart = this.firstCharOffset;
  3151. this.tokenEnd = this.firstCharOffset;
  3152. },
  3153. lookupType: function(offset) {
  3154. offset += this.tokenIndex;
  3155. if (offset < this.tokenCount) {
  3156. return this.offsetAndType[offset] >> TYPE_SHIFT;
  3157. }
  3158. return EOF$1;
  3159. },
  3160. lookupOffset: function(offset) {
  3161. offset += this.tokenIndex;
  3162. if (offset < this.tokenCount) {
  3163. return this.offsetAndType[offset - 1] & OFFSET_MASK;
  3164. }
  3165. return this.source.length;
  3166. },
  3167. lookupValue: function(offset, referenceStr) {
  3168. offset += this.tokenIndex;
  3169. if (offset < this.tokenCount) {
  3170. return cmpStr$1(
  3171. this.source,
  3172. this.offsetAndType[offset - 1] & OFFSET_MASK,
  3173. this.offsetAndType[offset] & OFFSET_MASK,
  3174. referenceStr
  3175. );
  3176. }
  3177. return false;
  3178. },
  3179. getTokenStart: function(tokenIndex) {
  3180. if (tokenIndex === this.tokenIndex) {
  3181. return this.tokenStart;
  3182. }
  3183. if (tokenIndex > 0) {
  3184. return tokenIndex < this.tokenCount
  3185. ? this.offsetAndType[tokenIndex - 1] & OFFSET_MASK
  3186. : this.offsetAndType[this.tokenCount] & OFFSET_MASK;
  3187. }
  3188. return this.firstCharOffset;
  3189. },
  3190. // TODO: -> skipUntilBalanced
  3191. getRawLength: function(startToken, mode) {
  3192. var cursor = startToken;
  3193. var balanceEnd;
  3194. var offset = this.offsetAndType[Math.max(cursor - 1, 0)] & OFFSET_MASK;
  3195. var type;
  3196. loop:
  3197. for (; cursor < this.tokenCount; cursor++) {
  3198. balanceEnd = this.balance[cursor];
  3199. // stop scanning on balance edge that points to offset before start token
  3200. if (balanceEnd < startToken) {
  3201. break loop;
  3202. }
  3203. type = this.offsetAndType[cursor] >> TYPE_SHIFT;
  3204. // check token is stop type
  3205. switch (mode(type, this.source, offset)) {
  3206. case 1:
  3207. break loop;
  3208. case 2:
  3209. cursor++;
  3210. break loop;
  3211. default:
  3212. offset = this.offsetAndType[cursor] & OFFSET_MASK;
  3213. // fast forward to the end of balanced block
  3214. if (this.balance[balanceEnd] === cursor) {
  3215. cursor = balanceEnd;
  3216. }
  3217. }
  3218. }
  3219. return cursor - this.tokenIndex;
  3220. },
  3221. isBalanceEdge: function(pos) {
  3222. return this.balance[this.tokenIndex] < pos;
  3223. },
  3224. isDelim: function(code, offset) {
  3225. if (offset) {
  3226. return (
  3227. this.lookupType(offset) === TYPE$1.Delim &&
  3228. this.source.charCodeAt(this.lookupOffset(offset)) === code
  3229. );
  3230. }
  3231. return (
  3232. this.tokenType === TYPE$1.Delim &&
  3233. this.source.charCodeAt(this.tokenStart) === code
  3234. );
  3235. },
  3236. getTokenValue: function() {
  3237. return this.source.substring(this.tokenStart, this.tokenEnd);
  3238. },
  3239. getTokenLength: function() {
  3240. return this.tokenEnd - this.tokenStart;
  3241. },
  3242. substrToCursor: function(start) {
  3243. return this.source.substring(start, this.tokenStart);
  3244. },
  3245. skipWS: function() {
  3246. for (var i = this.tokenIndex, skipTokenCount = 0; i < this.tokenCount; i++, skipTokenCount++) {
  3247. if ((this.offsetAndType[i] >> TYPE_SHIFT) !== WHITESPACE) {
  3248. break;
  3249. }
  3250. }
  3251. if (skipTokenCount > 0) {
  3252. this.skip(skipTokenCount);
  3253. }
  3254. },
  3255. skipSC: function() {
  3256. while (this.tokenType === WHITESPACE || this.tokenType === COMMENT) {
  3257. this.next();
  3258. }
  3259. },
  3260. skip: function(tokenCount) {
  3261. var next = this.tokenIndex + tokenCount;
  3262. if (next < this.tokenCount) {
  3263. this.tokenIndex = next;
  3264. this.tokenStart = this.offsetAndType[next - 1] & OFFSET_MASK;
  3265. next = this.offsetAndType[next];
  3266. this.tokenType = next >> TYPE_SHIFT;
  3267. this.tokenEnd = next & OFFSET_MASK;
  3268. } else {
  3269. this.tokenIndex = this.tokenCount;
  3270. this.next();
  3271. }
  3272. },
  3273. next: function() {
  3274. var next = this.tokenIndex + 1;
  3275. if (next < this.tokenCount) {
  3276. this.tokenIndex = next;
  3277. this.tokenStart = this.tokenEnd;
  3278. next = this.offsetAndType[next];
  3279. this.tokenType = next >> TYPE_SHIFT;
  3280. this.tokenEnd = next & OFFSET_MASK;
  3281. } else {
  3282. this.tokenIndex = this.tokenCount;
  3283. this.eof = true;
  3284. this.tokenType = EOF$1;
  3285. this.tokenStart = this.tokenEnd = this.source.length;
  3286. }
  3287. },
  3288. dump: function() {
  3289. var offset = this.firstCharOffset;
  3290. return Array.prototype.slice.call(this.offsetAndType, 0, this.tokenCount).map(function(item, idx) {
  3291. var start = offset;
  3292. var end = item & OFFSET_MASK;
  3293. offset = end;
  3294. return {
  3295. idx: idx,
  3296. type: NAME$1[item >> TYPE_SHIFT],
  3297. chunk: this.source.substring(start, end),
  3298. balance: this.balance[idx]
  3299. };
  3300. }, this);
  3301. }
  3302. };
  3303. var TokenStream_1 = TokenStream;
  3304. function noop$1(value) {
  3305. return value;
  3306. }
  3307. function generateMultiplier(multiplier) {
  3308. if (multiplier.min === 0 && multiplier.max === 0) {
  3309. return '*';
  3310. }
  3311. if (multiplier.min === 0 && multiplier.max === 1) {
  3312. return '?';
  3313. }
  3314. if (multiplier.min === 1 && multiplier.max === 0) {
  3315. return multiplier.comma ? '#' : '+';
  3316. }
  3317. if (multiplier.min === 1 && multiplier.max === 1) {
  3318. return '';
  3319. }
  3320. return (
  3321. (multiplier.comma ? '#' : '') +
  3322. (multiplier.min === multiplier.max
  3323. ? '{' + multiplier.min + '}'
  3324. : '{' + multiplier.min + ',' + (multiplier.max !== 0 ? multiplier.max : '') + '}'
  3325. )
  3326. );
  3327. }
  3328. function generateTypeOpts(node) {
  3329. switch (node.type) {
  3330. case 'Range':
  3331. return (
  3332. ' [' +
  3333. (node.min === null ? '-∞' : node.min) +
  3334. ',' +
  3335. (node.max === null ? '∞' : node.max) +
  3336. ']'
  3337. );
  3338. default:
  3339. throw new Error('Unknown node type `' + node.type + '`');
  3340. }
  3341. }
  3342. function generateSequence(node, decorate, forceBraces, compact) {
  3343. var combinator = node.combinator === ' ' || compact ? node.combinator : ' ' + node.combinator + ' ';
  3344. var result = node.terms.map(function(term) {
  3345. return generate(term, decorate, forceBraces, compact);
  3346. }).join(combinator);
  3347. if (node.explicit || forceBraces) {
  3348. result = (compact || result[0] === ',' ? '[' : '[ ') + result + (compact ? ']' : ' ]');
  3349. }
  3350. return result;
  3351. }
  3352. function generate(node, decorate, forceBraces, compact) {
  3353. var result;
  3354. switch (node.type) {
  3355. case 'Group':
  3356. result =
  3357. generateSequence(node, decorate, forceBraces, compact) +
  3358. (node.disallowEmpty ? '!' : '');
  3359. break;
  3360. case 'Multiplier':
  3361. // return since node is a composition
  3362. return (
  3363. generate(node.term, decorate, forceBraces, compact) +
  3364. decorate(generateMultiplier(node), node)
  3365. );
  3366. case 'Type':
  3367. result = '<' + node.name + (node.opts ? decorate(generateTypeOpts(node.opts), node.opts) : '') + '>';
  3368. break;
  3369. case 'Property':
  3370. result = '<\'' + node.name + '\'>';
  3371. break;
  3372. case 'Keyword':
  3373. result = node.name;
  3374. break;
  3375. case 'AtKeyword':
  3376. result = '@' + node.name;
  3377. break;
  3378. case 'Function':
  3379. result = node.name + '(';
  3380. break;
  3381. case 'String':
  3382. case 'Token':
  3383. result = node.value;
  3384. break;
  3385. case 'Comma':
  3386. result = ',';
  3387. break;
  3388. default:
  3389. throw new Error('Unknown node type `' + node.type + '`');
  3390. }
  3391. return decorate(result, node);
  3392. }
  3393. var generate_1 = function(node, options) {
  3394. var decorate = noop$1;
  3395. var forceBraces = false;
  3396. var compact = false;
  3397. if (typeof options === 'function') {
  3398. decorate = options;
  3399. } else if (options) {
  3400. forceBraces = Boolean(options.forceBraces);
  3401. compact = Boolean(options.compact);
  3402. if (typeof options.decorate === 'function') {
  3403. decorate = options.decorate;
  3404. }
  3405. }
  3406. return generate(node, decorate, forceBraces, compact);
  3407. };
  3408. function fromMatchResult(matchResult) {
  3409. var tokens = matchResult.tokens;
  3410. var longestMatch = matchResult.longestMatch;
  3411. var node = longestMatch < tokens.length ? tokens[longestMatch].node : null;
  3412. var mismatchOffset = -1;
  3413. var entries = 0;
  3414. var css = '';
  3415. for (var i = 0; i < tokens.length; i++) {
  3416. if (i === longestMatch) {
  3417. mismatchOffset = css.length;
  3418. }
  3419. if (node !== null && tokens[i].node === node) {
  3420. if (i <= longestMatch) {
  3421. entries++;
  3422. } else {
  3423. entries = 0;
  3424. }
  3425. }
  3426. css += tokens[i].value;
  3427. }
  3428. return {
  3429. node: node,
  3430. css: css,
  3431. mismatchOffset: mismatchOffset === -1 ? css.length : mismatchOffset,
  3432. last: node === null || entries > 1
  3433. };
  3434. }
  3435. function getLocation(node, point) {
  3436. var loc = node && node.loc && node.loc[point];
  3437. if (loc) {
  3438. return {
  3439. offset: loc.offset,
  3440. line: loc.line,
  3441. column: loc.column
  3442. };
  3443. }
  3444. return null;
  3445. }
  3446. var SyntaxReferenceError = function(type, referenceName) {
  3447. var error = createCustomError(
  3448. 'SyntaxReferenceError',
  3449. type + (referenceName ? ' `' + referenceName + '`' : '')
  3450. );
  3451. error.reference = referenceName;
  3452. return error;
  3453. };
  3454. var MatchError = function(message, syntax, node, matchResult) {
  3455. var error = createCustomError('SyntaxMatchError', message);
  3456. var details = fromMatchResult(matchResult);
  3457. var mismatchOffset = details.mismatchOffset || 0;
  3458. var badNode = details.node || node;
  3459. var end = getLocation(badNode, 'end');
  3460. var start = details.last ? end : getLocation(badNode, 'start');
  3461. var css = details.css;
  3462. error.rawMessage = message;
  3463. error.syntax = syntax ? generate_1(syntax) : '<generic>';
  3464. error.css = css;
  3465. error.mismatchOffset = mismatchOffset;
  3466. error.loc = {
  3467. source: (badNode && badNode.loc && badNode.loc.source) || '<unknown>',
  3468. start: start,
  3469. end: end
  3470. };
  3471. error.line = start ? start.line : undefined;
  3472. error.column = start ? start.column : undefined;
  3473. error.offset = start ? start.offset : undefined;
  3474. error.message = message + '\n' +
  3475. ' syntax: ' + error.syntax + '\n' +
  3476. ' value: ' + (error.css || '<empty string>') + '\n' +
  3477. ' --------' + new Array(error.mismatchOffset + 1).join('-') + '^';
  3478. return error;
  3479. };
  3480. var error = {
  3481. SyntaxReferenceError: SyntaxReferenceError,
  3482. MatchError: MatchError
  3483. };
  3484. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3485. var keywords = Object.create(null);
  3486. var properties = Object.create(null);
  3487. var HYPHENMINUS = 45; // '-'.charCodeAt()
  3488. function isCustomProperty(str, offset) {
  3489. offset = offset || 0;
  3490. return str.length - offset >= 2 &&
  3491. str.charCodeAt(offset) === HYPHENMINUS &&
  3492. str.charCodeAt(offset + 1) === HYPHENMINUS;
  3493. }
  3494. function getVendorPrefix(str, offset) {
  3495. offset = offset || 0;
  3496. // verdor prefix should be at least 3 chars length
  3497. if (str.length - offset >= 3) {
  3498. // vendor prefix starts with hyper minus following non-hyper minus
  3499. if (str.charCodeAt(offset) === HYPHENMINUS &&
  3500. str.charCodeAt(offset + 1) !== HYPHENMINUS) {
  3501. // vendor prefix should contain a hyper minus at the ending
  3502. var secondDashIndex = str.indexOf('-', offset + 2);
  3503. if (secondDashIndex !== -1) {
  3504. return str.substring(offset, secondDashIndex + 1);
  3505. }
  3506. }
  3507. }
  3508. return '';
  3509. }
  3510. function getKeywordDescriptor(keyword) {
  3511. if (hasOwnProperty.call(keywords, keyword)) {
  3512. return keywords[keyword];
  3513. }
  3514. var name = keyword.toLowerCase();
  3515. if (hasOwnProperty.call(keywords, name)) {
  3516. return keywords[keyword] = keywords[name];
  3517. }
  3518. var custom = isCustomProperty(name, 0);
  3519. var vendor = !custom ? getVendorPrefix(name, 0) : '';
  3520. return keywords[keyword] = Object.freeze({
  3521. basename: name.substr(vendor.length),
  3522. name: name,
  3523. vendor: vendor,
  3524. prefix: vendor,
  3525. custom: custom
  3526. });
  3527. }
  3528. function getPropertyDescriptor(property) {
  3529. if (hasOwnProperty.call(properties, property)) {
  3530. return properties[property];
  3531. }
  3532. var name = property;
  3533. var hack = property[0];
  3534. if (hack === '/') {
  3535. hack = property[1] === '/' ? '//' : '/';
  3536. } else if (hack !== '_' &&
  3537. hack !== '*' &&
  3538. hack !== '$' &&
  3539. hack !== '#' &&
  3540. hack !== '+' &&
  3541. hack !== '&') {
  3542. hack = '';
  3543. }
  3544. var custom = isCustomProperty(name, hack.length);
  3545. // re-use result when possible (the same as for lower case)
  3546. if (!custom) {
  3547. name = name.toLowerCase();
  3548. if (hasOwnProperty.call(properties, name)) {
  3549. return properties[property] = properties[name];
  3550. }
  3551. }
  3552. var vendor = !custom ? getVendorPrefix(name, hack.length) : '';
  3553. var prefix = name.substr(0, hack.length + vendor.length);
  3554. return properties[property] = Object.freeze({
  3555. basename: name.substr(prefix.length),
  3556. name: name.substr(hack.length),
  3557. hack: hack,
  3558. vendor: vendor,
  3559. prefix: prefix,
  3560. custom: custom
  3561. });
  3562. }
  3563. var names = {
  3564. keyword: getKeywordDescriptor,
  3565. property: getPropertyDescriptor,
  3566. isCustomProperty: isCustomProperty,
  3567. vendorPrefix: getVendorPrefix
  3568. };
  3569. var MIN_SIZE = 16 * 1024;
  3570. var SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported
  3571. var adoptBuffer = function adoptBuffer(buffer, size) {
  3572. if (buffer === null || buffer.length < size) {
  3573. return new SafeUint32Array(Math.max(size + 1024, MIN_SIZE));
  3574. }
  3575. return buffer;
  3576. };
  3577. var TYPE$2 = _const.TYPE;
  3578. var isNewline$1 = charCodeDefinitions.isNewline;
  3579. var isName$2 = charCodeDefinitions.isName;
  3580. var isValidEscape$2 = charCodeDefinitions.isValidEscape;
  3581. var isNumberStart$1 = charCodeDefinitions.isNumberStart;
  3582. var isIdentifierStart$1 = charCodeDefinitions.isIdentifierStart;
  3583. var charCodeCategory$1 = charCodeDefinitions.charCodeCategory;
  3584. var isBOM$1 = charCodeDefinitions.isBOM;
  3585. var cmpStr$2 = utils.cmpStr;
  3586. var getNewlineLength$1 = utils.getNewlineLength;
  3587. var findWhiteSpaceEnd$1 = utils.findWhiteSpaceEnd;
  3588. var consumeEscaped$1 = utils.consumeEscaped;
  3589. var consumeName$1 = utils.consumeName;
  3590. var consumeNumber$1 = utils.consumeNumber;
  3591. var consumeBadUrlRemnants$1 = utils.consumeBadUrlRemnants;
  3592. var OFFSET_MASK$1 = 0x00FFFFFF;
  3593. var TYPE_SHIFT$1 = 24;
  3594. function tokenize(source, stream) {
  3595. function getCharCode(offset) {
  3596. return offset < sourceLength ? source.charCodeAt(offset) : 0;
  3597. }
  3598. // § 4.3.3. Consume a numeric token
  3599. function consumeNumericToken() {
  3600. // Consume a number and let number be the result.
  3601. offset = consumeNumber$1(source, offset);
  3602. // If the next 3 input code points would start an identifier, then:
  3603. if (isIdentifierStart$1(getCharCode(offset), getCharCode(offset + 1), getCharCode(offset + 2))) {
  3604. // Create a <dimension-token> with the same value and type flag as number, and a unit set initially to the empty string.
  3605. // Consume a name. Set the <dimension-token>’s unit to the returned value.
  3606. // Return the <dimension-token>.
  3607. type = TYPE$2.Dimension;
  3608. offset = consumeName$1(source, offset);
  3609. return;
  3610. }
  3611. // Otherwise, if the next input code point is U+0025 PERCENTAGE SIGN (%), consume it.
  3612. if (getCharCode(offset) === 0x0025) {
  3613. // Create a <percentage-token> with the same value as number, and return it.
  3614. type = TYPE$2.Percentage;
  3615. offset++;
  3616. return;
  3617. }
  3618. // Otherwise, create a <number-token> with the same value and type flag as number, and return it.
  3619. type = TYPE$2.Number;
  3620. }
  3621. // § 4.3.4. Consume an ident-like token
  3622. function consumeIdentLikeToken() {
  3623. const nameStartOffset = offset;
  3624. // Consume a name, and let string be the result.
  3625. offset = consumeName$1(source, offset);
  3626. // If string’s value is an ASCII case-insensitive match for "url",
  3627. // and the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.
  3628. if (cmpStr$2(source, nameStartOffset, offset, 'url') && getCharCode(offset) === 0x0028) {
  3629. // While the next two input code points are whitespace, consume the next input code point.
  3630. offset = findWhiteSpaceEnd$1(source, offset + 1);
  3631. // If the next one or two input code points are U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('),
  3632. // or whitespace followed by U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE ('),
  3633. // then create a <function-token> with its value set to string and return it.
  3634. if (getCharCode(offset) === 0x0022 ||
  3635. getCharCode(offset) === 0x0027) {
  3636. type = TYPE$2.Function;
  3637. offset = nameStartOffset + 4;
  3638. return;
  3639. }
  3640. // Otherwise, consume a url token, and return it.
  3641. consumeUrlToken();
  3642. return;
  3643. }
  3644. // Otherwise, if the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.
  3645. // Create a <function-token> with its value set to string and return it.
  3646. if (getCharCode(offset) === 0x0028) {
  3647. type = TYPE$2.Function;
  3648. offset++;
  3649. return;
  3650. }
  3651. // Otherwise, create an <ident-token> with its value set to string and return it.
  3652. type = TYPE$2.Ident;
  3653. }
  3654. // § 4.3.5. Consume a string token
  3655. function consumeStringToken(endingCodePoint) {
  3656. // This algorithm may be called with an ending code point, which denotes the code point
  3657. // that ends the string. If an ending code point is not specified,
  3658. // the current input code point is used.
  3659. if (!endingCodePoint) {
  3660. endingCodePoint = getCharCode(offset++);
  3661. }
  3662. // Initially create a <string-token> with its value set to the empty string.
  3663. type = TYPE$2.String;
  3664. // Repeatedly consume the next input code point from the stream:
  3665. for (; offset < source.length; offset++) {
  3666. var code = source.charCodeAt(offset);
  3667. switch (charCodeCategory$1(code)) {
  3668. // ending code point
  3669. case endingCodePoint:
  3670. // Return the <string-token>.
  3671. offset++;
  3672. return;
  3673. // EOF
  3674. case charCodeCategory$1.Eof:
  3675. // This is a parse error. Return the <string-token>.
  3676. return;
  3677. // newline
  3678. case charCodeCategory$1.WhiteSpace:
  3679. if (isNewline$1(code)) {
  3680. // This is a parse error. Reconsume the current input code point,
  3681. // create a <bad-string-token>, and return it.
  3682. offset += getNewlineLength$1(source, offset, code);
  3683. type = TYPE$2.BadString;
  3684. return;
  3685. }
  3686. break;
  3687. // U+005C REVERSE SOLIDUS (\)
  3688. case 0x005C:
  3689. // If the next input code point is EOF, do nothing.
  3690. if (offset === source.length - 1) {
  3691. break;
  3692. }
  3693. var nextCode = getCharCode(offset + 1);
  3694. // Otherwise, if the next input code point is a newline, consume it.
  3695. if (isNewline$1(nextCode)) {
  3696. offset += getNewlineLength$1(source, offset + 1, nextCode);
  3697. } else if (isValidEscape$2(code, nextCode)) {
  3698. // Otherwise, (the stream starts with a valid escape) consume
  3699. // an escaped code point and append the returned code point to
  3700. // the <string-token>’s value.
  3701. offset = consumeEscaped$1(source, offset) - 1;
  3702. }
  3703. break;
  3704. // anything else
  3705. // Append the current input code point to the <string-token>’s value.
  3706. }
  3707. }
  3708. }
  3709. // § 4.3.6. Consume a url token
  3710. // Note: This algorithm assumes that the initial "url(" has already been consumed.
  3711. // This algorithm also assumes that it’s being called to consume an "unquoted" value, like url(foo).
  3712. // A quoted value, like url("foo"), is parsed as a <function-token>. Consume an ident-like token
  3713. // automatically handles this distinction; this algorithm shouldn’t be called directly otherwise.
  3714. function consumeUrlToken() {
  3715. // Initially create a <url-token> with its value set to the empty string.
  3716. type = TYPE$2.Url;
  3717. // Consume as much whitespace as possible.
  3718. offset = findWhiteSpaceEnd$1(source, offset);
  3719. // Repeatedly consume the next input code point from the stream:
  3720. for (; offset < source.length; offset++) {
  3721. var code = source.charCodeAt(offset);
  3722. switch (charCodeCategory$1(code)) {
  3723. // U+0029 RIGHT PARENTHESIS ())
  3724. case 0x0029:
  3725. // Return the <url-token>.
  3726. offset++;
  3727. return;
  3728. // EOF
  3729. case charCodeCategory$1.Eof:
  3730. // This is a parse error. Return the <url-token>.
  3731. return;
  3732. // whitespace
  3733. case charCodeCategory$1.WhiteSpace:
  3734. // Consume as much whitespace as possible.
  3735. offset = findWhiteSpaceEnd$1(source, offset);
  3736. // If the next input code point is U+0029 RIGHT PARENTHESIS ()) or EOF,
  3737. // consume it and return the <url-token>
  3738. // (if EOF was encountered, this is a parse error);
  3739. if (getCharCode(offset) === 0x0029 || offset >= source.length) {
  3740. if (offset < source.length) {
  3741. offset++;
  3742. }
  3743. return;
  3744. }
  3745. // otherwise, consume the remnants of a bad url, create a <bad-url-token>,
  3746. // and return it.
  3747. offset = consumeBadUrlRemnants$1(source, offset);
  3748. type = TYPE$2.BadUrl;
  3749. return;
  3750. // U+0022 QUOTATION MARK (")
  3751. // U+0027 APOSTROPHE (')
  3752. // U+0028 LEFT PARENTHESIS (()
  3753. // non-printable code point
  3754. case 0x0022:
  3755. case 0x0027:
  3756. case 0x0028:
  3757. case charCodeCategory$1.NonPrintable:
  3758. // This is a parse error. Consume the remnants of a bad url,
  3759. // create a <bad-url-token>, and return it.
  3760. offset = consumeBadUrlRemnants$1(source, offset);
  3761. type = TYPE$2.BadUrl;
  3762. return;
  3763. // U+005C REVERSE SOLIDUS (\)
  3764. case 0x005C:
  3765. // If the stream starts with a valid escape, consume an escaped code point and
  3766. // append the returned code point to the <url-token>’s value.
  3767. if (isValidEscape$2(code, getCharCode(offset + 1))) {
  3768. offset = consumeEscaped$1(source, offset) - 1;
  3769. break;
  3770. }
  3771. // Otherwise, this is a parse error. Consume the remnants of a bad url,
  3772. // create a <bad-url-token>, and return it.
  3773. offset = consumeBadUrlRemnants$1(source, offset);
  3774. type = TYPE$2.BadUrl;
  3775. return;
  3776. // anything else
  3777. // Append the current input code point to the <url-token>’s value.
  3778. }
  3779. }
  3780. }
  3781. if (!stream) {
  3782. stream = new TokenStream_1();
  3783. }
  3784. // ensure source is a string
  3785. source = String(source || '');
  3786. var sourceLength = source.length;
  3787. var offsetAndType = adoptBuffer(stream.offsetAndType, sourceLength + 1); // +1 because of eof-token
  3788. var balance = adoptBuffer(stream.balance, sourceLength + 1);
  3789. var tokenCount = 0;
  3790. var start = isBOM$1(getCharCode(0));
  3791. var offset = start;
  3792. var balanceCloseType = 0;
  3793. var balanceStart = 0;
  3794. var balancePrev = 0;
  3795. // https://drafts.csswg.org/css-syntax-3/#consume-token
  3796. // § 4.3.1. Consume a token
  3797. while (offset < sourceLength) {
  3798. var code = source.charCodeAt(offset);
  3799. var type = 0;
  3800. balance[tokenCount] = sourceLength;
  3801. switch (charCodeCategory$1(code)) {
  3802. // whitespace
  3803. case charCodeCategory$1.WhiteSpace:
  3804. // Consume as much whitespace as possible. Return a <whitespace-token>.
  3805. type = TYPE$2.WhiteSpace;
  3806. offset = findWhiteSpaceEnd$1(source, offset + 1);
  3807. break;
  3808. // U+0022 QUOTATION MARK (")
  3809. case 0x0022:
  3810. // Consume a string token and return it.
  3811. consumeStringToken();
  3812. break;
  3813. // U+0023 NUMBER SIGN (#)
  3814. case 0x0023:
  3815. // If the next input code point is a name code point or the next two input code points are a valid escape, then:
  3816. if (isName$2(getCharCode(offset + 1)) || isValidEscape$2(getCharCode(offset + 1), getCharCode(offset + 2))) {
  3817. // Create a <hash-token>.
  3818. type = TYPE$2.Hash;
  3819. // If the next 3 input code points would start an identifier, set the <hash-token>’s type flag to "id".
  3820. // if (isIdentifierStart(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) {
  3821. // // TODO: set id flag
  3822. // }
  3823. // Consume a name, and set the <hash-token>’s value to the returned string.
  3824. offset = consumeName$1(source, offset + 1);
  3825. // Return the <hash-token>.
  3826. } else {
  3827. // Otherwise, return a <delim-token> with its value set to the current input code point.
  3828. type = TYPE$2.Delim;
  3829. offset++;
  3830. }
  3831. break;
  3832. // U+0027 APOSTROPHE (')
  3833. case 0x0027:
  3834. // Consume a string token and return it.
  3835. consumeStringToken();
  3836. break;
  3837. // U+0028 LEFT PARENTHESIS (()
  3838. case 0x0028:
  3839. // Return a <(-token>.
  3840. type = TYPE$2.LeftParenthesis;
  3841. offset++;
  3842. break;
  3843. // U+0029 RIGHT PARENTHESIS ())
  3844. case 0x0029:
  3845. // Return a <)-token>.
  3846. type = TYPE$2.RightParenthesis;
  3847. offset++;
  3848. break;
  3849. // U+002B PLUS SIGN (+)
  3850. case 0x002B:
  3851. // If the input stream starts with a number, ...
  3852. if (isNumberStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  3853. // ... reconsume the current input code point, consume a numeric token, and return it.
  3854. consumeNumericToken();
  3855. } else {
  3856. // Otherwise, return a <delim-token> with its value set to the current input code point.
  3857. type = TYPE$2.Delim;
  3858. offset++;
  3859. }
  3860. break;
  3861. // U+002C COMMA (,)
  3862. case 0x002C:
  3863. // Return a <comma-token>.
  3864. type = TYPE$2.Comma;
  3865. offset++;
  3866. break;
  3867. // U+002D HYPHEN-MINUS (-)
  3868. case 0x002D:
  3869. // If the input stream starts with a number, reconsume the current input code point, consume a numeric token, and return it.
  3870. if (isNumberStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  3871. consumeNumericToken();
  3872. } else {
  3873. // 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>.
  3874. if (getCharCode(offset + 1) === 0x002D &&
  3875. getCharCode(offset + 2) === 0x003E) {
  3876. type = TYPE$2.CDC;
  3877. offset = offset + 3;
  3878. } else {
  3879. // Otherwise, if the input stream starts with an identifier, ...
  3880. if (isIdentifierStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  3881. // ... reconsume the current input code point, consume an ident-like token, and return it.
  3882. consumeIdentLikeToken();
  3883. } else {
  3884. // Otherwise, return a <delim-token> with its value set to the current input code point.
  3885. type = TYPE$2.Delim;
  3886. offset++;
  3887. }
  3888. }
  3889. }
  3890. break;
  3891. // U+002E FULL STOP (.)
  3892. case 0x002E:
  3893. // If the input stream starts with a number, ...
  3894. if (isNumberStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  3895. // ... reconsume the current input code point, consume a numeric token, and return it.
  3896. consumeNumericToken();
  3897. } else {
  3898. // Otherwise, return a <delim-token> with its value set to the current input code point.
  3899. type = TYPE$2.Delim;
  3900. offset++;
  3901. }
  3902. break;
  3903. // U+002F SOLIDUS (/)
  3904. case 0x002F:
  3905. // If the next two input code point are U+002F SOLIDUS (/) followed by a U+002A ASTERISK (*),
  3906. if (getCharCode(offset + 1) === 0x002A) {
  3907. // ... consume them and all following code points up to and including the first U+002A ASTERISK (*)
  3908. // followed by a U+002F SOLIDUS (/), or up to an EOF code point.
  3909. type = TYPE$2.Comment;
  3910. offset = source.indexOf('*/', offset + 2) + 2;
  3911. if (offset === 1) {
  3912. offset = source.length;
  3913. }
  3914. } else {
  3915. type = TYPE$2.Delim;
  3916. offset++;
  3917. }
  3918. break;
  3919. // U+003A COLON (:)
  3920. case 0x003A:
  3921. // Return a <colon-token>.
  3922. type = TYPE$2.Colon;
  3923. offset++;
  3924. break;
  3925. // U+003B SEMICOLON (;)
  3926. case 0x003B:
  3927. // Return a <semicolon-token>.
  3928. type = TYPE$2.Semicolon;
  3929. offset++;
  3930. break;
  3931. // U+003C LESS-THAN SIGN (<)
  3932. case 0x003C:
  3933. // If the next 3 input code points are U+0021 EXCLAMATION MARK U+002D HYPHEN-MINUS U+002D HYPHEN-MINUS (!--), ...
  3934. if (getCharCode(offset + 1) === 0x0021 &&
  3935. getCharCode(offset + 2) === 0x002D &&
  3936. getCharCode(offset + 3) === 0x002D) {
  3937. // ... consume them and return a <CDO-token>.
  3938. type = TYPE$2.CDO;
  3939. offset = offset + 4;
  3940. } else {
  3941. // Otherwise, return a <delim-token> with its value set to the current input code point.
  3942. type = TYPE$2.Delim;
  3943. offset++;
  3944. }
  3945. break;
  3946. // U+0040 COMMERCIAL AT (@)
  3947. case 0x0040:
  3948. // If the next 3 input code points would start an identifier, ...
  3949. if (isIdentifierStart$1(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) {
  3950. // ... consume a name, create an <at-keyword-token> with its value set to the returned value, and return it.
  3951. type = TYPE$2.AtKeyword;
  3952. offset = consumeName$1(source, offset + 1);
  3953. } else {
  3954. // Otherwise, return a <delim-token> with its value set to the current input code point.
  3955. type = TYPE$2.Delim;
  3956. offset++;
  3957. }
  3958. break;
  3959. // U+005B LEFT SQUARE BRACKET ([)
  3960. case 0x005B:
  3961. // Return a <[-token>.
  3962. type = TYPE$2.LeftSquareBracket;
  3963. offset++;
  3964. break;
  3965. // U+005C REVERSE SOLIDUS (\)
  3966. case 0x005C:
  3967. // If the input stream starts with a valid escape, ...
  3968. if (isValidEscape$2(code, getCharCode(offset + 1))) {
  3969. // ... reconsume the current input code point, consume an ident-like token, and return it.
  3970. consumeIdentLikeToken();
  3971. } else {
  3972. // Otherwise, this is a parse error. Return a <delim-token> with its value set to the current input code point.
  3973. type = TYPE$2.Delim;
  3974. offset++;
  3975. }
  3976. break;
  3977. // U+005D RIGHT SQUARE BRACKET (])
  3978. case 0x005D:
  3979. // Return a <]-token>.
  3980. type = TYPE$2.RightSquareBracket;
  3981. offset++;
  3982. break;
  3983. // U+007B LEFT CURLY BRACKET ({)
  3984. case 0x007B:
  3985. // Return a <{-token>.
  3986. type = TYPE$2.LeftCurlyBracket;
  3987. offset++;
  3988. break;
  3989. // U+007D RIGHT CURLY BRACKET (})
  3990. case 0x007D:
  3991. // Return a <}-token>.
  3992. type = TYPE$2.RightCurlyBracket;
  3993. offset++;
  3994. break;
  3995. // digit
  3996. case charCodeCategory$1.Digit:
  3997. // Reconsume the current input code point, consume a numeric token, and return it.
  3998. consumeNumericToken();
  3999. break;
  4000. // name-start code point
  4001. case charCodeCategory$1.NameStart:
  4002. // Reconsume the current input code point, consume an ident-like token, and return it.
  4003. consumeIdentLikeToken();
  4004. break;
  4005. // EOF
  4006. case charCodeCategory$1.Eof:
  4007. // Return an <EOF-token>.
  4008. break;
  4009. // anything else
  4010. default:
  4011. // Return a <delim-token> with its value set to the current input code point.
  4012. type = TYPE$2.Delim;
  4013. offset++;
  4014. }
  4015. switch (type) {
  4016. case balanceCloseType:
  4017. balancePrev = balanceStart & OFFSET_MASK$1;
  4018. balanceStart = balance[balancePrev];
  4019. balanceCloseType = balanceStart >> TYPE_SHIFT$1;
  4020. balance[tokenCount] = balancePrev;
  4021. balance[balancePrev++] = tokenCount;
  4022. for (; balancePrev < tokenCount; balancePrev++) {
  4023. if (balance[balancePrev] === sourceLength) {
  4024. balance[balancePrev] = tokenCount;
  4025. }
  4026. }
  4027. break;
  4028. case TYPE$2.LeftParenthesis:
  4029. case TYPE$2.Function:
  4030. balance[tokenCount] = balanceStart;
  4031. balanceCloseType = TYPE$2.RightParenthesis;
  4032. balanceStart = (balanceCloseType << TYPE_SHIFT$1) | tokenCount;
  4033. break;
  4034. case TYPE$2.LeftSquareBracket:
  4035. balance[tokenCount] = balanceStart;
  4036. balanceCloseType = TYPE$2.RightSquareBracket;
  4037. balanceStart = (balanceCloseType << TYPE_SHIFT$1) | tokenCount;
  4038. break;
  4039. case TYPE$2.LeftCurlyBracket:
  4040. balance[tokenCount] = balanceStart;
  4041. balanceCloseType = TYPE$2.RightCurlyBracket;
  4042. balanceStart = (balanceCloseType << TYPE_SHIFT$1) | tokenCount;
  4043. break;
  4044. }
  4045. offsetAndType[tokenCount++] = (type << TYPE_SHIFT$1) | offset;
  4046. }
  4047. // finalize buffers
  4048. offsetAndType[tokenCount] = (TYPE$2.EOF << TYPE_SHIFT$1) | offset; // <EOF-token>
  4049. balance[tokenCount] = sourceLength;
  4050. balance[sourceLength] = sourceLength; // prevents false positive balance match with any token
  4051. while (balanceStart !== 0) {
  4052. balancePrev = balanceStart & OFFSET_MASK$1;
  4053. balanceStart = balance[balancePrev];
  4054. balance[balancePrev] = sourceLength;
  4055. }
  4056. // update stream
  4057. stream.source = source;
  4058. stream.firstCharOffset = start;
  4059. stream.offsetAndType = offsetAndType;
  4060. stream.tokenCount = tokenCount;
  4061. stream.balance = balance;
  4062. stream.reset();
  4063. stream.next();
  4064. return stream;
  4065. }
  4066. // extend tokenizer with constants
  4067. Object.keys(_const).forEach(function(key) {
  4068. tokenize[key] = _const[key];
  4069. });
  4070. // extend tokenizer with static methods from utils
  4071. Object.keys(charCodeDefinitions).forEach(function(key) {
  4072. tokenize[key] = charCodeDefinitions[key];
  4073. });
  4074. Object.keys(utils).forEach(function(key) {
  4075. tokenize[key] = utils[key];
  4076. });
  4077. var tokenizer = tokenize;
  4078. var isDigit$2 = tokenizer.isDigit;
  4079. var cmpChar$1 = tokenizer.cmpChar;
  4080. var TYPE$3 = tokenizer.TYPE;
  4081. var DELIM = TYPE$3.Delim;
  4082. var WHITESPACE$1 = TYPE$3.WhiteSpace;
  4083. var COMMENT$1 = TYPE$3.Comment;
  4084. var IDENT = TYPE$3.Ident;
  4085. var NUMBER = TYPE$3.Number;
  4086. var DIMENSION = TYPE$3.Dimension;
  4087. var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
  4088. var HYPHENMINUS$1 = 0x002D; // U+002D HYPHEN-MINUS (-)
  4089. var N = 0x006E; // U+006E LATIN SMALL LETTER N (n)
  4090. var DISALLOW_SIGN = true;
  4091. var ALLOW_SIGN = false;
  4092. function isDelim(token, code) {
  4093. return token !== null && token.type === DELIM && token.value.charCodeAt(0) === code;
  4094. }
  4095. function skipSC(token, offset, getNextToken) {
  4096. while (token !== null && (token.type === WHITESPACE$1 || token.type === COMMENT$1)) {
  4097. token = getNextToken(++offset);
  4098. }
  4099. return offset;
  4100. }
  4101. function checkInteger(token, valueOffset, disallowSign, offset) {
  4102. if (!token) {
  4103. return 0;
  4104. }
  4105. var code = token.value.charCodeAt(valueOffset);
  4106. if (code === PLUSSIGN || code === HYPHENMINUS$1) {
  4107. if (disallowSign) {
  4108. // Number sign is not allowed
  4109. return 0;
  4110. }
  4111. valueOffset++;
  4112. }
  4113. for (; valueOffset < token.value.length; valueOffset++) {
  4114. if (!isDigit$2(token.value.charCodeAt(valueOffset))) {
  4115. // Integer is expected
  4116. return 0;
  4117. }
  4118. }
  4119. return offset + 1;
  4120. }
  4121. // ... <signed-integer>
  4122. // ... ['+' | '-'] <signless-integer>
  4123. function consumeB(token, offset_, getNextToken) {
  4124. var sign = false;
  4125. var offset = skipSC(token, offset_, getNextToken);
  4126. token = getNextToken(offset);
  4127. if (token === null) {
  4128. return offset_;
  4129. }
  4130. if (token.type !== NUMBER) {
  4131. if (isDelim(token, PLUSSIGN) || isDelim(token, HYPHENMINUS$1)) {
  4132. sign = true;
  4133. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4134. token = getNextToken(offset);
  4135. if (token === null && token.type !== NUMBER) {
  4136. return 0;
  4137. }
  4138. } else {
  4139. return offset_;
  4140. }
  4141. }
  4142. if (!sign) {
  4143. var code = token.value.charCodeAt(0);
  4144. if (code !== PLUSSIGN && code !== HYPHENMINUS$1) {
  4145. // Number sign is expected
  4146. return 0;
  4147. }
  4148. }
  4149. return checkInteger(token, sign ? 0 : 1, sign, offset);
  4150. }
  4151. // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
  4152. var genericAnPlusB = function anPlusB(token, getNextToken) {
  4153. /* eslint-disable brace-style*/
  4154. var offset = 0;
  4155. if (!token) {
  4156. return 0;
  4157. }
  4158. // <integer>
  4159. if (token.type === NUMBER) {
  4160. return checkInteger(token, 0, ALLOW_SIGN, offset); // b
  4161. }
  4162. // -n
  4163. // -n <signed-integer>
  4164. // -n ['+' | '-'] <signless-integer>
  4165. // -n- <signless-integer>
  4166. // <dashndashdigit-ident>
  4167. else if (token.type === IDENT && token.value.charCodeAt(0) === HYPHENMINUS$1) {
  4168. // expect 1st char is N
  4169. if (!cmpChar$1(token.value, 1, N)) {
  4170. return 0;
  4171. }
  4172. switch (token.value.length) {
  4173. // -n
  4174. // -n <signed-integer>
  4175. // -n ['+' | '-'] <signless-integer>
  4176. case 2:
  4177. return consumeB(getNextToken(++offset), offset, getNextToken);
  4178. // -n- <signless-integer>
  4179. case 3:
  4180. if (token.value.charCodeAt(2) !== HYPHENMINUS$1) {
  4181. return 0;
  4182. }
  4183. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4184. token = getNextToken(offset);
  4185. return checkInteger(token, 0, DISALLOW_SIGN, offset);
  4186. // <dashndashdigit-ident>
  4187. default:
  4188. if (token.value.charCodeAt(2) !== HYPHENMINUS$1) {
  4189. return 0;
  4190. }
  4191. return checkInteger(token, 3, DISALLOW_SIGN, offset);
  4192. }
  4193. }
  4194. // '+'? n
  4195. // '+'? n <signed-integer>
  4196. // '+'? n ['+' | '-'] <signless-integer>
  4197. // '+'? n- <signless-integer>
  4198. // '+'? <ndashdigit-ident>
  4199. else if (token.type === IDENT || (isDelim(token, PLUSSIGN) && getNextToken(offset + 1).type === IDENT)) {
  4200. // just ignore a plus
  4201. if (token.type !== IDENT) {
  4202. token = getNextToken(++offset);
  4203. }
  4204. if (token === null || !cmpChar$1(token.value, 0, N)) {
  4205. return 0;
  4206. }
  4207. switch (token.value.length) {
  4208. // '+'? n
  4209. // '+'? n <signed-integer>
  4210. // '+'? n ['+' | '-'] <signless-integer>
  4211. case 1:
  4212. return consumeB(getNextToken(++offset), offset, getNextToken);
  4213. // '+'? n- <signless-integer>
  4214. case 2:
  4215. if (token.value.charCodeAt(1) !== HYPHENMINUS$1) {
  4216. return 0;
  4217. }
  4218. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4219. token = getNextToken(offset);
  4220. return checkInteger(token, 0, DISALLOW_SIGN, offset);
  4221. // '+'? <ndashdigit-ident>
  4222. default:
  4223. if (token.value.charCodeAt(1) !== HYPHENMINUS$1) {
  4224. return 0;
  4225. }
  4226. return checkInteger(token, 2, DISALLOW_SIGN, offset);
  4227. }
  4228. }
  4229. // <ndashdigit-dimension>
  4230. // <ndash-dimension> <signless-integer>
  4231. // <n-dimension>
  4232. // <n-dimension> <signed-integer>
  4233. // <n-dimension> ['+' | '-'] <signless-integer>
  4234. else if (token.type === DIMENSION) {
  4235. var code = token.value.charCodeAt(0);
  4236. var sign = code === PLUSSIGN || code === HYPHENMINUS$1 ? 1 : 0;
  4237. for (var i = sign; i < token.value.length; i++) {
  4238. if (!isDigit$2(token.value.charCodeAt(i))) {
  4239. break;
  4240. }
  4241. }
  4242. if (i === sign) {
  4243. // Integer is expected
  4244. return 0;
  4245. }
  4246. if (!cmpChar$1(token.value, i, N)) {
  4247. return 0;
  4248. }
  4249. // <n-dimension>
  4250. // <n-dimension> <signed-integer>
  4251. // <n-dimension> ['+' | '-'] <signless-integer>
  4252. if (i + 1 === token.value.length) {
  4253. return consumeB(getNextToken(++offset), offset, getNextToken);
  4254. } else {
  4255. if (token.value.charCodeAt(i + 1) !== HYPHENMINUS$1) {
  4256. return 0;
  4257. }
  4258. // <ndash-dimension> <signless-integer>
  4259. if (i + 2 === token.value.length) {
  4260. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4261. token = getNextToken(offset);
  4262. return checkInteger(token, 0, DISALLOW_SIGN, offset);
  4263. }
  4264. // <ndashdigit-dimension>
  4265. else {
  4266. return checkInteger(token, i + 2, DISALLOW_SIGN, offset);
  4267. }
  4268. }
  4269. }
  4270. return 0;
  4271. };
  4272. var isHexDigit$2 = tokenizer.isHexDigit;
  4273. var cmpChar$2 = tokenizer.cmpChar;
  4274. var TYPE$4 = tokenizer.TYPE;
  4275. var IDENT$1 = TYPE$4.Ident;
  4276. var DELIM$1 = TYPE$4.Delim;
  4277. var NUMBER$1 = TYPE$4.Number;
  4278. var DIMENSION$1 = TYPE$4.Dimension;
  4279. var PLUSSIGN$1 = 0x002B; // U+002B PLUS SIGN (+)
  4280. var HYPHENMINUS$2 = 0x002D; // U+002D HYPHEN-MINUS (-)
  4281. var QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?)
  4282. var U = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
  4283. function isDelim$1(token, code) {
  4284. return token !== null && token.type === DELIM$1 && token.value.charCodeAt(0) === code;
  4285. }
  4286. function startsWith(token, code) {
  4287. return token.value.charCodeAt(0) === code;
  4288. }
  4289. function hexSequence(token, offset, allowDash) {
  4290. for (var pos = offset, hexlen = 0; pos < token.value.length; pos++) {
  4291. var code = token.value.charCodeAt(pos);
  4292. if (code === HYPHENMINUS$2 && allowDash && hexlen !== 0) {
  4293. if (hexSequence(token, offset + hexlen + 1, false) > 0) {
  4294. return 6; // dissallow following question marks
  4295. }
  4296. return 0; // dash at the ending of a hex sequence is not allowed
  4297. }
  4298. if (!isHexDigit$2(code)) {
  4299. return 0; // not a hex digit
  4300. }
  4301. if (++hexlen > 6) {
  4302. return 0; // too many hex digits
  4303. } }
  4304. return hexlen;
  4305. }
  4306. function withQuestionMarkSequence(consumed, length, getNextToken) {
  4307. if (!consumed) {
  4308. return 0; // nothing consumed
  4309. }
  4310. while (isDelim$1(getNextToken(length), QUESTIONMARK)) {
  4311. if (++consumed > 6) {
  4312. return 0; // too many question marks
  4313. }
  4314. length++;
  4315. }
  4316. return length;
  4317. }
  4318. // https://drafts.csswg.org/css-syntax/#urange
  4319. // Informally, the <urange> production has three forms:
  4320. // U+0001
  4321. // Defines a range consisting of a single code point, in this case the code point "1".
  4322. // U+0001-00ff
  4323. // Defines a range of codepoints between the first and the second value, in this case
  4324. // the range between "1" and "ff" (255 in decimal) inclusive.
  4325. // U+00??
  4326. // Defines a range of codepoints where the "?" characters range over all hex digits,
  4327. // in this case defining the same as the value U+0000-00ff.
  4328. // In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
  4329. //
  4330. // <urange> =
  4331. // u '+' <ident-token> '?'* |
  4332. // u <dimension-token> '?'* |
  4333. // u <number-token> '?'* |
  4334. // u <number-token> <dimension-token> |
  4335. // u <number-token> <number-token> |
  4336. // u '+' '?'+
  4337. var genericUrange = function urange(token, getNextToken) {
  4338. var length = 0;
  4339. // should start with `u` or `U`
  4340. if (token === null || token.type !== IDENT$1 || !cmpChar$2(token.value, 0, U)) {
  4341. return 0;
  4342. }
  4343. token = getNextToken(++length);
  4344. if (token === null) {
  4345. return 0;
  4346. }
  4347. // u '+' <ident-token> '?'*
  4348. // u '+' '?'+
  4349. if (isDelim$1(token, PLUSSIGN$1)) {
  4350. token = getNextToken(++length);
  4351. if (token === null) {
  4352. return 0;
  4353. }
  4354. if (token.type === IDENT$1) {
  4355. // u '+' <ident-token> '?'*
  4356. return withQuestionMarkSequence(hexSequence(token, 0, true), ++length, getNextToken);
  4357. }
  4358. if (isDelim$1(token, QUESTIONMARK)) {
  4359. // u '+' '?'+
  4360. return withQuestionMarkSequence(1, ++length, getNextToken);
  4361. }
  4362. // Hex digit or question mark is expected
  4363. return 0;
  4364. }
  4365. // u <number-token> '?'*
  4366. // u <number-token> <dimension-token>
  4367. // u <number-token> <number-token>
  4368. if (token.type === NUMBER$1) {
  4369. if (!startsWith(token, PLUSSIGN$1)) {
  4370. return 0;
  4371. }
  4372. var consumedHexLength = hexSequence(token, 1, true);
  4373. if (consumedHexLength === 0) {
  4374. return 0;
  4375. }
  4376. token = getNextToken(++length);
  4377. if (token === null) {
  4378. // u <number-token> <eof>
  4379. return length;
  4380. }
  4381. if (token.type === DIMENSION$1 || token.type === NUMBER$1) {
  4382. // u <number-token> <dimension-token>
  4383. // u <number-token> <number-token>
  4384. if (!startsWith(token, HYPHENMINUS$2) || !hexSequence(token, 1, false)) {
  4385. return 0;
  4386. }
  4387. return length + 1;
  4388. }
  4389. // u <number-token> '?'*
  4390. return withQuestionMarkSequence(consumedHexLength, length, getNextToken);
  4391. }
  4392. // u <dimension-token> '?'*
  4393. if (token.type === DIMENSION$1) {
  4394. if (!startsWith(token, PLUSSIGN$1)) {
  4395. return 0;
  4396. }
  4397. return withQuestionMarkSequence(hexSequence(token, 1, true), ++length, getNextToken);
  4398. }
  4399. return 0;
  4400. };
  4401. var isIdentifierStart$2 = tokenizer.isIdentifierStart;
  4402. var isHexDigit$3 = tokenizer.isHexDigit;
  4403. var isDigit$3 = tokenizer.isDigit;
  4404. var cmpStr$3 = tokenizer.cmpStr;
  4405. var consumeNumber$2 = tokenizer.consumeNumber;
  4406. var TYPE$5 = tokenizer.TYPE;
  4407. var cssWideKeywords = ['unset', 'initial', 'inherit'];
  4408. var calcFunctionNames = ['calc(', '-moz-calc(', '-webkit-calc('];
  4409. // https://www.w3.org/TR/css-values-3/#lengths
  4410. var LENGTH = {
  4411. // absolute length units
  4412. 'px': true,
  4413. 'mm': true,
  4414. 'cm': true,
  4415. 'in': true,
  4416. 'pt': true,
  4417. 'pc': true,
  4418. 'q': true,
  4419. // relative length units
  4420. 'em': true,
  4421. 'ex': true,
  4422. 'ch': true,
  4423. 'rem': true,
  4424. // viewport-percentage lengths
  4425. 'vh': true,
  4426. 'vw': true,
  4427. 'vmin': true,
  4428. 'vmax': true,
  4429. 'vm': true
  4430. };
  4431. var ANGLE = {
  4432. 'deg': true,
  4433. 'grad': true,
  4434. 'rad': true,
  4435. 'turn': true
  4436. };
  4437. var TIME = {
  4438. 's': true,
  4439. 'ms': true
  4440. };
  4441. var FREQUENCY = {
  4442. 'hz': true,
  4443. 'khz': true
  4444. };
  4445. // https://www.w3.org/TR/css-values-3/#resolution (https://drafts.csswg.org/css-values/#resolution)
  4446. var RESOLUTION = {
  4447. 'dpi': true,
  4448. 'dpcm': true,
  4449. 'dppx': true,
  4450. 'x': true // https://github.com/w3c/csswg-drafts/issues/461
  4451. };
  4452. // https://drafts.csswg.org/css-grid/#fr-unit
  4453. var FLEX = {
  4454. 'fr': true
  4455. };
  4456. // https://www.w3.org/TR/css3-speech/#mixing-props-voice-volume
  4457. var DECIBEL = {
  4458. 'db': true
  4459. };
  4460. // https://www.w3.org/TR/css3-speech/#voice-props-voice-pitch
  4461. var SEMITONES = {
  4462. 'st': true
  4463. };
  4464. // safe char code getter
  4465. function charCode(str, index) {
  4466. return index < str.length ? str.charCodeAt(index) : 0;
  4467. }
  4468. function eqStr(actual, expected) {
  4469. return cmpStr$3(actual, 0, actual.length, expected);
  4470. }
  4471. function eqStrAny(actual, expected) {
  4472. for (var i = 0; i < expected.length; i++) {
  4473. if (eqStr(actual, expected[i])) {
  4474. return true;
  4475. }
  4476. }
  4477. return false;
  4478. }
  4479. // IE postfix hack, i.e. 123\0 or 123px\9
  4480. function isPostfixIeHack(str, offset) {
  4481. if (offset !== str.length - 2) {
  4482. return false;
  4483. }
  4484. return (
  4485. str.charCodeAt(offset) === 0x005C && // U+005C REVERSE SOLIDUS (\)
  4486. isDigit$3(str.charCodeAt(offset + 1))
  4487. );
  4488. }
  4489. function outOfRange(opts, value, numEnd) {
  4490. if (opts && opts.type === 'Range') {
  4491. var num = Number(
  4492. numEnd !== undefined && numEnd !== value.length
  4493. ? value.substr(0, numEnd)
  4494. : value
  4495. );
  4496. if (isNaN(num)) {
  4497. return true;
  4498. }
  4499. if (opts.min !== null && num < opts.min) {
  4500. return true;
  4501. }
  4502. if (opts.max !== null && num > opts.max) {
  4503. return true;
  4504. }
  4505. }
  4506. return false;
  4507. }
  4508. function consumeFunction(token, getNextToken) {
  4509. var startIdx = token.index;
  4510. var length = 0;
  4511. // balanced token consuming
  4512. do {
  4513. length++;
  4514. if (token.balance <= startIdx) {
  4515. break;
  4516. }
  4517. } while (token = getNextToken(length));
  4518. return length;
  4519. }
  4520. // TODO: implement
  4521. // can be used wherever <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> values are allowed
  4522. // https://drafts.csswg.org/css-values/#calc-notation
  4523. function calc(next) {
  4524. return function(token, getNextToken, opts) {
  4525. if (token === null) {
  4526. return 0;
  4527. }
  4528. if (token.type === TYPE$5.Function && eqStrAny(token.value, calcFunctionNames)) {
  4529. return consumeFunction(token, getNextToken);
  4530. }
  4531. return next(token, getNextToken, opts);
  4532. };
  4533. }
  4534. function tokenType(expectedTokenType) {
  4535. return function(token) {
  4536. if (token === null || token.type !== expectedTokenType) {
  4537. return 0;
  4538. }
  4539. return 1;
  4540. };
  4541. }
  4542. function func(name) {
  4543. name = name + '(';
  4544. return function(token, getNextToken) {
  4545. if (token !== null && eqStr(token.value, name)) {
  4546. return consumeFunction(token, getNextToken);
  4547. }
  4548. return 0;
  4549. };
  4550. }
  4551. // =========================
  4552. // Complex types
  4553. //
  4554. // https://drafts.csswg.org/css-values-4/#custom-idents
  4555. // 4.2. Author-defined Identifiers: the <custom-ident> type
  4556. // Some properties accept arbitrary author-defined identifiers as a component value.
  4557. // This generic data type is denoted by <custom-ident>, and represents any valid CSS identifier
  4558. // that would not be misinterpreted as a pre-defined keyword in that property’s value definition.
  4559. //
  4560. // See also: https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident
  4561. function customIdent(token) {
  4562. if (token === null || token.type !== TYPE$5.Ident) {
  4563. return 0;
  4564. }
  4565. var name = token.value.toLowerCase();
  4566. // The CSS-wide keywords are not valid <custom-ident>s
  4567. if (eqStrAny(name, cssWideKeywords)) {
  4568. return 0;
  4569. }
  4570. // The default keyword is reserved and is also not a valid <custom-ident>
  4571. if (eqStr(name, 'default')) {
  4572. return 0;
  4573. }
  4574. // TODO: ignore property specific keywords (as described https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident)
  4575. // Specifications using <custom-ident> must specify clearly what other keywords
  4576. // are excluded from <custom-ident>, if any—for example by saying that any pre-defined keywords
  4577. // in that property’s value definition are excluded. Excluded keywords are excluded
  4578. // in all ASCII case permutations.
  4579. return 1;
  4580. }
  4581. // https://drafts.csswg.org/css-variables/#typedef-custom-property-name
  4582. // A custom property is any property whose name starts with two dashes (U+002D HYPHEN-MINUS), like --foo.
  4583. // The <custom-property-name> production corresponds to this: it’s defined as any valid identifier
  4584. // that starts with two dashes, except -- itself, which is reserved for future use by CSS.
  4585. // NOTE: Current implementation treat `--` as a valid name since most (all?) major browsers treat it as valid.
  4586. function customPropertyName(token) {
  4587. // ... defined as any valid identifier
  4588. if (token === null || token.type !== TYPE$5.Ident) {
  4589. return 0;
  4590. }
  4591. // ... that starts with two dashes (U+002D HYPHEN-MINUS)
  4592. if (charCode(token.value, 0) !== 0x002D || charCode(token.value, 1) !== 0x002D) {
  4593. return 0;
  4594. }
  4595. return 1;
  4596. }
  4597. // https://drafts.csswg.org/css-color-4/#hex-notation
  4598. // The syntax of a <hex-color> is a <hash-token> token whose value consists of 3, 4, 6, or 8 hexadecimal digits.
  4599. // In other words, a hex color is written as a hash character, "#", followed by some number of digits 0-9 or
  4600. // letters a-f (the case of the letters doesn’t matter - #00ff00 is identical to #00FF00).
  4601. function hexColor(token) {
  4602. if (token === null || token.type !== TYPE$5.Hash) {
  4603. return 0;
  4604. }
  4605. var length = token.value.length;
  4606. // valid values (length): #rgb (4), #rgba (5), #rrggbb (7), #rrggbbaa (9)
  4607. if (length !== 4 && length !== 5 && length !== 7 && length !== 9) {
  4608. return 0;
  4609. }
  4610. for (var i = 1; i < length; i++) {
  4611. if (!isHexDigit$3(token.value.charCodeAt(i))) {
  4612. return 0;
  4613. }
  4614. }
  4615. return 1;
  4616. }
  4617. function idSelector(token) {
  4618. if (token === null || token.type !== TYPE$5.Hash) {
  4619. return 0;
  4620. }
  4621. if (!isIdentifierStart$2(charCode(token.value, 1), charCode(token.value, 2), charCode(token.value, 3))) {
  4622. return 0;
  4623. }
  4624. return 1;
  4625. }
  4626. // https://drafts.csswg.org/css-syntax/#any-value
  4627. // It represents the entirety of what a valid declaration can have as its value.
  4628. function declarationValue(token, getNextToken) {
  4629. if (!token) {
  4630. return 0;
  4631. }
  4632. var length = 0;
  4633. var level = 0;
  4634. var startIdx = token.index;
  4635. // The <declaration-value> production matches any sequence of one or more tokens,
  4636. // so long as the sequence ...
  4637. scan:
  4638. do {
  4639. switch (token.type) {
  4640. // ... does not contain <bad-string-token>, <bad-url-token>,
  4641. case TYPE$5.BadString:
  4642. case TYPE$5.BadUrl:
  4643. break scan;
  4644. // ... unmatched <)-token>, <]-token>, or <}-token>,
  4645. case TYPE$5.RightCurlyBracket:
  4646. case TYPE$5.RightParenthesis:
  4647. case TYPE$5.RightSquareBracket:
  4648. if (token.balance > token.index || token.balance < startIdx) {
  4649. break scan;
  4650. }
  4651. level--;
  4652. break;
  4653. // ... or top-level <semicolon-token> tokens
  4654. case TYPE$5.Semicolon:
  4655. if (level === 0) {
  4656. break scan;
  4657. }
  4658. break;
  4659. // ... or <delim-token> tokens with a value of "!"
  4660. case TYPE$5.Delim:
  4661. if (token.value === '!' && level === 0) {
  4662. break scan;
  4663. }
  4664. break;
  4665. case TYPE$5.Function:
  4666. case TYPE$5.LeftParenthesis:
  4667. case TYPE$5.LeftSquareBracket:
  4668. case TYPE$5.LeftCurlyBracket:
  4669. level++;
  4670. break;
  4671. }
  4672. length++;
  4673. // until balance closing
  4674. if (token.balance <= startIdx) {
  4675. break;
  4676. }
  4677. } while (token = getNextToken(length));
  4678. return length;
  4679. }
  4680. // https://drafts.csswg.org/css-syntax/#any-value
  4681. // The <any-value> production is identical to <declaration-value>, but also
  4682. // allows top-level <semicolon-token> tokens and <delim-token> tokens
  4683. // with a value of "!". It represents the entirety of what valid CSS can be in any context.
  4684. function anyValue(token, getNextToken) {
  4685. if (!token) {
  4686. return 0;
  4687. }
  4688. var startIdx = token.index;
  4689. var length = 0;
  4690. // The <any-value> production matches any sequence of one or more tokens,
  4691. // so long as the sequence ...
  4692. scan:
  4693. do {
  4694. switch (token.type) {
  4695. // ... does not contain <bad-string-token>, <bad-url-token>,
  4696. case TYPE$5.BadString:
  4697. case TYPE$5.BadUrl:
  4698. break scan;
  4699. // ... unmatched <)-token>, <]-token>, or <}-token>,
  4700. case TYPE$5.RightCurlyBracket:
  4701. case TYPE$5.RightParenthesis:
  4702. case TYPE$5.RightSquareBracket:
  4703. if (token.balance > token.index || token.balance < startIdx) {
  4704. break scan;
  4705. }
  4706. break;
  4707. }
  4708. length++;
  4709. // until balance closing
  4710. if (token.balance <= startIdx) {
  4711. break;
  4712. }
  4713. } while (token = getNextToken(length));
  4714. return length;
  4715. }
  4716. // =========================
  4717. // Dimensions
  4718. //
  4719. function dimension(type) {
  4720. return function(token, getNextToken, opts) {
  4721. if (token === null || token.type !== TYPE$5.Dimension) {
  4722. return 0;
  4723. }
  4724. var numberEnd = consumeNumber$2(token.value, 0);
  4725. // check unit
  4726. if (type !== null) {
  4727. // check for IE postfix hack, i.e. 123px\0 or 123px\9
  4728. var reverseSolidusOffset = token.value.indexOf('\\', numberEnd);
  4729. var unit = reverseSolidusOffset === -1 || !isPostfixIeHack(token.value, reverseSolidusOffset)
  4730. ? token.value.substr(numberEnd)
  4731. : token.value.substring(numberEnd, reverseSolidusOffset);
  4732. if (type.hasOwnProperty(unit.toLowerCase()) === false) {
  4733. return 0;
  4734. }
  4735. }
  4736. // check range if specified
  4737. if (outOfRange(opts, token.value, numberEnd)) {
  4738. return 0;
  4739. }
  4740. return 1;
  4741. };
  4742. }
  4743. // =========================
  4744. // Percentage
  4745. //
  4746. // §5.5. Percentages: the <percentage> type
  4747. // https://drafts.csswg.org/css-values-4/#percentages
  4748. function percentage(token, getNextToken, opts) {
  4749. // ... corresponds to the <percentage-token> production
  4750. if (token === null || token.type !== TYPE$5.Percentage) {
  4751. return 0;
  4752. }
  4753. // check range if specified
  4754. if (outOfRange(opts, token.value, token.value.length - 1)) {
  4755. return 0;
  4756. }
  4757. return 1;
  4758. }
  4759. // =========================
  4760. // Numeric
  4761. //
  4762. // https://drafts.csswg.org/css-values-4/#numbers
  4763. // The value <zero> represents a literal number with the value 0. Expressions that merely
  4764. // evaluate to a <number> with the value 0 (for example, calc(0)) do not match <zero>;
  4765. // only literal <number-token>s do.
  4766. function zero(next) {
  4767. if (typeof next !== 'function') {
  4768. next = function() {
  4769. return 0;
  4770. };
  4771. }
  4772. return function(token, getNextToken, opts) {
  4773. if (token !== null && token.type === TYPE$5.Number) {
  4774. if (Number(token.value) === 0) {
  4775. return 1;
  4776. }
  4777. }
  4778. return next(token, getNextToken, opts);
  4779. };
  4780. }
  4781. // § 5.3. Real Numbers: the <number> type
  4782. // https://drafts.csswg.org/css-values-4/#numbers
  4783. // Number values are denoted by <number>, and represent real numbers, possibly with a fractional component.
  4784. // ... It corresponds to the <number-token> production
  4785. function number(token, getNextToken, opts) {
  4786. if (token === null) {
  4787. return 0;
  4788. }
  4789. var numberEnd = consumeNumber$2(token.value, 0);
  4790. var isNumber = numberEnd === token.value.length;
  4791. if (!isNumber && !isPostfixIeHack(token.value, numberEnd)) {
  4792. return 0;
  4793. }
  4794. // check range if specified
  4795. if (outOfRange(opts, token.value, numberEnd)) {
  4796. return 0;
  4797. }
  4798. return 1;
  4799. }
  4800. // §5.2. Integers: the <integer> type
  4801. // https://drafts.csswg.org/css-values-4/#integers
  4802. function integer(token, getNextToken, opts) {
  4803. // ... corresponds to a subset of the <number-token> production
  4804. if (token === null || token.type !== TYPE$5.Number) {
  4805. return 0;
  4806. }
  4807. // The first digit of an integer may be immediately preceded by `-` or `+` to indicate the integer’s sign.
  4808. var i = token.value.charCodeAt(0) === 0x002B || // U+002B PLUS SIGN (+)
  4809. token.value.charCodeAt(0) === 0x002D ? 1 : 0; // U+002D HYPHEN-MINUS (-)
  4810. // When written literally, an integer is one or more decimal digits 0 through 9 ...
  4811. for (; i < token.value.length; i++) {
  4812. if (!isDigit$3(token.value.charCodeAt(i))) {
  4813. return 0;
  4814. }
  4815. }
  4816. // check range if specified
  4817. if (outOfRange(opts, token.value, i)) {
  4818. return 0;
  4819. }
  4820. return 1;
  4821. }
  4822. var generic = {
  4823. // token types
  4824. 'ident-token': tokenType(TYPE$5.Ident),
  4825. 'function-token': tokenType(TYPE$5.Function),
  4826. 'at-keyword-token': tokenType(TYPE$5.AtKeyword),
  4827. 'hash-token': tokenType(TYPE$5.Hash),
  4828. 'string-token': tokenType(TYPE$5.String),
  4829. 'bad-string-token': tokenType(TYPE$5.BadString),
  4830. 'url-token': tokenType(TYPE$5.Url),
  4831. 'bad-url-token': tokenType(TYPE$5.BadUrl),
  4832. 'delim-token': tokenType(TYPE$5.Delim),
  4833. 'number-token': tokenType(TYPE$5.Number),
  4834. 'percentage-token': tokenType(TYPE$5.Percentage),
  4835. 'dimension-token': tokenType(TYPE$5.Dimension),
  4836. 'whitespace-token': tokenType(TYPE$5.WhiteSpace),
  4837. 'CDO-token': tokenType(TYPE$5.CDO),
  4838. 'CDC-token': tokenType(TYPE$5.CDC),
  4839. 'colon-token': tokenType(TYPE$5.Colon),
  4840. 'semicolon-token': tokenType(TYPE$5.Semicolon),
  4841. 'comma-token': tokenType(TYPE$5.Comma),
  4842. '[-token': tokenType(TYPE$5.LeftSquareBracket),
  4843. ']-token': tokenType(TYPE$5.RightSquareBracket),
  4844. '(-token': tokenType(TYPE$5.LeftParenthesis),
  4845. ')-token': tokenType(TYPE$5.RightParenthesis),
  4846. '{-token': tokenType(TYPE$5.LeftCurlyBracket),
  4847. '}-token': tokenType(TYPE$5.RightCurlyBracket),
  4848. // token type aliases
  4849. 'string': tokenType(TYPE$5.String),
  4850. 'ident': tokenType(TYPE$5.Ident),
  4851. // complex types
  4852. 'custom-ident': customIdent,
  4853. 'custom-property-name': customPropertyName,
  4854. 'hex-color': hexColor,
  4855. 'id-selector': idSelector, // element( <id-selector> )
  4856. 'an-plus-b': genericAnPlusB,
  4857. 'urange': genericUrange,
  4858. 'declaration-value': declarationValue,
  4859. 'any-value': anyValue,
  4860. // dimensions
  4861. 'dimension': calc(dimension(null)),
  4862. 'angle': calc(dimension(ANGLE)),
  4863. 'decibel': calc(dimension(DECIBEL)),
  4864. 'frequency': calc(dimension(FREQUENCY)),
  4865. 'flex': calc(dimension(FLEX)),
  4866. 'length': calc(zero(dimension(LENGTH))),
  4867. 'resolution': calc(dimension(RESOLUTION)),
  4868. 'semitones': calc(dimension(SEMITONES)),
  4869. 'time': calc(dimension(TIME)),
  4870. // percentage
  4871. 'percentage': calc(percentage),
  4872. // numeric
  4873. 'zero': zero(),
  4874. 'number': calc(number),
  4875. 'integer': calc(integer),
  4876. // old IE stuff
  4877. '-ms-legacy-expression': func('expression')
  4878. };
  4879. var _SyntaxError$1 = function SyntaxError(message, input, offset) {
  4880. var error = createCustomError('SyntaxError', message);
  4881. error.input = input;
  4882. error.offset = offset;
  4883. error.rawMessage = message;
  4884. error.message = error.rawMessage + '\n' +
  4885. ' ' + error.input + '\n' +
  4886. '--' + new Array((error.offset || error.input.length) + 1).join('-') + '^';
  4887. return error;
  4888. };
  4889. var TAB = 9;
  4890. var N$1 = 10;
  4891. var F = 12;
  4892. var R = 13;
  4893. var SPACE = 32;
  4894. var Tokenizer = function(str) {
  4895. this.str = str;
  4896. this.pos = 0;
  4897. };
  4898. Tokenizer.prototype = {
  4899. charCodeAt: function(pos) {
  4900. return pos < this.str.length ? this.str.charCodeAt(pos) : 0;
  4901. },
  4902. charCode: function() {
  4903. return this.charCodeAt(this.pos);
  4904. },
  4905. nextCharCode: function() {
  4906. return this.charCodeAt(this.pos + 1);
  4907. },
  4908. nextNonWsCode: function(pos) {
  4909. return this.charCodeAt(this.findWsEnd(pos));
  4910. },
  4911. findWsEnd: function(pos) {
  4912. for (; pos < this.str.length; pos++) {
  4913. var code = this.str.charCodeAt(pos);
  4914. if (code !== R && code !== N$1 && code !== F && code !== SPACE && code !== TAB) {
  4915. break;
  4916. }
  4917. }
  4918. return pos;
  4919. },
  4920. substringToPos: function(end) {
  4921. return this.str.substring(this.pos, this.pos = end);
  4922. },
  4923. eat: function(code) {
  4924. if (this.charCode() !== code) {
  4925. this.error('Expect `' + String.fromCharCode(code) + '`');
  4926. }
  4927. this.pos++;
  4928. },
  4929. peek: function() {
  4930. return this.pos < this.str.length ? this.str.charAt(this.pos++) : '';
  4931. },
  4932. error: function(message) {
  4933. throw new _SyntaxError$1(message, this.str, this.pos);
  4934. }
  4935. };
  4936. var tokenizer$1 = Tokenizer;
  4937. var TAB$1 = 9;
  4938. var N$2 = 10;
  4939. var F$1 = 12;
  4940. var R$1 = 13;
  4941. var SPACE$1 = 32;
  4942. var EXCLAMATIONMARK = 33; // !
  4943. var NUMBERSIGN = 35; // #
  4944. var AMPERSAND = 38; // &
  4945. var APOSTROPHE = 39; // '
  4946. var LEFTPARENTHESIS = 40; // (
  4947. var RIGHTPARENTHESIS = 41; // )
  4948. var ASTERISK = 42; // *
  4949. var PLUSSIGN$2 = 43; // +
  4950. var COMMA = 44; // ,
  4951. var HYPERMINUS = 45; // -
  4952. var LESSTHANSIGN = 60; // <
  4953. var GREATERTHANSIGN = 62; // >
  4954. var QUESTIONMARK$1 = 63; // ?
  4955. var COMMERCIALAT = 64; // @
  4956. var LEFTSQUAREBRACKET = 91; // [
  4957. var RIGHTSQUAREBRACKET = 93; // ]
  4958. var LEFTCURLYBRACKET = 123; // {
  4959. var VERTICALLINE = 124; // |
  4960. var RIGHTCURLYBRACKET = 125; // }
  4961. var INFINITY = 8734; // ∞
  4962. var NAME_CHAR = createCharMap(function(ch) {
  4963. return /[a-zA-Z0-9\-]/.test(ch);
  4964. });
  4965. var COMBINATOR_PRECEDENCE = {
  4966. ' ': 1,
  4967. '&&': 2,
  4968. '||': 3,
  4969. '|': 4
  4970. };
  4971. function createCharMap(fn) {
  4972. var array = typeof Uint32Array === 'function' ? new Uint32Array(128) : new Array(128);
  4973. for (var i = 0; i < 128; i++) {
  4974. array[i] = fn(String.fromCharCode(i)) ? 1 : 0;
  4975. }
  4976. return array;
  4977. }
  4978. function scanSpaces(tokenizer) {
  4979. return tokenizer.substringToPos(
  4980. tokenizer.findWsEnd(tokenizer.pos)
  4981. );
  4982. }
  4983. function scanWord(tokenizer) {
  4984. var end = tokenizer.pos;
  4985. for (; end < tokenizer.str.length; end++) {
  4986. var code = tokenizer.str.charCodeAt(end);
  4987. if (code >= 128 || NAME_CHAR[code] === 0) {
  4988. break;
  4989. }
  4990. }
  4991. if (tokenizer.pos === end) {
  4992. tokenizer.error('Expect a keyword');
  4993. }
  4994. return tokenizer.substringToPos(end);
  4995. }
  4996. function scanNumber(tokenizer) {
  4997. var end = tokenizer.pos;
  4998. for (; end < tokenizer.str.length; end++) {
  4999. var code = tokenizer.str.charCodeAt(end);
  5000. if (code < 48 || code > 57) {
  5001. break;
  5002. }
  5003. }
  5004. if (tokenizer.pos === end) {
  5005. tokenizer.error('Expect a number');
  5006. }
  5007. return tokenizer.substringToPos(end);
  5008. }
  5009. function scanString(tokenizer) {
  5010. var end = tokenizer.str.indexOf('\'', tokenizer.pos + 1);
  5011. if (end === -1) {
  5012. tokenizer.pos = tokenizer.str.length;
  5013. tokenizer.error('Expect an apostrophe');
  5014. }
  5015. return tokenizer.substringToPos(end + 1);
  5016. }
  5017. function readMultiplierRange(tokenizer) {
  5018. var min = null;
  5019. var max = null;
  5020. tokenizer.eat(LEFTCURLYBRACKET);
  5021. min = scanNumber(tokenizer);
  5022. if (tokenizer.charCode() === COMMA) {
  5023. tokenizer.pos++;
  5024. if (tokenizer.charCode() !== RIGHTCURLYBRACKET) {
  5025. max = scanNumber(tokenizer);
  5026. }
  5027. } else {
  5028. max = min;
  5029. }
  5030. tokenizer.eat(RIGHTCURLYBRACKET);
  5031. return {
  5032. min: Number(min),
  5033. max: max ? Number(max) : 0
  5034. };
  5035. }
  5036. function readMultiplier(tokenizer) {
  5037. var range = null;
  5038. var comma = false;
  5039. switch (tokenizer.charCode()) {
  5040. case ASTERISK:
  5041. tokenizer.pos++;
  5042. range = {
  5043. min: 0,
  5044. max: 0
  5045. };
  5046. break;
  5047. case PLUSSIGN$2:
  5048. tokenizer.pos++;
  5049. range = {
  5050. min: 1,
  5051. max: 0
  5052. };
  5053. break;
  5054. case QUESTIONMARK$1:
  5055. tokenizer.pos++;
  5056. range = {
  5057. min: 0,
  5058. max: 1
  5059. };
  5060. break;
  5061. case NUMBERSIGN:
  5062. tokenizer.pos++;
  5063. comma = true;
  5064. if (tokenizer.charCode() === LEFTCURLYBRACKET) {
  5065. range = readMultiplierRange(tokenizer);
  5066. } else {
  5067. range = {
  5068. min: 1,
  5069. max: 0
  5070. };
  5071. }
  5072. break;
  5073. case LEFTCURLYBRACKET:
  5074. range = readMultiplierRange(tokenizer);
  5075. break;
  5076. default:
  5077. return null;
  5078. }
  5079. return {
  5080. type: 'Multiplier',
  5081. comma: comma,
  5082. min: range.min,
  5083. max: range.max,
  5084. term: null
  5085. };
  5086. }
  5087. function maybeMultiplied(tokenizer, node) {
  5088. var multiplier = readMultiplier(tokenizer);
  5089. if (multiplier !== null) {
  5090. multiplier.term = node;
  5091. return multiplier;
  5092. }
  5093. return node;
  5094. }
  5095. function maybeToken(tokenizer) {
  5096. var ch = tokenizer.peek();
  5097. if (ch === '') {
  5098. return null;
  5099. }
  5100. return {
  5101. type: 'Token',
  5102. value: ch
  5103. };
  5104. }
  5105. function readProperty(tokenizer) {
  5106. var name;
  5107. tokenizer.eat(LESSTHANSIGN);
  5108. tokenizer.eat(APOSTROPHE);
  5109. name = scanWord(tokenizer);
  5110. tokenizer.eat(APOSTROPHE);
  5111. tokenizer.eat(GREATERTHANSIGN);
  5112. return maybeMultiplied(tokenizer, {
  5113. type: 'Property',
  5114. name: name
  5115. });
  5116. }
  5117. // https://drafts.csswg.org/css-values-3/#numeric-ranges
  5118. // 4.1. Range Restrictions and Range Definition Notation
  5119. //
  5120. // Range restrictions can be annotated in the numeric type notation using CSS bracketed
  5121. // range notation—[min,max]—within the angle brackets, after the identifying keyword,
  5122. // indicating a closed range between (and including) min and max.
  5123. // For example, <integer [0, 10]> indicates an integer between 0 and 10, inclusive.
  5124. function readTypeRange(tokenizer) {
  5125. // use null for Infinity to make AST format JSON serializable/deserializable
  5126. var min = null; // -Infinity
  5127. var max = null; // Infinity
  5128. var sign = 1;
  5129. tokenizer.eat(LEFTSQUAREBRACKET);
  5130. if (tokenizer.charCode() === HYPERMINUS) {
  5131. tokenizer.peek();
  5132. sign = -1;
  5133. }
  5134. if (sign == -1 && tokenizer.charCode() === INFINITY) {
  5135. tokenizer.peek();
  5136. } else {
  5137. min = sign * Number(scanNumber(tokenizer));
  5138. }
  5139. scanSpaces(tokenizer);
  5140. tokenizer.eat(COMMA);
  5141. scanSpaces(tokenizer);
  5142. if (tokenizer.charCode() === INFINITY) {
  5143. tokenizer.peek();
  5144. } else {
  5145. sign = 1;
  5146. if (tokenizer.charCode() === HYPERMINUS) {
  5147. tokenizer.peek();
  5148. sign = -1;
  5149. }
  5150. max = sign * Number(scanNumber(tokenizer));
  5151. }
  5152. tokenizer.eat(RIGHTSQUAREBRACKET);
  5153. // If no range is indicated, either by using the bracketed range notation
  5154. // or in the property description, then [−∞,∞] is assumed.
  5155. if (min === null && max === null) {
  5156. return null;
  5157. }
  5158. return {
  5159. type: 'Range',
  5160. min: min,
  5161. max: max
  5162. };
  5163. }
  5164. function readType(tokenizer) {
  5165. var name;
  5166. var opts = null;
  5167. tokenizer.eat(LESSTHANSIGN);
  5168. name = scanWord(tokenizer);
  5169. if (tokenizer.charCode() === LEFTPARENTHESIS &&
  5170. tokenizer.nextCharCode() === RIGHTPARENTHESIS) {
  5171. tokenizer.pos += 2;
  5172. name += '()';
  5173. }
  5174. if (tokenizer.charCodeAt(tokenizer.findWsEnd(tokenizer.pos)) === LEFTSQUAREBRACKET) {
  5175. scanSpaces(tokenizer);
  5176. opts = readTypeRange(tokenizer);
  5177. }
  5178. tokenizer.eat(GREATERTHANSIGN);
  5179. return maybeMultiplied(tokenizer, {
  5180. type: 'Type',
  5181. name: name,
  5182. opts: opts
  5183. });
  5184. }
  5185. function readKeywordOrFunction(tokenizer) {
  5186. var name;
  5187. name = scanWord(tokenizer);
  5188. if (tokenizer.charCode() === LEFTPARENTHESIS) {
  5189. tokenizer.pos++;
  5190. return {
  5191. type: 'Function',
  5192. name: name
  5193. };
  5194. }
  5195. return maybeMultiplied(tokenizer, {
  5196. type: 'Keyword',
  5197. name: name
  5198. });
  5199. }
  5200. function regroupTerms(terms, combinators) {
  5201. function createGroup(terms, combinator) {
  5202. return {
  5203. type: 'Group',
  5204. terms: terms,
  5205. combinator: combinator,
  5206. disallowEmpty: false,
  5207. explicit: false
  5208. };
  5209. }
  5210. combinators = Object.keys(combinators).sort(function(a, b) {
  5211. return COMBINATOR_PRECEDENCE[a] - COMBINATOR_PRECEDENCE[b];
  5212. });
  5213. while (combinators.length > 0) {
  5214. var combinator = combinators.shift();
  5215. for (var i = 0, subgroupStart = 0; i < terms.length; i++) {
  5216. var term = terms[i];
  5217. if (term.type === 'Combinator') {
  5218. if (term.value === combinator) {
  5219. if (subgroupStart === -1) {
  5220. subgroupStart = i - 1;
  5221. }
  5222. terms.splice(i, 1);
  5223. i--;
  5224. } else {
  5225. if (subgroupStart !== -1 && i - subgroupStart > 1) {
  5226. terms.splice(
  5227. subgroupStart,
  5228. i - subgroupStart,
  5229. createGroup(terms.slice(subgroupStart, i), combinator)
  5230. );
  5231. i = subgroupStart + 1;
  5232. }
  5233. subgroupStart = -1;
  5234. }
  5235. }
  5236. }
  5237. if (subgroupStart !== -1 && combinators.length) {
  5238. terms.splice(
  5239. subgroupStart,
  5240. i - subgroupStart,
  5241. createGroup(terms.slice(subgroupStart, i), combinator)
  5242. );
  5243. }
  5244. }
  5245. return combinator;
  5246. }
  5247. function readImplicitGroup(tokenizer) {
  5248. var terms = [];
  5249. var combinators = {};
  5250. var token;
  5251. var prevToken = null;
  5252. var prevTokenPos = tokenizer.pos;
  5253. while (token = peek(tokenizer)) {
  5254. if (token.type !== 'Spaces') {
  5255. if (token.type === 'Combinator') {
  5256. // check for combinator in group beginning and double combinator sequence
  5257. if (prevToken === null || prevToken.type === 'Combinator') {
  5258. tokenizer.pos = prevTokenPos;
  5259. tokenizer.error('Unexpected combinator');
  5260. }
  5261. combinators[token.value] = true;
  5262. } else if (prevToken !== null && prevToken.type !== 'Combinator') {
  5263. combinators[' '] = true; // a b
  5264. terms.push({
  5265. type: 'Combinator',
  5266. value: ' '
  5267. });
  5268. }
  5269. terms.push(token);
  5270. prevToken = token;
  5271. prevTokenPos = tokenizer.pos;
  5272. }
  5273. }
  5274. // check for combinator in group ending
  5275. if (prevToken !== null && prevToken.type === 'Combinator') {
  5276. tokenizer.pos -= prevTokenPos;
  5277. tokenizer.error('Unexpected combinator');
  5278. }
  5279. return {
  5280. type: 'Group',
  5281. terms: terms,
  5282. combinator: regroupTerms(terms, combinators) || ' ',
  5283. disallowEmpty: false,
  5284. explicit: false
  5285. };
  5286. }
  5287. function readGroup(tokenizer) {
  5288. var result;
  5289. tokenizer.eat(LEFTSQUAREBRACKET);
  5290. result = readImplicitGroup(tokenizer);
  5291. tokenizer.eat(RIGHTSQUAREBRACKET);
  5292. result.explicit = true;
  5293. if (tokenizer.charCode() === EXCLAMATIONMARK) {
  5294. tokenizer.pos++;
  5295. result.disallowEmpty = true;
  5296. }
  5297. return result;
  5298. }
  5299. function peek(tokenizer) {
  5300. var code = tokenizer.charCode();
  5301. if (code < 128 && NAME_CHAR[code] === 1) {
  5302. return readKeywordOrFunction(tokenizer);
  5303. }
  5304. switch (code) {
  5305. case RIGHTSQUAREBRACKET:
  5306. // don't eat, stop scan a group
  5307. break;
  5308. case LEFTSQUAREBRACKET:
  5309. return maybeMultiplied(tokenizer, readGroup(tokenizer));
  5310. case LESSTHANSIGN:
  5311. return tokenizer.nextCharCode() === APOSTROPHE
  5312. ? readProperty(tokenizer)
  5313. : readType(tokenizer);
  5314. case VERTICALLINE:
  5315. return {
  5316. type: 'Combinator',
  5317. value: tokenizer.substringToPos(
  5318. tokenizer.nextCharCode() === VERTICALLINE
  5319. ? tokenizer.pos + 2
  5320. : tokenizer.pos + 1
  5321. )
  5322. };
  5323. case AMPERSAND:
  5324. tokenizer.pos++;
  5325. tokenizer.eat(AMPERSAND);
  5326. return {
  5327. type: 'Combinator',
  5328. value: '&&'
  5329. };
  5330. case COMMA:
  5331. tokenizer.pos++;
  5332. return {
  5333. type: 'Comma'
  5334. };
  5335. case APOSTROPHE:
  5336. return maybeMultiplied(tokenizer, {
  5337. type: 'String',
  5338. value: scanString(tokenizer)
  5339. });
  5340. case SPACE$1:
  5341. case TAB$1:
  5342. case N$2:
  5343. case R$1:
  5344. case F$1:
  5345. return {
  5346. type: 'Spaces',
  5347. value: scanSpaces(tokenizer)
  5348. };
  5349. case COMMERCIALAT:
  5350. code = tokenizer.nextCharCode();
  5351. if (code < 128 && NAME_CHAR[code] === 1) {
  5352. tokenizer.pos++;
  5353. return {
  5354. type: 'AtKeyword',
  5355. name: scanWord(tokenizer)
  5356. };
  5357. }
  5358. return maybeToken(tokenizer);
  5359. case ASTERISK:
  5360. case PLUSSIGN$2:
  5361. case QUESTIONMARK$1:
  5362. case NUMBERSIGN:
  5363. case EXCLAMATIONMARK:
  5364. // prohibited tokens (used as a multiplier start)
  5365. break;
  5366. case LEFTCURLYBRACKET:
  5367. // LEFTCURLYBRACKET is allowed since mdn/data uses it w/o quoting
  5368. // check next char isn't a number, because it's likely a disjoined multiplier
  5369. code = tokenizer.nextCharCode();
  5370. if (code < 48 || code > 57) {
  5371. return maybeToken(tokenizer);
  5372. }
  5373. break;
  5374. default:
  5375. return maybeToken(tokenizer);
  5376. }
  5377. }
  5378. function parse(source) {
  5379. var tokenizer = new tokenizer$1(source);
  5380. var result = readImplicitGroup(tokenizer);
  5381. if (tokenizer.pos !== source.length) {
  5382. tokenizer.error('Unexpected input');
  5383. }
  5384. // reduce redundant groups with single group term
  5385. if (result.terms.length === 1 && result.terms[0].type === 'Group') {
  5386. result = result.terms[0];
  5387. }
  5388. return result;
  5389. }
  5390. // warm up parse to elimitate code branches that never execute
  5391. // fix soft deoptimizations (insufficient type feedback)
  5392. parse('[a&&<b>#|<\'c\'>*||e() f{2} /,(% g#{1,2} h{2,})]!');
  5393. var parse_1 = parse;
  5394. var noop$2 = function() {};
  5395. function ensureFunction(value) {
  5396. return typeof value === 'function' ? value : noop$2;
  5397. }
  5398. var walk$1 = function(node, options, context) {
  5399. function walk(node) {
  5400. enter.call(context, node);
  5401. switch (node.type) {
  5402. case 'Group':
  5403. node.terms.forEach(walk);
  5404. break;
  5405. case 'Multiplier':
  5406. walk(node.term);
  5407. break;
  5408. case 'Type':
  5409. case 'Property':
  5410. case 'Keyword':
  5411. case 'AtKeyword':
  5412. case 'Function':
  5413. case 'String':
  5414. case 'Token':
  5415. case 'Comma':
  5416. break;
  5417. default:
  5418. throw new Error('Unknown type: ' + node.type);
  5419. }
  5420. leave.call(context, node);
  5421. }
  5422. var enter = noop$2;
  5423. var leave = noop$2;
  5424. if (typeof options === 'function') {
  5425. enter = options;
  5426. } else if (options) {
  5427. enter = ensureFunction(options.enter);
  5428. leave = ensureFunction(options.leave);
  5429. }
  5430. if (enter === noop$2 && leave === noop$2) {
  5431. throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
  5432. }
  5433. walk(node);
  5434. };
  5435. var tokenStream = new TokenStream_1();
  5436. var astToTokens = {
  5437. decorator: function(handlers) {
  5438. var curNode = null;
  5439. var prev = { len: 0, node: null };
  5440. var nodes = [prev];
  5441. var buffer = '';
  5442. return {
  5443. children: handlers.children,
  5444. node: function(node) {
  5445. var tmp = curNode;
  5446. curNode = node;
  5447. handlers.node.call(this, node);
  5448. curNode = tmp;
  5449. },
  5450. chunk: function(chunk) {
  5451. buffer += chunk;
  5452. if (prev.node !== curNode) {
  5453. nodes.push({
  5454. len: chunk.length,
  5455. node: curNode
  5456. });
  5457. } else {
  5458. prev.len += chunk.length;
  5459. }
  5460. },
  5461. result: function() {
  5462. return prepareTokens(buffer, nodes);
  5463. }
  5464. };
  5465. }
  5466. };
  5467. function prepareTokens(str, nodes) {
  5468. var tokens = [];
  5469. var nodesOffset = 0;
  5470. var nodesIndex = 0;
  5471. var currentNode = nodes ? nodes[nodesIndex].node : null;
  5472. tokenizer(str, tokenStream);
  5473. while (!tokenStream.eof) {
  5474. if (nodes) {
  5475. while (nodesIndex < nodes.length && nodesOffset + nodes[nodesIndex].len <= tokenStream.tokenStart) {
  5476. nodesOffset += nodes[nodesIndex++].len;
  5477. currentNode = nodes[nodesIndex].node;
  5478. }
  5479. }
  5480. tokens.push({
  5481. type: tokenStream.tokenType,
  5482. value: tokenStream.getTokenValue(),
  5483. index: tokenStream.tokenIndex, // TODO: remove it, temporary solution
  5484. balance: tokenStream.balance[tokenStream.tokenIndex], // TODO: remove it, temporary solution
  5485. node: currentNode
  5486. });
  5487. tokenStream.next();
  5488. // console.log({ ...tokens[tokens.length - 1], node: undefined });
  5489. }
  5490. return tokens;
  5491. }
  5492. var prepareTokens_1 = function(value, syntax) {
  5493. if (typeof value === 'string') {
  5494. return prepareTokens(value, null);
  5495. }
  5496. return syntax.generate(value, astToTokens);
  5497. };
  5498. var MATCH = { type: 'Match' };
  5499. var MISMATCH = { type: 'Mismatch' };
  5500. var DISALLOW_EMPTY = { type: 'DisallowEmpty' };
  5501. var LEFTPARENTHESIS$1 = 40; // (
  5502. var RIGHTPARENTHESIS$1 = 41; // )
  5503. function createCondition(match, thenBranch, elseBranch) {
  5504. // reduce node count
  5505. if (thenBranch === MATCH && elseBranch === MISMATCH) {
  5506. return match;
  5507. }
  5508. if (match === MATCH && thenBranch === MATCH && elseBranch === MATCH) {
  5509. return match;
  5510. }
  5511. if (match.type === 'If' && match.else === MISMATCH && thenBranch === MATCH) {
  5512. thenBranch = match.then;
  5513. match = match.match;
  5514. }
  5515. return {
  5516. type: 'If',
  5517. match: match,
  5518. then: thenBranch,
  5519. else: elseBranch
  5520. };
  5521. }
  5522. function isFunctionType(name) {
  5523. return (
  5524. name.length > 2 &&
  5525. name.charCodeAt(name.length - 2) === LEFTPARENTHESIS$1 &&
  5526. name.charCodeAt(name.length - 1) === RIGHTPARENTHESIS$1
  5527. );
  5528. }
  5529. function isEnumCapatible(term) {
  5530. return (
  5531. term.type === 'Keyword' ||
  5532. term.type === 'AtKeyword' ||
  5533. term.type === 'Function' ||
  5534. term.type === 'Type' && isFunctionType(term.name)
  5535. );
  5536. }
  5537. function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
  5538. switch (combinator) {
  5539. case ' ':
  5540. // Juxtaposing components means that all of them must occur, in the given order.
  5541. //
  5542. // a b c
  5543. // =
  5544. // match a
  5545. // then match b
  5546. // then match c
  5547. // then MATCH
  5548. // else MISMATCH
  5549. // else MISMATCH
  5550. // else MISMATCH
  5551. var result = MATCH;
  5552. for (var i = terms.length - 1; i >= 0; i--) {
  5553. var term = terms[i];
  5554. result = createCondition(
  5555. term,
  5556. result,
  5557. MISMATCH
  5558. );
  5559. }
  5560. return result;
  5561. case '|':
  5562. // A bar (|) separates two or more alternatives: exactly one of them must occur.
  5563. //
  5564. // a | b | c
  5565. // =
  5566. // match a
  5567. // then MATCH
  5568. // else match b
  5569. // then MATCH
  5570. // else match c
  5571. // then MATCH
  5572. // else MISMATCH
  5573. var result = MISMATCH;
  5574. var map = null;
  5575. for (var i = terms.length - 1; i >= 0; i--) {
  5576. var term = terms[i];
  5577. // reduce sequence of keywords into a Enum
  5578. if (isEnumCapatible(term)) {
  5579. if (map === null && i > 0 && isEnumCapatible(terms[i - 1])) {
  5580. map = Object.create(null);
  5581. result = createCondition(
  5582. {
  5583. type: 'Enum',
  5584. map: map
  5585. },
  5586. MATCH,
  5587. result
  5588. );
  5589. }
  5590. if (map !== null) {
  5591. var key = (isFunctionType(term.name) ? term.name.slice(0, -1) : term.name).toLowerCase();
  5592. if (key in map === false) {
  5593. map[key] = term;
  5594. continue;
  5595. }
  5596. }
  5597. }
  5598. map = null;
  5599. // create a new conditonal node
  5600. result = createCondition(
  5601. term,
  5602. MATCH,
  5603. result
  5604. );
  5605. }
  5606. return result;
  5607. case '&&':
  5608. // A double ampersand (&&) separates two or more components,
  5609. // all of which must occur, in any order.
  5610. // Use MatchOnce for groups with a large number of terms,
  5611. // since &&-groups produces at least N!-node trees
  5612. if (terms.length > 5) {
  5613. return {
  5614. type: 'MatchOnce',
  5615. terms: terms,
  5616. all: true
  5617. };
  5618. }
  5619. // Use a combination tree for groups with small number of terms
  5620. //
  5621. // a && b && c
  5622. // =
  5623. // match a
  5624. // then [b && c]
  5625. // else match b
  5626. // then [a && c]
  5627. // else match c
  5628. // then [a && b]
  5629. // else MISMATCH
  5630. //
  5631. // a && b
  5632. // =
  5633. // match a
  5634. // then match b
  5635. // then MATCH
  5636. // else MISMATCH
  5637. // else match b
  5638. // then match a
  5639. // then MATCH
  5640. // else MISMATCH
  5641. // else MISMATCH
  5642. var result = MISMATCH;
  5643. for (var i = terms.length - 1; i >= 0; i--) {
  5644. var term = terms[i];
  5645. var thenClause;
  5646. if (terms.length > 1) {
  5647. thenClause = buildGroupMatchGraph(
  5648. combinator,
  5649. terms.filter(function(newGroupTerm) {
  5650. return newGroupTerm !== term;
  5651. }),
  5652. false
  5653. );
  5654. } else {
  5655. thenClause = MATCH;
  5656. }
  5657. result = createCondition(
  5658. term,
  5659. thenClause,
  5660. result
  5661. );
  5662. }
  5663. return result;
  5664. case '||':
  5665. // A double bar (||) separates two or more options:
  5666. // one or more of them must occur, in any order.
  5667. // Use MatchOnce for groups with a large number of terms,
  5668. // since ||-groups produces at least N!-node trees
  5669. if (terms.length > 5) {
  5670. return {
  5671. type: 'MatchOnce',
  5672. terms: terms,
  5673. all: false
  5674. };
  5675. }
  5676. // Use a combination tree for groups with small number of terms
  5677. //
  5678. // a || b || c
  5679. // =
  5680. // match a
  5681. // then [b || c]
  5682. // else match b
  5683. // then [a || c]
  5684. // else match c
  5685. // then [a || b]
  5686. // else MISMATCH
  5687. //
  5688. // a || b
  5689. // =
  5690. // match a
  5691. // then match b
  5692. // then MATCH
  5693. // else MATCH
  5694. // else match b
  5695. // then match a
  5696. // then MATCH
  5697. // else MATCH
  5698. // else MISMATCH
  5699. var result = atLeastOneTermMatched ? MATCH : MISMATCH;
  5700. for (var i = terms.length - 1; i >= 0; i--) {
  5701. var term = terms[i];
  5702. var thenClause;
  5703. if (terms.length > 1) {
  5704. thenClause = buildGroupMatchGraph(
  5705. combinator,
  5706. terms.filter(function(newGroupTerm) {
  5707. return newGroupTerm !== term;
  5708. }),
  5709. true
  5710. );
  5711. } else {
  5712. thenClause = MATCH;
  5713. }
  5714. result = createCondition(
  5715. term,
  5716. thenClause,
  5717. result
  5718. );
  5719. }
  5720. return result;
  5721. }
  5722. }
  5723. function buildMultiplierMatchGraph(node) {
  5724. var result = MATCH;
  5725. var matchTerm = buildMatchGraph(node.term);
  5726. if (node.max === 0) {
  5727. // disable repeating of empty match to prevent infinite loop
  5728. matchTerm = createCondition(
  5729. matchTerm,
  5730. DISALLOW_EMPTY,
  5731. MISMATCH
  5732. );
  5733. // an occurrence count is not limited, make a cycle;
  5734. // to collect more terms on each following matching mismatch
  5735. result = createCondition(
  5736. matchTerm,
  5737. null, // will be a loop
  5738. MISMATCH
  5739. );
  5740. result.then = createCondition(
  5741. MATCH,
  5742. MATCH,
  5743. result // make a loop
  5744. );
  5745. if (node.comma) {
  5746. result.then.else = createCondition(
  5747. { type: 'Comma', syntax: node },
  5748. result,
  5749. MISMATCH
  5750. );
  5751. }
  5752. } else {
  5753. // create a match node chain for [min .. max] interval with optional matches
  5754. for (var i = node.min || 1; i <= node.max; i++) {
  5755. if (node.comma && result !== MATCH) {
  5756. result = createCondition(
  5757. { type: 'Comma', syntax: node },
  5758. result,
  5759. MISMATCH
  5760. );
  5761. }
  5762. result = createCondition(
  5763. matchTerm,
  5764. createCondition(
  5765. MATCH,
  5766. MATCH,
  5767. result
  5768. ),
  5769. MISMATCH
  5770. );
  5771. }
  5772. }
  5773. if (node.min === 0) {
  5774. // allow zero match
  5775. result = createCondition(
  5776. MATCH,
  5777. MATCH,
  5778. result
  5779. );
  5780. } else {
  5781. // create a match node chain to collect [0 ... min - 1] required matches
  5782. for (var i = 0; i < node.min - 1; i++) {
  5783. if (node.comma && result !== MATCH) {
  5784. result = createCondition(
  5785. { type: 'Comma', syntax: node },
  5786. result,
  5787. MISMATCH
  5788. );
  5789. }
  5790. result = createCondition(
  5791. matchTerm,
  5792. result,
  5793. MISMATCH
  5794. );
  5795. }
  5796. }
  5797. return result;
  5798. }
  5799. function buildMatchGraph(node) {
  5800. if (typeof node === 'function') {
  5801. return {
  5802. type: 'Generic',
  5803. fn: node
  5804. };
  5805. }
  5806. switch (node.type) {
  5807. case 'Group':
  5808. var result = buildGroupMatchGraph(
  5809. node.combinator,
  5810. node.terms.map(buildMatchGraph),
  5811. false
  5812. );
  5813. if (node.disallowEmpty) {
  5814. result = createCondition(
  5815. result,
  5816. DISALLOW_EMPTY,
  5817. MISMATCH
  5818. );
  5819. }
  5820. return result;
  5821. case 'Multiplier':
  5822. return buildMultiplierMatchGraph(node);
  5823. case 'Type':
  5824. case 'Property':
  5825. return {
  5826. type: node.type,
  5827. name: node.name,
  5828. syntax: node
  5829. };
  5830. case 'Keyword':
  5831. return {
  5832. type: node.type,
  5833. name: node.name.toLowerCase(),
  5834. syntax: node
  5835. };
  5836. case 'AtKeyword':
  5837. return {
  5838. type: node.type,
  5839. name: '@' + node.name.toLowerCase(),
  5840. syntax: node
  5841. };
  5842. case 'Function':
  5843. return {
  5844. type: node.type,
  5845. name: node.name.toLowerCase() + '(',
  5846. syntax: node
  5847. };
  5848. case 'String':
  5849. // convert a one char length String to a Token
  5850. if (node.value.length === 3) {
  5851. return {
  5852. type: 'Token',
  5853. value: node.value.charAt(1),
  5854. syntax: node
  5855. };
  5856. }
  5857. // otherwise use it as is
  5858. return {
  5859. type: node.type,
  5860. value: node.value.substr(1, node.value.length - 2).replace(/\\'/g, '\''),
  5861. syntax: node
  5862. };
  5863. case 'Token':
  5864. return {
  5865. type: node.type,
  5866. value: node.value,
  5867. syntax: node
  5868. };
  5869. case 'Comma':
  5870. return {
  5871. type: node.type,
  5872. syntax: node
  5873. };
  5874. default:
  5875. throw new Error('Unknown node type:', node.type);
  5876. }
  5877. }
  5878. var matchGraph = {
  5879. MATCH: MATCH,
  5880. MISMATCH: MISMATCH,
  5881. DISALLOW_EMPTY: DISALLOW_EMPTY,
  5882. buildMatchGraph: function(syntaxTree, ref) {
  5883. if (typeof syntaxTree === 'string') {
  5884. syntaxTree = parse_1(syntaxTree);
  5885. }
  5886. return {
  5887. type: 'MatchGraph',
  5888. match: buildMatchGraph(syntaxTree),
  5889. syntax: ref || null,
  5890. source: syntaxTree
  5891. };
  5892. }
  5893. };
  5894. var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  5895. var MATCH$1 = matchGraph.MATCH;
  5896. var MISMATCH$1 = matchGraph.MISMATCH;
  5897. var DISALLOW_EMPTY$1 = matchGraph.DISALLOW_EMPTY;
  5898. var TYPE$6 = _const.TYPE;
  5899. var STUB = 0;
  5900. var TOKEN = 1;
  5901. var OPEN_SYNTAX = 2;
  5902. var CLOSE_SYNTAX = 3;
  5903. var EXIT_REASON_MATCH = 'Match';
  5904. var EXIT_REASON_MISMATCH = 'Mismatch';
  5905. var EXIT_REASON_ITERATION_LIMIT = 'Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)';
  5906. var ITERATION_LIMIT = 15000;
  5907. var totalIterationCount = 0;
  5908. function reverseList(list) {
  5909. var prev = null;
  5910. var next = null;
  5911. var item = list;
  5912. while (item !== null) {
  5913. next = item.prev;
  5914. item.prev = prev;
  5915. prev = item;
  5916. item = next;
  5917. }
  5918. return prev;
  5919. }
  5920. function areStringsEqualCaseInsensitive(testStr, referenceStr) {
  5921. if (testStr.length !== referenceStr.length) {
  5922. return false;
  5923. }
  5924. for (var i = 0; i < testStr.length; i++) {
  5925. var testCode = testStr.charCodeAt(i);
  5926. var referenceCode = referenceStr.charCodeAt(i);
  5927. // testCode.toLowerCase() for U+0041 LATIN CAPITAL LETTER A (A) .. U+005A LATIN CAPITAL LETTER Z (Z).
  5928. if (testCode >= 0x0041 && testCode <= 0x005A) {
  5929. testCode = testCode | 32;
  5930. }
  5931. if (testCode !== referenceCode) {
  5932. return false;
  5933. }
  5934. }
  5935. return true;
  5936. }
  5937. function isCommaContextStart(token) {
  5938. if (token === null) {
  5939. return true;
  5940. }
  5941. return (
  5942. token.type === TYPE$6.Comma ||
  5943. token.type === TYPE$6.Function ||
  5944. token.type === TYPE$6.LeftParenthesis ||
  5945. token.type === TYPE$6.LeftSquareBracket ||
  5946. token.type === TYPE$6.LeftCurlyBracket ||
  5947. token.type === TYPE$6.Delim
  5948. );
  5949. }
  5950. function isCommaContextEnd(token) {
  5951. if (token === null) {
  5952. return true;
  5953. }
  5954. return (
  5955. token.type === TYPE$6.RightParenthesis ||
  5956. token.type === TYPE$6.RightSquareBracket ||
  5957. token.type === TYPE$6.RightCurlyBracket ||
  5958. token.type === TYPE$6.Delim
  5959. );
  5960. }
  5961. function internalMatch(tokens, state, syntaxes) {
  5962. function moveToNextToken() {
  5963. do {
  5964. tokenIndex++;
  5965. token = tokenIndex < tokens.length ? tokens[tokenIndex] : null;
  5966. } while (token !== null && (token.type === TYPE$6.WhiteSpace || token.type === TYPE$6.Comment));
  5967. }
  5968. function getNextToken(offset) {
  5969. var nextIndex = tokenIndex + offset;
  5970. return nextIndex < tokens.length ? tokens[nextIndex] : null;
  5971. }
  5972. function stateSnapshotFromSyntax(nextState, prev) {
  5973. return {
  5974. nextState: nextState,
  5975. matchStack: matchStack,
  5976. syntaxStack: syntaxStack,
  5977. thenStack: thenStack,
  5978. tokenIndex: tokenIndex,
  5979. prev: prev
  5980. };
  5981. }
  5982. function pushThenStack(nextState) {
  5983. thenStack = {
  5984. nextState: nextState,
  5985. matchStack: matchStack,
  5986. syntaxStack: syntaxStack,
  5987. prev: thenStack
  5988. };
  5989. }
  5990. function pushElseStack(nextState) {
  5991. elseStack = stateSnapshotFromSyntax(nextState, elseStack);
  5992. }
  5993. function addTokenToMatch() {
  5994. matchStack = {
  5995. type: TOKEN,
  5996. syntax: state.syntax,
  5997. token: token,
  5998. prev: matchStack
  5999. };
  6000. moveToNextToken();
  6001. syntaxStash = null;
  6002. if (tokenIndex > longestMatch) {
  6003. longestMatch = tokenIndex;
  6004. }
  6005. }
  6006. function openSyntax() {
  6007. syntaxStack = {
  6008. syntax: state.syntax,
  6009. opts: state.syntax.opts || (syntaxStack !== null && syntaxStack.opts) || null,
  6010. prev: syntaxStack
  6011. };
  6012. matchStack = {
  6013. type: OPEN_SYNTAX,
  6014. syntax: state.syntax,
  6015. token: matchStack.token,
  6016. prev: matchStack
  6017. };
  6018. }
  6019. function closeSyntax() {
  6020. if (matchStack.type === OPEN_SYNTAX) {
  6021. matchStack = matchStack.prev;
  6022. } else {
  6023. matchStack = {
  6024. type: CLOSE_SYNTAX,
  6025. syntax: syntaxStack.syntax,
  6026. token: matchStack.token,
  6027. prev: matchStack
  6028. };
  6029. }
  6030. syntaxStack = syntaxStack.prev;
  6031. }
  6032. var syntaxStack = null;
  6033. var thenStack = null;
  6034. var elseStack = null;
  6035. // null – stashing allowed, nothing stashed
  6036. // false – stashing disabled, nothing stashed
  6037. // anithing else – fail stashable syntaxes, some syntax stashed
  6038. var syntaxStash = null;
  6039. var iterationCount = 0; // count iterations and prevent infinite loop
  6040. var exitReason = null;
  6041. var token = null;
  6042. var tokenIndex = -1;
  6043. var longestMatch = 0;
  6044. var matchStack = {
  6045. type: STUB,
  6046. syntax: null,
  6047. token: null,
  6048. prev: null
  6049. };
  6050. moveToNextToken();
  6051. while (exitReason === null && ++iterationCount < ITERATION_LIMIT) {
  6052. // function mapList(list, fn) {
  6053. // var result = [];
  6054. // while (list) {
  6055. // result.unshift(fn(list));
  6056. // list = list.prev;
  6057. // }
  6058. // return result;
  6059. // }
  6060. // console.log('--\n',
  6061. // '#' + iterationCount,
  6062. // require('util').inspect({
  6063. // 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),
  6064. // token: token && token.value,
  6065. // tokenIndex,
  6066. // syntax: syntax.type + (syntax.id ? ' #' + syntax.id : '')
  6067. // }, { depth: null })
  6068. // );
  6069. switch (state.type) {
  6070. case 'Match':
  6071. if (thenStack === null) {
  6072. // turn to MISMATCH when some tokens left unmatched
  6073. if (token !== null) {
  6074. // doesn't mismatch if just one token left and it's an IE hack
  6075. if (tokenIndex !== tokens.length - 1 || (token.value !== '\\0' && token.value !== '\\9')) {
  6076. state = MISMATCH$1;
  6077. break;
  6078. }
  6079. }
  6080. // break the main loop, return a result - MATCH
  6081. exitReason = EXIT_REASON_MATCH;
  6082. break;
  6083. }
  6084. // go to next syntax (`then` branch)
  6085. state = thenStack.nextState;
  6086. // check match is not empty
  6087. if (state === DISALLOW_EMPTY$1) {
  6088. if (thenStack.matchStack === matchStack) {
  6089. state = MISMATCH$1;
  6090. break;
  6091. } else {
  6092. state = MATCH$1;
  6093. }
  6094. }
  6095. // close syntax if needed
  6096. while (thenStack.syntaxStack !== syntaxStack) {
  6097. closeSyntax();
  6098. }
  6099. // pop stack
  6100. thenStack = thenStack.prev;
  6101. break;
  6102. case 'Mismatch':
  6103. // when some syntax is stashed
  6104. if (syntaxStash !== null && syntaxStash !== false) {
  6105. // there is no else branches or a branch reduce match stack
  6106. if (elseStack === null || tokenIndex > elseStack.tokenIndex) {
  6107. // restore state from the stash
  6108. elseStack = syntaxStash;
  6109. syntaxStash = false; // disable stashing
  6110. }
  6111. } else if (elseStack === null) {
  6112. // no else branches -> break the main loop
  6113. // return a result - MISMATCH
  6114. exitReason = EXIT_REASON_MISMATCH;
  6115. break;
  6116. }
  6117. // go to next syntax (`else` branch)
  6118. state = elseStack.nextState;
  6119. // restore all the rest stack states
  6120. thenStack = elseStack.thenStack;
  6121. syntaxStack = elseStack.syntaxStack;
  6122. matchStack = elseStack.matchStack;
  6123. tokenIndex = elseStack.tokenIndex;
  6124. token = tokenIndex < tokens.length ? tokens[tokenIndex] : null;
  6125. // pop stack
  6126. elseStack = elseStack.prev;
  6127. break;
  6128. case 'MatchGraph':
  6129. state = state.match;
  6130. break;
  6131. case 'If':
  6132. // IMPORTANT: else stack push must go first,
  6133. // since it stores the state of thenStack before changes
  6134. if (state.else !== MISMATCH$1) {
  6135. pushElseStack(state.else);
  6136. }
  6137. if (state.then !== MATCH$1) {
  6138. pushThenStack(state.then);
  6139. }
  6140. state = state.match;
  6141. break;
  6142. case 'MatchOnce':
  6143. state = {
  6144. type: 'MatchOnceBuffer',
  6145. syntax: state,
  6146. index: 0,
  6147. mask: 0
  6148. };
  6149. break;
  6150. case 'MatchOnceBuffer':
  6151. var terms = state.syntax.terms;
  6152. if (state.index === terms.length) {
  6153. // no matches at all or it's required all terms to be matched
  6154. if (state.mask === 0 || state.syntax.all) {
  6155. state = MISMATCH$1;
  6156. break;
  6157. }
  6158. // a partial match is ok
  6159. state = MATCH$1;
  6160. break;
  6161. }
  6162. // all terms are matched
  6163. if (state.mask === (1 << terms.length) - 1) {
  6164. state = MATCH$1;
  6165. break;
  6166. }
  6167. for (; state.index < terms.length; state.index++) {
  6168. var matchFlag = 1 << state.index;
  6169. if ((state.mask & matchFlag) === 0) {
  6170. // IMPORTANT: else stack push must go first,
  6171. // since it stores the state of thenStack before changes
  6172. pushElseStack(state);
  6173. pushThenStack({
  6174. type: 'AddMatchOnce',
  6175. syntax: state.syntax,
  6176. mask: state.mask | matchFlag
  6177. });
  6178. // match
  6179. state = terms[state.index++];
  6180. break;
  6181. }
  6182. }
  6183. break;
  6184. case 'AddMatchOnce':
  6185. state = {
  6186. type: 'MatchOnceBuffer',
  6187. syntax: state.syntax,
  6188. index: 0,
  6189. mask: state.mask
  6190. };
  6191. break;
  6192. case 'Enum':
  6193. if (token !== null) {
  6194. var name = token.value.toLowerCase();
  6195. // drop \0 and \9 hack from keyword name
  6196. if (name.indexOf('\\') !== -1) {
  6197. name = name.replace(/\\[09].*$/, '');
  6198. }
  6199. if (hasOwnProperty$1.call(state.map, name)) {
  6200. state = state.map[name];
  6201. break;
  6202. }
  6203. }
  6204. state = MISMATCH$1;
  6205. break;
  6206. case 'Generic':
  6207. var opts = syntaxStack !== null ? syntaxStack.opts : null;
  6208. var lastTokenIndex = tokenIndex + Math.floor(state.fn(token, getNextToken, opts));
  6209. if (!isNaN(lastTokenIndex) && lastTokenIndex > tokenIndex) {
  6210. while (tokenIndex < lastTokenIndex) {
  6211. addTokenToMatch();
  6212. }
  6213. state = MATCH$1;
  6214. } else {
  6215. state = MISMATCH$1;
  6216. }
  6217. break;
  6218. case 'Type':
  6219. case 'Property':
  6220. var syntaxDict = state.type === 'Type' ? 'types' : 'properties';
  6221. var dictSyntax = hasOwnProperty$1.call(syntaxes, syntaxDict) ? syntaxes[syntaxDict][state.name] : null;
  6222. if (!dictSyntax || !dictSyntax.match) {
  6223. throw new Error(
  6224. 'Bad syntax reference: ' +
  6225. (state.type === 'Type'
  6226. ? '<' + state.name + '>'
  6227. : '<\'' + state.name + '\'>')
  6228. );
  6229. }
  6230. // stash a syntax for types with low priority
  6231. if (syntaxStash !== false && token !== null && state.type === 'Type') {
  6232. var lowPriorityMatching =
  6233. // https://drafts.csswg.org/css-values-4/#custom-idents
  6234. // When parsing positionally-ambiguous keywords in a property value, a <custom-ident> production
  6235. // can only claim the keyword if no other unfulfilled production can claim it.
  6236. (state.name === 'custom-ident' && token.type === TYPE$6.Ident) ||
  6237. // https://drafts.csswg.org/css-values-4/#lengths
  6238. // ... if a `0` could be parsed as either a <number> or a <length> in a property (such as line-height),
  6239. // it must parse as a <number>
  6240. (state.name === 'length' && token.value === '0');
  6241. if (lowPriorityMatching) {
  6242. if (syntaxStash === null) {
  6243. syntaxStash = stateSnapshotFromSyntax(state, elseStack);
  6244. }
  6245. state = MISMATCH$1;
  6246. break;
  6247. }
  6248. }
  6249. openSyntax();
  6250. state = dictSyntax.match;
  6251. break;
  6252. case 'Keyword':
  6253. var name = state.name;
  6254. if (token !== null) {
  6255. var keywordName = token.value;
  6256. // drop \0 and \9 hack from keyword name
  6257. if (keywordName.indexOf('\\') !== -1) {
  6258. keywordName = keywordName.replace(/\\[09].*$/, '');
  6259. }
  6260. if (areStringsEqualCaseInsensitive(keywordName, name)) {
  6261. addTokenToMatch();
  6262. state = MATCH$1;
  6263. break;
  6264. }
  6265. }
  6266. state = MISMATCH$1;
  6267. break;
  6268. case 'AtKeyword':
  6269. case 'Function':
  6270. if (token !== null && areStringsEqualCaseInsensitive(token.value, state.name)) {
  6271. addTokenToMatch();
  6272. state = MATCH$1;
  6273. break;
  6274. }
  6275. state = MISMATCH$1;
  6276. break;
  6277. case 'Token':
  6278. if (token !== null && token.value === state.value) {
  6279. addTokenToMatch();
  6280. state = MATCH$1;
  6281. break;
  6282. }
  6283. state = MISMATCH$1;
  6284. break;
  6285. case 'Comma':
  6286. if (token !== null && token.type === TYPE$6.Comma) {
  6287. if (isCommaContextStart(matchStack.token)) {
  6288. state = MISMATCH$1;
  6289. } else {
  6290. addTokenToMatch();
  6291. state = isCommaContextEnd(token) ? MISMATCH$1 : MATCH$1;
  6292. }
  6293. } else {
  6294. state = isCommaContextStart(matchStack.token) || isCommaContextEnd(token) ? MATCH$1 : MISMATCH$1;
  6295. }
  6296. break;
  6297. case 'String':
  6298. var string = '';
  6299. for (var lastTokenIndex = tokenIndex; lastTokenIndex < tokens.length && string.length < state.value.length; lastTokenIndex++) {
  6300. string += tokens[lastTokenIndex].value;
  6301. }
  6302. if (areStringsEqualCaseInsensitive(string, state.value)) {
  6303. while (tokenIndex < lastTokenIndex) {
  6304. addTokenToMatch();
  6305. }
  6306. state = MATCH$1;
  6307. } else {
  6308. state = MISMATCH$1;
  6309. }
  6310. break;
  6311. default:
  6312. throw new Error('Unknown node type: ' + state.type);
  6313. }
  6314. }
  6315. totalIterationCount += iterationCount;
  6316. switch (exitReason) {
  6317. case null:
  6318. console.warn('[csstree-match] BREAK after ' + ITERATION_LIMIT + ' iterations');
  6319. exitReason = EXIT_REASON_ITERATION_LIMIT;
  6320. matchStack = null;
  6321. break;
  6322. case EXIT_REASON_MATCH:
  6323. while (syntaxStack !== null) {
  6324. closeSyntax();
  6325. }
  6326. break;
  6327. default:
  6328. matchStack = null;
  6329. }
  6330. return {
  6331. tokens: tokens,
  6332. reason: exitReason,
  6333. iterations: iterationCount,
  6334. match: matchStack,
  6335. longestMatch: longestMatch
  6336. };
  6337. }
  6338. function matchAsList(tokens, matchGraph, syntaxes) {
  6339. var matchResult = internalMatch(tokens, matchGraph, syntaxes || {});
  6340. if (matchResult.match !== null) {
  6341. var item = reverseList(matchResult.match).prev;
  6342. matchResult.match = [];
  6343. while (item !== null) {
  6344. switch (item.type) {
  6345. case STUB:
  6346. break;
  6347. case OPEN_SYNTAX:
  6348. case CLOSE_SYNTAX:
  6349. matchResult.match.push({
  6350. type: item.type,
  6351. syntax: item.syntax
  6352. });
  6353. break;
  6354. default:
  6355. matchResult.match.push({
  6356. token: item.token.value,
  6357. node: item.token.node
  6358. });
  6359. break;
  6360. }
  6361. item = item.prev;
  6362. }
  6363. }
  6364. return matchResult;
  6365. }
  6366. function matchAsTree(tokens, matchGraph, syntaxes) {
  6367. var matchResult = internalMatch(tokens, matchGraph, syntaxes || {});
  6368. if (matchResult.match === null) {
  6369. return matchResult;
  6370. }
  6371. var item = matchResult.match;
  6372. var host = matchResult.match = {
  6373. syntax: matchGraph.syntax || null,
  6374. match: []
  6375. };
  6376. var hostStack = [host];
  6377. // revert a list and start with 2nd item since 1st is a stub item
  6378. item = reverseList(item).prev;
  6379. // build a tree
  6380. while (item !== null) {
  6381. switch (item.type) {
  6382. case OPEN_SYNTAX:
  6383. host.match.push(host = {
  6384. syntax: item.syntax,
  6385. match: []
  6386. });
  6387. hostStack.push(host);
  6388. break;
  6389. case CLOSE_SYNTAX:
  6390. hostStack.pop();
  6391. host = hostStack[hostStack.length - 1];
  6392. break;
  6393. default:
  6394. host.match.push({
  6395. syntax: item.syntax || null,
  6396. token: item.token.value,
  6397. node: item.token.node
  6398. });
  6399. }
  6400. item = item.prev;
  6401. }
  6402. return matchResult;
  6403. }
  6404. var match = {
  6405. matchAsList: matchAsList,
  6406. matchAsTree: matchAsTree,
  6407. getTotalIterationCount: function() {
  6408. return totalIterationCount;
  6409. }
  6410. };
  6411. function getTrace(node) {
  6412. function shouldPutToTrace(syntax) {
  6413. if (syntax === null) {
  6414. return false;
  6415. }
  6416. return (
  6417. syntax.type === 'Type' ||
  6418. syntax.type === 'Property' ||
  6419. syntax.type === 'Keyword'
  6420. );
  6421. }
  6422. function hasMatch(matchNode) {
  6423. if (Array.isArray(matchNode.match)) {
  6424. // use for-loop for better perfomance
  6425. for (var i = 0; i < matchNode.match.length; i++) {
  6426. if (hasMatch(matchNode.match[i])) {
  6427. if (shouldPutToTrace(matchNode.syntax)) {
  6428. result.unshift(matchNode.syntax);
  6429. }
  6430. return true;
  6431. }
  6432. }
  6433. } else if (matchNode.node === node) {
  6434. result = shouldPutToTrace(matchNode.syntax)
  6435. ? [matchNode.syntax]
  6436. : [];
  6437. return true;
  6438. }
  6439. return false;
  6440. }
  6441. var result = null;
  6442. if (this.matched !== null) {
  6443. hasMatch(this.matched);
  6444. }
  6445. return result;
  6446. }
  6447. function testNode(match, node, fn) {
  6448. var trace = getTrace.call(match, node);
  6449. if (trace === null) {
  6450. return false;
  6451. }
  6452. return trace.some(fn);
  6453. }
  6454. function isType(node, type) {
  6455. return testNode(this, node, function(matchNode) {
  6456. return matchNode.type === 'Type' && matchNode.name === type;
  6457. });
  6458. }
  6459. function isProperty(node, property) {
  6460. return testNode(this, node, function(matchNode) {
  6461. return matchNode.type === 'Property' && matchNode.name === property;
  6462. });
  6463. }
  6464. function isKeyword(node) {
  6465. return testNode(this, node, function(matchNode) {
  6466. return matchNode.type === 'Keyword';
  6467. });
  6468. }
  6469. var trace = {
  6470. getTrace: getTrace,
  6471. isType: isType,
  6472. isProperty: isProperty,
  6473. isKeyword: isKeyword
  6474. };
  6475. function getFirstMatchNode(matchNode) {
  6476. if ('node' in matchNode) {
  6477. return matchNode.node;
  6478. }
  6479. return getFirstMatchNode(matchNode.match[0]);
  6480. }
  6481. function getLastMatchNode(matchNode) {
  6482. if ('node' in matchNode) {
  6483. return matchNode.node;
  6484. }
  6485. return getLastMatchNode(matchNode.match[matchNode.match.length - 1]);
  6486. }
  6487. function matchFragments(lexer, ast, match, type, name) {
  6488. function findFragments(matchNode) {
  6489. if (matchNode.syntax !== null &&
  6490. matchNode.syntax.type === type &&
  6491. matchNode.syntax.name === name) {
  6492. var start = getFirstMatchNode(matchNode);
  6493. var end = getLastMatchNode(matchNode);
  6494. lexer.syntax.walk(ast, function(node, item, list) {
  6495. if (node === start) {
  6496. var nodes = new List_1();
  6497. do {
  6498. nodes.appendData(item.data);
  6499. if (item.data === end) {
  6500. break;
  6501. }
  6502. item = item.next;
  6503. } while (item !== null);
  6504. fragments.push({
  6505. parent: list,
  6506. nodes: nodes
  6507. });
  6508. }
  6509. });
  6510. }
  6511. if (Array.isArray(matchNode.match)) {
  6512. matchNode.match.forEach(findFragments);
  6513. }
  6514. }
  6515. var fragments = [];
  6516. if (match.matched !== null) {
  6517. findFragments(match.matched);
  6518. }
  6519. return fragments;
  6520. }
  6521. var search = {
  6522. matchFragments: matchFragments
  6523. };
  6524. var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
  6525. function isValidNumber(value) {
  6526. // Number.isInteger(value) && value >= 0
  6527. return (
  6528. typeof value === 'number' &&
  6529. isFinite(value) &&
  6530. Math.floor(value) === value &&
  6531. value >= 0
  6532. );
  6533. }
  6534. function isValidLocation(loc) {
  6535. return (
  6536. Boolean(loc) &&
  6537. isValidNumber(loc.offset) &&
  6538. isValidNumber(loc.line) &&
  6539. isValidNumber(loc.column)
  6540. );
  6541. }
  6542. function createNodeStructureChecker(type, fields) {
  6543. return function checkNode(node, warn) {
  6544. if (!node || node.constructor !== Object) {
  6545. return warn(node, 'Type of node should be an Object');
  6546. }
  6547. for (var key in node) {
  6548. var valid = true;
  6549. if (hasOwnProperty$2.call(node, key) === false) {
  6550. continue;
  6551. }
  6552. if (key === 'type') {
  6553. if (node.type !== type) {
  6554. warn(node, 'Wrong node type `' + node.type + '`, expected `' + type + '`');
  6555. }
  6556. } else if (key === 'loc') {
  6557. if (node.loc === null) {
  6558. continue;
  6559. } else if (node.loc && node.loc.constructor === Object) {
  6560. if (typeof node.loc.source !== 'string') {
  6561. key += '.source';
  6562. } else if (!isValidLocation(node.loc.start)) {
  6563. key += '.start';
  6564. } else if (!isValidLocation(node.loc.end)) {
  6565. key += '.end';
  6566. } else {
  6567. continue;
  6568. }
  6569. }
  6570. valid = false;
  6571. } else if (fields.hasOwnProperty(key)) {
  6572. for (var i = 0, valid = false; !valid && i < fields[key].length; i++) {
  6573. var fieldType = fields[key][i];
  6574. switch (fieldType) {
  6575. case String:
  6576. valid = typeof node[key] === 'string';
  6577. break;
  6578. case Boolean:
  6579. valid = typeof node[key] === 'boolean';
  6580. break;
  6581. case null:
  6582. valid = node[key] === null;
  6583. break;
  6584. default:
  6585. if (typeof fieldType === 'string') {
  6586. valid = node[key] && node[key].type === fieldType;
  6587. } else if (Array.isArray(fieldType)) {
  6588. valid = node[key] instanceof List_1;
  6589. }
  6590. }
  6591. }
  6592. } else {
  6593. warn(node, 'Unknown field `' + key + '` for ' + type + ' node type');
  6594. }
  6595. if (!valid) {
  6596. warn(node, 'Bad value for `' + type + '.' + key + '`');
  6597. }
  6598. }
  6599. for (var key in fields) {
  6600. if (hasOwnProperty$2.call(fields, key) &&
  6601. hasOwnProperty$2.call(node, key) === false) {
  6602. warn(node, 'Field `' + type + '.' + key + '` is missed');
  6603. }
  6604. }
  6605. };
  6606. }
  6607. function processStructure(name, nodeType) {
  6608. var structure = nodeType.structure;
  6609. var fields = {
  6610. type: String,
  6611. loc: true
  6612. };
  6613. var docs = {
  6614. type: '"' + name + '"'
  6615. };
  6616. for (var key in structure) {
  6617. if (hasOwnProperty$2.call(structure, key) === false) {
  6618. continue;
  6619. }
  6620. var docsTypes = [];
  6621. var fieldTypes = fields[key] = Array.isArray(structure[key])
  6622. ? structure[key].slice()
  6623. : [structure[key]];
  6624. for (var i = 0; i < fieldTypes.length; i++) {
  6625. var fieldType = fieldTypes[i];
  6626. if (fieldType === String || fieldType === Boolean) {
  6627. docsTypes.push(fieldType.name);
  6628. } else if (fieldType === null) {
  6629. docsTypes.push('null');
  6630. } else if (typeof fieldType === 'string') {
  6631. docsTypes.push('<' + fieldType + '>');
  6632. } else if (Array.isArray(fieldType)) {
  6633. docsTypes.push('List'); // TODO: use type enum
  6634. } else {
  6635. throw new Error('Wrong value `' + fieldType + '` in `' + name + '.' + key + '` structure definition');
  6636. }
  6637. }
  6638. docs[key] = docsTypes.join(' | ');
  6639. }
  6640. return {
  6641. docs: docs,
  6642. check: createNodeStructureChecker(name, fields)
  6643. };
  6644. }
  6645. var structure = {
  6646. getStructureFromConfig: function(config) {
  6647. var structure = {};
  6648. if (config.node) {
  6649. for (var name in config.node) {
  6650. if (hasOwnProperty$2.call(config.node, name)) {
  6651. var nodeType = config.node[name];
  6652. if (nodeType.structure) {
  6653. structure[name] = processStructure(name, nodeType);
  6654. } else {
  6655. throw new Error('Missed `structure` field in `' + name + '` node type definition');
  6656. }
  6657. }
  6658. }
  6659. }
  6660. return structure;
  6661. }
  6662. };
  6663. var SyntaxReferenceError$1 = error.SyntaxReferenceError;
  6664. var MatchError$1 = error.MatchError;
  6665. var buildMatchGraph$1 = matchGraph.buildMatchGraph;
  6666. var matchAsTree$1 = match.matchAsTree;
  6667. var getStructureFromConfig = structure.getStructureFromConfig;
  6668. var cssWideKeywords$1 = buildMatchGraph$1('inherit | initial | unset');
  6669. var cssWideKeywordsWithExpression = buildMatchGraph$1('inherit | initial | unset | <-ms-legacy-expression>');
  6670. function dumpMapSyntax(map, compact, syntaxAsAst) {
  6671. var result = {};
  6672. for (var name in map) {
  6673. if (map[name].syntax) {
  6674. result[name] = syntaxAsAst
  6675. ? map[name].syntax
  6676. : generate_1(map[name].syntax, { compact: compact });
  6677. }
  6678. }
  6679. return result;
  6680. }
  6681. function valueHasVar(tokens) {
  6682. for (var i = 0; i < tokens.length; i++) {
  6683. if (tokens[i].value.toLowerCase() === 'var(') {
  6684. return true;
  6685. }
  6686. }
  6687. return false;
  6688. }
  6689. function buildMatchResult(match, error, iterations) {
  6690. return {
  6691. matched: match,
  6692. iterations: iterations,
  6693. error: error,
  6694. getTrace: trace.getTrace,
  6695. isType: trace.isType,
  6696. isProperty: trace.isProperty,
  6697. isKeyword: trace.isKeyword
  6698. };
  6699. }
  6700. function matchSyntax(lexer, syntax, value, useCommon) {
  6701. var tokens = prepareTokens_1(value, lexer.syntax);
  6702. var result;
  6703. if (valueHasVar(tokens)) {
  6704. return buildMatchResult(null, new Error('Matching for a tree with var() is not supported'));
  6705. }
  6706. if (useCommon) {
  6707. result = matchAsTree$1(tokens, lexer.valueCommonSyntax, lexer);
  6708. }
  6709. if (!useCommon || !result.match) {
  6710. result = matchAsTree$1(tokens, syntax.match, lexer);
  6711. if (!result.match) {
  6712. return buildMatchResult(
  6713. null,
  6714. new MatchError$1(result.reason, syntax.syntax, value, result),
  6715. result.iterations
  6716. );
  6717. }
  6718. }
  6719. return buildMatchResult(result.match, null, result.iterations);
  6720. }
  6721. var Lexer = function(config, syntax, structure) {
  6722. this.valueCommonSyntax = cssWideKeywords$1;
  6723. this.syntax = syntax;
  6724. this.generic = false;
  6725. this.atrules = {};
  6726. this.properties = {};
  6727. this.types = {};
  6728. this.structure = structure || getStructureFromConfig(config);
  6729. if (config) {
  6730. if (config.types) {
  6731. for (var name in config.types) {
  6732. this.addType_(name, config.types[name]);
  6733. }
  6734. }
  6735. if (config.generic) {
  6736. this.generic = true;
  6737. for (var name in generic) {
  6738. this.addType_(name, generic[name]);
  6739. }
  6740. }
  6741. if (config.atrules) {
  6742. for (var name in config.atrules) {
  6743. this.addAtrule_(name, config.atrules[name]);
  6744. }
  6745. }
  6746. if (config.properties) {
  6747. for (var name in config.properties) {
  6748. this.addProperty_(name, config.properties[name]);
  6749. }
  6750. }
  6751. }
  6752. };
  6753. Lexer.prototype = {
  6754. structure: {},
  6755. checkStructure: function(ast) {
  6756. function collectWarning(node, message) {
  6757. warns.push({
  6758. node: node,
  6759. message: message
  6760. });
  6761. }
  6762. var structure = this.structure;
  6763. var warns = [];
  6764. this.syntax.walk(ast, function(node) {
  6765. if (structure.hasOwnProperty(node.type)) {
  6766. structure[node.type].check(node, collectWarning);
  6767. } else {
  6768. collectWarning(node, 'Unknown node type `' + node.type + '`');
  6769. }
  6770. });
  6771. return warns.length ? warns : false;
  6772. },
  6773. createDescriptor: function(syntax, type, name) {
  6774. var ref = {
  6775. type: type,
  6776. name: name
  6777. };
  6778. var descriptor = {
  6779. type: type,
  6780. name: name,
  6781. syntax: null,
  6782. match: null
  6783. };
  6784. if (typeof syntax === 'function') {
  6785. descriptor.match = buildMatchGraph$1(syntax, ref);
  6786. } else {
  6787. if (typeof syntax === 'string') {
  6788. // lazy parsing on first access
  6789. Object.defineProperty(descriptor, 'syntax', {
  6790. get: function() {
  6791. Object.defineProperty(descriptor, 'syntax', {
  6792. value: parse_1(syntax)
  6793. });
  6794. return descriptor.syntax;
  6795. }
  6796. });
  6797. } else {
  6798. descriptor.syntax = syntax;
  6799. }
  6800. // lazy graph build on first access
  6801. Object.defineProperty(descriptor, 'match', {
  6802. get: function() {
  6803. Object.defineProperty(descriptor, 'match', {
  6804. value: buildMatchGraph$1(descriptor.syntax, ref)
  6805. });
  6806. return descriptor.match;
  6807. }
  6808. });
  6809. }
  6810. return descriptor;
  6811. },
  6812. addAtrule_: function(name, syntax) {
  6813. this.atrules[name] = {
  6814. prelude: syntax.prelude ? this.createDescriptor(syntax.prelude, 'AtrulePrelude', name) : null,
  6815. descriptors: syntax.descriptors
  6816. ? Object.keys(syntax.descriptors).reduce((res, name) => {
  6817. res[name] = this.createDescriptor(syntax.descriptors[name], 'AtruleDescriptor', name);
  6818. return res;
  6819. }, {})
  6820. : null
  6821. };
  6822. },
  6823. addProperty_: function(name, syntax) {
  6824. this.properties[name] = this.createDescriptor(syntax, 'Property', name);
  6825. },
  6826. addType_: function(name, syntax) {
  6827. this.types[name] = this.createDescriptor(syntax, 'Type', name);
  6828. if (syntax === generic['-ms-legacy-expression']) {
  6829. this.valueCommonSyntax = cssWideKeywordsWithExpression;
  6830. }
  6831. },
  6832. matchAtrulePrelude: function(atruleName, prelude) {
  6833. var atrule = names.keyword(atruleName);
  6834. var atrulePreludeSyntax = atrule.vendor
  6835. ? this.getAtrulePrelude(atrule.name) || this.getAtrulePrelude(atrule.basename)
  6836. : this.getAtrulePrelude(atrule.name);
  6837. if (!atrulePreludeSyntax) {
  6838. if (atrule.basename in this.atrules) {
  6839. return buildMatchResult(null, new Error('At-rule `' + atruleName + '` should not contain a prelude'));
  6840. }
  6841. return buildMatchResult(null, new SyntaxReferenceError$1('Unknown at-rule', atruleName));
  6842. }
  6843. return matchSyntax(this, atrulePreludeSyntax, prelude, true);
  6844. },
  6845. matchAtruleDescriptor: function(atruleName, descriptorName, value) {
  6846. var atrule = names.keyword(atruleName);
  6847. var descriptor = names.keyword(descriptorName);
  6848. var atruleEntry = atrule.vendor
  6849. ? this.atrules[atrule.name] || this.atrules[atrule.basename]
  6850. : this.atrules[atrule.name];
  6851. if (!atruleEntry) {
  6852. return buildMatchResult(null, new SyntaxReferenceError$1('Unknown at-rule', atruleName));
  6853. }
  6854. if (!atruleEntry.descriptors) {
  6855. return buildMatchResult(null, new Error('At-rule `' + atruleName + '` has no known descriptors'));
  6856. }
  6857. var atruleDescriptorSyntax = descriptor.vendor
  6858. ? atruleEntry.descriptors[descriptor.name] || atruleEntry.descriptors[descriptor.basename]
  6859. : atruleEntry.descriptors[descriptor.name];
  6860. if (!atruleDescriptorSyntax) {
  6861. return buildMatchResult(null, new SyntaxReferenceError$1('Unknown at-rule descriptor', descriptorName));
  6862. }
  6863. return matchSyntax(this, atruleDescriptorSyntax, value, true);
  6864. },
  6865. matchDeclaration: function(node) {
  6866. if (node.type !== 'Declaration') {
  6867. return buildMatchResult(null, new Error('Not a Declaration node'));
  6868. }
  6869. return this.matchProperty(node.property, node.value);
  6870. },
  6871. matchProperty: function(propertyName, value) {
  6872. var property = names.property(propertyName);
  6873. // don't match syntax for a custom property
  6874. if (property.custom) {
  6875. return buildMatchResult(null, new Error('Lexer matching doesn\'t applicable for custom properties'));
  6876. }
  6877. var propertySyntax = property.vendor
  6878. ? this.getProperty(property.name) || this.getProperty(property.basename)
  6879. : this.getProperty(property.name);
  6880. if (!propertySyntax) {
  6881. return buildMatchResult(null, new SyntaxReferenceError$1('Unknown property', propertyName));
  6882. }
  6883. return matchSyntax(this, propertySyntax, value, true);
  6884. },
  6885. matchType: function(typeName, value) {
  6886. var typeSyntax = this.getType(typeName);
  6887. if (!typeSyntax) {
  6888. return buildMatchResult(null, new SyntaxReferenceError$1('Unknown type', typeName));
  6889. }
  6890. return matchSyntax(this, typeSyntax, value, false);
  6891. },
  6892. match: function(syntax, value) {
  6893. if (typeof syntax !== 'string' && (!syntax || !syntax.type)) {
  6894. return buildMatchResult(null, new SyntaxReferenceError$1('Bad syntax'));
  6895. }
  6896. if (typeof syntax === 'string' || !syntax.match) {
  6897. syntax = this.createDescriptor(syntax, 'Type', 'anonymous');
  6898. }
  6899. return matchSyntax(this, syntax, value, false);
  6900. },
  6901. findValueFragments: function(propertyName, value, type, name) {
  6902. return search.matchFragments(this, value, this.matchProperty(propertyName, value), type, name);
  6903. },
  6904. findDeclarationValueFragments: function(declaration, type, name) {
  6905. return search.matchFragments(this, declaration.value, this.matchDeclaration(declaration), type, name);
  6906. },
  6907. findAllFragments: function(ast, type, name) {
  6908. var result = [];
  6909. this.syntax.walk(ast, {
  6910. visit: 'Declaration',
  6911. enter: function(declaration) {
  6912. result.push.apply(result, this.findDeclarationValueFragments(declaration, type, name));
  6913. }.bind(this)
  6914. });
  6915. return result;
  6916. },
  6917. getAtrulePrelude: function(atruleName) {
  6918. return this.atrules.hasOwnProperty(atruleName) ? this.atrules[atruleName].prelude : null;
  6919. },
  6920. getAtruleDescriptor: function(atruleName, name) {
  6921. return this.atrules.hasOwnProperty(atruleName) && this.atrules.declarators
  6922. ? this.atrules[atruleName].declarators[name] || null
  6923. : null;
  6924. },
  6925. getProperty: function(name) {
  6926. return this.properties.hasOwnProperty(name) ? this.properties[name] : null;
  6927. },
  6928. getType: function(name) {
  6929. return this.types.hasOwnProperty(name) ? this.types[name] : null;
  6930. },
  6931. validate: function() {
  6932. function validate(syntax, name, broken, descriptor) {
  6933. if (broken.hasOwnProperty(name)) {
  6934. return broken[name];
  6935. }
  6936. broken[name] = false;
  6937. if (descriptor.syntax !== null) {
  6938. walk$1(descriptor.syntax, function(node) {
  6939. if (node.type !== 'Type' && node.type !== 'Property') {
  6940. return;
  6941. }
  6942. var map = node.type === 'Type' ? syntax.types : syntax.properties;
  6943. var brokenMap = node.type === 'Type' ? brokenTypes : brokenProperties;
  6944. if (!map.hasOwnProperty(node.name) || validate(syntax, node.name, brokenMap, map[node.name])) {
  6945. broken[name] = true;
  6946. }
  6947. }, this);
  6948. }
  6949. }
  6950. var brokenTypes = {};
  6951. var brokenProperties = {};
  6952. for (var key in this.types) {
  6953. validate(this, key, brokenTypes, this.types[key]);
  6954. }
  6955. for (var key in this.properties) {
  6956. validate(this, key, brokenProperties, this.properties[key]);
  6957. }
  6958. brokenTypes = Object.keys(brokenTypes).filter(function(name) {
  6959. return brokenTypes[name];
  6960. });
  6961. brokenProperties = Object.keys(brokenProperties).filter(function(name) {
  6962. return brokenProperties[name];
  6963. });
  6964. if (brokenTypes.length || brokenProperties.length) {
  6965. return {
  6966. types: brokenTypes,
  6967. properties: brokenProperties
  6968. };
  6969. }
  6970. return null;
  6971. },
  6972. dump: function(syntaxAsAst, pretty) {
  6973. return {
  6974. generic: this.generic,
  6975. types: dumpMapSyntax(this.types, !pretty, syntaxAsAst),
  6976. properties: dumpMapSyntax(this.properties, !pretty, syntaxAsAst)
  6977. };
  6978. },
  6979. toString: function() {
  6980. return JSON.stringify(this.dump());
  6981. }
  6982. };
  6983. var Lexer_1 = Lexer;
  6984. var definitionSyntax = {
  6985. SyntaxError: _SyntaxError$1,
  6986. parse: parse_1,
  6987. generate: generate_1,
  6988. walk: walk$1
  6989. };
  6990. var isBOM$2 = tokenizer.isBOM;
  6991. var N$3 = 10;
  6992. var F$2 = 12;
  6993. var R$2 = 13;
  6994. function computeLinesAndColumns(host, source) {
  6995. var sourceLength = source.length;
  6996. var lines = adoptBuffer(host.lines, sourceLength); // +1
  6997. var line = host.startLine;
  6998. var columns = adoptBuffer(host.columns, sourceLength);
  6999. var column = host.startColumn;
  7000. var startOffset = source.length > 0 ? isBOM$2(source.charCodeAt(0)) : 0;
  7001. for (var i = startOffset; i < sourceLength; i++) { // -1
  7002. var code = source.charCodeAt(i);
  7003. lines[i] = line;
  7004. columns[i] = column++;
  7005. if (code === N$3 || code === R$2 || code === F$2) {
  7006. if (code === R$2 && i + 1 < sourceLength && source.charCodeAt(i + 1) === N$3) {
  7007. i++;
  7008. lines[i] = line;
  7009. columns[i] = column;
  7010. }
  7011. line++;
  7012. column = 1;
  7013. }
  7014. }
  7015. lines[i] = line;
  7016. columns[i] = column;
  7017. host.lines = lines;
  7018. host.columns = columns;
  7019. }
  7020. var OffsetToLocation = function() {
  7021. this.lines = null;
  7022. this.columns = null;
  7023. this.linesAndColumnsComputed = false;
  7024. };
  7025. OffsetToLocation.prototype = {
  7026. setSource: function(source, startOffset, startLine, startColumn) {
  7027. this.source = source;
  7028. this.startOffset = typeof startOffset === 'undefined' ? 0 : startOffset;
  7029. this.startLine = typeof startLine === 'undefined' ? 1 : startLine;
  7030. this.startColumn = typeof startColumn === 'undefined' ? 1 : startColumn;
  7031. this.linesAndColumnsComputed = false;
  7032. },
  7033. ensureLinesAndColumnsComputed: function() {
  7034. if (!this.linesAndColumnsComputed) {
  7035. computeLinesAndColumns(this, this.source);
  7036. this.linesAndColumnsComputed = true;
  7037. }
  7038. },
  7039. getLocation: function(offset, filename) {
  7040. this.ensureLinesAndColumnsComputed();
  7041. return {
  7042. source: filename,
  7043. offset: this.startOffset + offset,
  7044. line: this.lines[offset],
  7045. column: this.columns[offset]
  7046. };
  7047. },
  7048. getLocationRange: function(start, end, filename) {
  7049. this.ensureLinesAndColumnsComputed();
  7050. return {
  7051. source: filename,
  7052. start: {
  7053. offset: this.startOffset + start,
  7054. line: this.lines[start],
  7055. column: this.columns[start]
  7056. },
  7057. end: {
  7058. offset: this.startOffset + end,
  7059. line: this.lines[end],
  7060. column: this.columns[end]
  7061. }
  7062. };
  7063. }
  7064. };
  7065. var OffsetToLocation_1 = OffsetToLocation;
  7066. var TYPE$7 = tokenizer.TYPE;
  7067. var WHITESPACE$2 = TYPE$7.WhiteSpace;
  7068. var COMMENT$2 = TYPE$7.Comment;
  7069. var sequence = function readSequence(recognizer) {
  7070. var children = this.createList();
  7071. var child = null;
  7072. var context = {
  7073. recognizer: recognizer,
  7074. space: null,
  7075. ignoreWS: false,
  7076. ignoreWSAfter: false
  7077. };
  7078. this.scanner.skipSC();
  7079. while (!this.scanner.eof) {
  7080. switch (this.scanner.tokenType) {
  7081. case COMMENT$2:
  7082. this.scanner.next();
  7083. continue;
  7084. case WHITESPACE$2:
  7085. if (context.ignoreWS) {
  7086. this.scanner.next();
  7087. } else {
  7088. context.space = this.WhiteSpace();
  7089. }
  7090. continue;
  7091. }
  7092. child = recognizer.getNode.call(this, context);
  7093. if (child === undefined) {
  7094. break;
  7095. }
  7096. if (context.space !== null) {
  7097. children.push(context.space);
  7098. context.space = null;
  7099. }
  7100. children.push(child);
  7101. if (context.ignoreWSAfter) {
  7102. context.ignoreWSAfter = false;
  7103. context.ignoreWS = true;
  7104. } else {
  7105. context.ignoreWS = false;
  7106. }
  7107. }
  7108. return children;
  7109. };
  7110. var findWhiteSpaceStart$1 = utils.findWhiteSpaceStart;
  7111. var noop$3 = function() {};
  7112. var TYPE$8 = _const.TYPE;
  7113. var NAME$2 = _const.NAME;
  7114. var WHITESPACE$3 = TYPE$8.WhiteSpace;
  7115. var IDENT$2 = TYPE$8.Ident;
  7116. var FUNCTION = TYPE$8.Function;
  7117. var URL$1 = TYPE$8.Url;
  7118. var HASH = TYPE$8.Hash;
  7119. var PERCENTAGE = TYPE$8.Percentage;
  7120. var NUMBER$2 = TYPE$8.Number;
  7121. var NUMBERSIGN$1 = 0x0023; // U+0023 NUMBER SIGN (#)
  7122. var NULL = 0;
  7123. function createParseContext(name) {
  7124. return function() {
  7125. return this[name]();
  7126. };
  7127. }
  7128. function processConfig(config) {
  7129. var parserConfig = {
  7130. context: {},
  7131. scope: {},
  7132. atrule: {},
  7133. pseudo: {}
  7134. };
  7135. if (config.parseContext) {
  7136. for (var name in config.parseContext) {
  7137. switch (typeof config.parseContext[name]) {
  7138. case 'function':
  7139. parserConfig.context[name] = config.parseContext[name];
  7140. break;
  7141. case 'string':
  7142. parserConfig.context[name] = createParseContext(config.parseContext[name]);
  7143. break;
  7144. }
  7145. }
  7146. }
  7147. if (config.scope) {
  7148. for (var name in config.scope) {
  7149. parserConfig.scope[name] = config.scope[name];
  7150. }
  7151. }
  7152. if (config.atrule) {
  7153. for (var name in config.atrule) {
  7154. var atrule = config.atrule[name];
  7155. if (atrule.parse) {
  7156. parserConfig.atrule[name] = atrule.parse;
  7157. }
  7158. }
  7159. }
  7160. if (config.pseudo) {
  7161. for (var name in config.pseudo) {
  7162. var pseudo = config.pseudo[name];
  7163. if (pseudo.parse) {
  7164. parserConfig.pseudo[name] = pseudo.parse;
  7165. }
  7166. }
  7167. }
  7168. if (config.node) {
  7169. for (var name in config.node) {
  7170. parserConfig[name] = config.node[name].parse;
  7171. }
  7172. }
  7173. return parserConfig;
  7174. }
  7175. var create$1 = function createParser(config) {
  7176. var parser = {
  7177. scanner: new TokenStream_1(),
  7178. locationMap: new OffsetToLocation_1(),
  7179. filename: '<unknown>',
  7180. needPositions: false,
  7181. onParseError: noop$3,
  7182. onParseErrorThrow: false,
  7183. parseAtrulePrelude: true,
  7184. parseRulePrelude: true,
  7185. parseValue: true,
  7186. parseCustomProperty: false,
  7187. readSequence: sequence,
  7188. createList: function() {
  7189. return new List_1();
  7190. },
  7191. createSingleNodeList: function(node) {
  7192. return new List_1().appendData(node);
  7193. },
  7194. getFirstListNode: function(list) {
  7195. return list && list.first();
  7196. },
  7197. getLastListNode: function(list) {
  7198. return list.last();
  7199. },
  7200. parseWithFallback: function(consumer, fallback) {
  7201. var startToken = this.scanner.tokenIndex;
  7202. try {
  7203. return consumer.call(this);
  7204. } catch (e) {
  7205. if (this.onParseErrorThrow) {
  7206. throw e;
  7207. }
  7208. var fallbackNode = fallback.call(this, startToken);
  7209. this.onParseErrorThrow = true;
  7210. this.onParseError(e, fallbackNode);
  7211. this.onParseErrorThrow = false;
  7212. return fallbackNode;
  7213. }
  7214. },
  7215. lookupNonWSType: function(offset) {
  7216. do {
  7217. var type = this.scanner.lookupType(offset++);
  7218. if (type !== WHITESPACE$3) {
  7219. return type;
  7220. }
  7221. } while (type !== NULL);
  7222. return NULL;
  7223. },
  7224. eat: function(tokenType) {
  7225. if (this.scanner.tokenType !== tokenType) {
  7226. var offset = this.scanner.tokenStart;
  7227. var message = NAME$2[tokenType] + ' is expected';
  7228. // tweak message and offset
  7229. switch (tokenType) {
  7230. case IDENT$2:
  7231. // when identifier is expected but there is a function or url
  7232. if (this.scanner.tokenType === FUNCTION || this.scanner.tokenType === URL$1) {
  7233. offset = this.scanner.tokenEnd - 1;
  7234. message = 'Identifier is expected but function found';
  7235. } else {
  7236. message = 'Identifier is expected';
  7237. }
  7238. break;
  7239. case HASH:
  7240. if (this.scanner.isDelim(NUMBERSIGN$1)) {
  7241. this.scanner.next();
  7242. offset++;
  7243. message = 'Name is expected';
  7244. }
  7245. break;
  7246. case PERCENTAGE:
  7247. if (this.scanner.tokenType === NUMBER$2) {
  7248. offset = this.scanner.tokenEnd;
  7249. message = 'Percent sign is expected';
  7250. }
  7251. break;
  7252. default:
  7253. // when test type is part of another token show error for current position + 1
  7254. // e.g. eat(HYPHENMINUS) will fail on "-foo", but pointing on "-" is odd
  7255. if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === tokenType) {
  7256. offset = offset + 1;
  7257. }
  7258. }
  7259. this.error(message, offset);
  7260. }
  7261. this.scanner.next();
  7262. },
  7263. consume: function(tokenType) {
  7264. var value = this.scanner.getTokenValue();
  7265. this.eat(tokenType);
  7266. return value;
  7267. },
  7268. consumeFunctionName: function() {
  7269. var name = this.scanner.source.substring(this.scanner.tokenStart, this.scanner.tokenEnd - 1);
  7270. this.eat(FUNCTION);
  7271. return name;
  7272. },
  7273. getLocation: function(start, end) {
  7274. if (this.needPositions) {
  7275. return this.locationMap.getLocationRange(
  7276. start,
  7277. end,
  7278. this.filename
  7279. );
  7280. }
  7281. return null;
  7282. },
  7283. getLocationFromList: function(list) {
  7284. if (this.needPositions) {
  7285. var head = this.getFirstListNode(list);
  7286. var tail = this.getLastListNode(list);
  7287. return this.locationMap.getLocationRange(
  7288. head !== null ? head.loc.start.offset - this.locationMap.startOffset : this.scanner.tokenStart,
  7289. tail !== null ? tail.loc.end.offset - this.locationMap.startOffset : this.scanner.tokenStart,
  7290. this.filename
  7291. );
  7292. }
  7293. return null;
  7294. },
  7295. error: function(message, offset) {
  7296. var location = typeof offset !== 'undefined' && offset < this.scanner.source.length
  7297. ? this.locationMap.getLocation(offset)
  7298. : this.scanner.eof
  7299. ? this.locationMap.getLocation(findWhiteSpaceStart$1(this.scanner.source, this.scanner.source.length - 1))
  7300. : this.locationMap.getLocation(this.scanner.tokenStart);
  7301. throw new _SyntaxError(
  7302. message || 'Unexpected input',
  7303. this.scanner.source,
  7304. location.offset,
  7305. location.line,
  7306. location.column
  7307. );
  7308. }
  7309. };
  7310. config = processConfig(config || {});
  7311. for (var key in config) {
  7312. parser[key] = config[key];
  7313. }
  7314. return function(source, options) {
  7315. options = options || {};
  7316. var context = options.context || 'default';
  7317. var ast;
  7318. tokenizer(source, parser.scanner);
  7319. parser.locationMap.setSource(
  7320. source,
  7321. options.offset,
  7322. options.line,
  7323. options.column
  7324. );
  7325. parser.filename = options.filename || '<unknown>';
  7326. parser.needPositions = Boolean(options.positions);
  7327. parser.onParseError = typeof options.onParseError === 'function' ? options.onParseError : noop$3;
  7328. parser.onParseErrorThrow = false;
  7329. parser.parseAtrulePrelude = 'parseAtrulePrelude' in options ? Boolean(options.parseAtrulePrelude) : true;
  7330. parser.parseRulePrelude = 'parseRulePrelude' in options ? Boolean(options.parseRulePrelude) : true;
  7331. parser.parseValue = 'parseValue' in options ? Boolean(options.parseValue) : true;
  7332. parser.parseCustomProperty = 'parseCustomProperty' in options ? Boolean(options.parseCustomProperty) : false;
  7333. if (!parser.context.hasOwnProperty(context)) {
  7334. throw new Error('Unknown context `' + context + '`');
  7335. }
  7336. ast = parser.context[context].call(parser, options);
  7337. if (!parser.scanner.eof) {
  7338. parser.error();
  7339. }
  7340. return ast;
  7341. };
  7342. };
  7343. /* -*- Mode: js; js-indent-level: 2; -*- */
  7344. /*
  7345. * Copyright 2011 Mozilla Foundation and contributors
  7346. * Licensed under the New BSD license. See LICENSE or:
  7347. * http://opensource.org/licenses/BSD-3-Clause
  7348. */
  7349. var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
  7350. /**
  7351. * Encode an integer in the range of 0 to 63 to a single base 64 digit.
  7352. */
  7353. var encode = function (number) {
  7354. if (0 <= number && number < intToCharMap.length) {
  7355. return intToCharMap[number];
  7356. }
  7357. throw new TypeError("Must be between 0 and 63: " + number);
  7358. };
  7359. /**
  7360. * Decode a single base 64 character code digit to an integer. Returns -1 on
  7361. * failure.
  7362. */
  7363. var decode = function (charCode) {
  7364. var bigA = 65; // 'A'
  7365. var bigZ = 90; // 'Z'
  7366. var littleA = 97; // 'a'
  7367. var littleZ = 122; // 'z'
  7368. var zero = 48; // '0'
  7369. var nine = 57; // '9'
  7370. var plus = 43; // '+'
  7371. var slash = 47; // '/'
  7372. var littleOffset = 26;
  7373. var numberOffset = 52;
  7374. // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  7375. if (bigA <= charCode && charCode <= bigZ) {
  7376. return (charCode - bigA);
  7377. }
  7378. // 26 - 51: abcdefghijklmnopqrstuvwxyz
  7379. if (littleA <= charCode && charCode <= littleZ) {
  7380. return (charCode - littleA + littleOffset);
  7381. }
  7382. // 52 - 61: 0123456789
  7383. if (zero <= charCode && charCode <= nine) {
  7384. return (charCode - zero + numberOffset);
  7385. }
  7386. // 62: +
  7387. if (charCode == plus) {
  7388. return 62;
  7389. }
  7390. // 63: /
  7391. if (charCode == slash) {
  7392. return 63;
  7393. }
  7394. // Invalid base64 digit.
  7395. return -1;
  7396. };
  7397. var base64 = {
  7398. encode: encode,
  7399. decode: decode
  7400. };
  7401. /* -*- Mode: js; js-indent-level: 2; -*- */
  7402. /*
  7403. * Copyright 2011 Mozilla Foundation and contributors
  7404. * Licensed under the New BSD license. See LICENSE or:
  7405. * http://opensource.org/licenses/BSD-3-Clause
  7406. *
  7407. * Based on the Base 64 VLQ implementation in Closure Compiler:
  7408. * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
  7409. *
  7410. * Copyright 2011 The Closure Compiler Authors. All rights reserved.
  7411. * Redistribution and use in source and binary forms, with or without
  7412. * modification, are permitted provided that the following conditions are
  7413. * met:
  7414. *
  7415. * * Redistributions of source code must retain the above copyright
  7416. * notice, this list of conditions and the following disclaimer.
  7417. * * Redistributions in binary form must reproduce the above
  7418. * copyright notice, this list of conditions and the following
  7419. * disclaimer in the documentation and/or other materials provided
  7420. * with the distribution.
  7421. * * Neither the name of Google Inc. nor the names of its
  7422. * contributors may be used to endorse or promote products derived
  7423. * from this software without specific prior written permission.
  7424. *
  7425. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  7426. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  7427. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  7428. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7429. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  7430. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  7431. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  7432. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  7433. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  7434. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  7435. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  7436. */
  7437. // A single base 64 digit can contain 6 bits of data. For the base 64 variable
  7438. // length quantities we use in the source map spec, the first bit is the sign,
  7439. // the next four bits are the actual value, and the 6th bit is the
  7440. // continuation bit. The continuation bit tells us whether there are more
  7441. // digits in this value following this digit.
  7442. //
  7443. // Continuation
  7444. // | Sign
  7445. // | |
  7446. // V V
  7447. // 101011
  7448. var VLQ_BASE_SHIFT = 5;
  7449. // binary: 100000
  7450. var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
  7451. // binary: 011111
  7452. var VLQ_BASE_MASK = VLQ_BASE - 1;
  7453. // binary: 100000
  7454. var VLQ_CONTINUATION_BIT = VLQ_BASE;
  7455. /**
  7456. * Converts from a two-complement value to a value where the sign bit is
  7457. * placed in the least significant bit. For example, as decimals:
  7458. * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
  7459. * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
  7460. */
  7461. function toVLQSigned(aValue) {
  7462. return aValue < 0
  7463. ? ((-aValue) << 1) + 1
  7464. : (aValue << 1) + 0;
  7465. }
  7466. /**
  7467. * Converts to a two-complement value from a value where the sign bit is
  7468. * placed in the least significant bit. For example, as decimals:
  7469. * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
  7470. * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
  7471. */
  7472. function fromVLQSigned(aValue) {
  7473. var isNegative = (aValue & 1) === 1;
  7474. var shifted = aValue >> 1;
  7475. return isNegative
  7476. ? -shifted
  7477. : shifted;
  7478. }
  7479. /**
  7480. * Returns the base 64 VLQ encoded value.
  7481. */
  7482. var encode$1 = function base64VLQ_encode(aValue) {
  7483. var encoded = "";
  7484. var digit;
  7485. var vlq = toVLQSigned(aValue);
  7486. do {
  7487. digit = vlq & VLQ_BASE_MASK;
  7488. vlq >>>= VLQ_BASE_SHIFT;
  7489. if (vlq > 0) {
  7490. // There are still more digits in this value, so we must make sure the
  7491. // continuation bit is marked.
  7492. digit |= VLQ_CONTINUATION_BIT;
  7493. }
  7494. encoded += base64.encode(digit);
  7495. } while (vlq > 0);
  7496. return encoded;
  7497. };
  7498. /**
  7499. * Decodes the next base 64 VLQ value from the given string and returns the
  7500. * value and the rest of the string via the out parameter.
  7501. */
  7502. var decode$1 = function base64VLQ_decode(aStr, aIndex, aOutParam) {
  7503. var strLen = aStr.length;
  7504. var result = 0;
  7505. var shift = 0;
  7506. var continuation, digit;
  7507. do {
  7508. if (aIndex >= strLen) {
  7509. throw new Error("Expected more digits in base 64 VLQ value.");
  7510. }
  7511. digit = base64.decode(aStr.charCodeAt(aIndex++));
  7512. if (digit === -1) {
  7513. throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
  7514. }
  7515. continuation = !!(digit & VLQ_CONTINUATION_BIT);
  7516. digit &= VLQ_BASE_MASK;
  7517. result = result + (digit << shift);
  7518. shift += VLQ_BASE_SHIFT;
  7519. } while (continuation);
  7520. aOutParam.value = fromVLQSigned(result);
  7521. aOutParam.rest = aIndex;
  7522. };
  7523. var base64Vlq = {
  7524. encode: encode$1,
  7525. decode: decode$1
  7526. };
  7527. var util = createCommonjsModule(function (module, exports) {
  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. /**
  7535. * This is a helper function for getting values from parameter/options
  7536. * objects.
  7537. *
  7538. * @param args The object we are extracting values from
  7539. * @param name The name of the property we are getting.
  7540. * @param defaultValue An optional value to return if the property is missing
  7541. * from the object. If this is not specified and the property is missing, an
  7542. * error will be thrown.
  7543. */
  7544. function getArg(aArgs, aName, aDefaultValue) {
  7545. if (aName in aArgs) {
  7546. return aArgs[aName];
  7547. } else if (arguments.length === 3) {
  7548. return aDefaultValue;
  7549. } else {
  7550. throw new Error('"' + aName + '" is a required argument.');
  7551. }
  7552. }
  7553. exports.getArg = getArg;
  7554. var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
  7555. var dataUrlRegexp = /^data:.+\,.+$/;
  7556. function urlParse(aUrl) {
  7557. var match = aUrl.match(urlRegexp);
  7558. if (!match) {
  7559. return null;
  7560. }
  7561. return {
  7562. scheme: match[1],
  7563. auth: match[2],
  7564. host: match[3],
  7565. port: match[4],
  7566. path: match[5]
  7567. };
  7568. }
  7569. exports.urlParse = urlParse;
  7570. function urlGenerate(aParsedUrl) {
  7571. var url = '';
  7572. if (aParsedUrl.scheme) {
  7573. url += aParsedUrl.scheme + ':';
  7574. }
  7575. url += '//';
  7576. if (aParsedUrl.auth) {
  7577. url += aParsedUrl.auth + '@';
  7578. }
  7579. if (aParsedUrl.host) {
  7580. url += aParsedUrl.host;
  7581. }
  7582. if (aParsedUrl.port) {
  7583. url += ":" + aParsedUrl.port;
  7584. }
  7585. if (aParsedUrl.path) {
  7586. url += aParsedUrl.path;
  7587. }
  7588. return url;
  7589. }
  7590. exports.urlGenerate = urlGenerate;
  7591. /**
  7592. * Normalizes a path, or the path portion of a URL:
  7593. *
  7594. * - Replaces consecutive slashes with one slash.
  7595. * - Removes unnecessary '.' parts.
  7596. * - Removes unnecessary '<dir>/..' parts.
  7597. *
  7598. * Based on code in the Node.js 'path' core module.
  7599. *
  7600. * @param aPath The path or url to normalize.
  7601. */
  7602. function normalize(aPath) {
  7603. var path = aPath;
  7604. var url = urlParse(aPath);
  7605. if (url) {
  7606. if (!url.path) {
  7607. return aPath;
  7608. }
  7609. path = url.path;
  7610. }
  7611. var isAbsolute = exports.isAbsolute(path);
  7612. var parts = path.split(/\/+/);
  7613. for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
  7614. part = parts[i];
  7615. if (part === '.') {
  7616. parts.splice(i, 1);
  7617. } else if (part === '..') {
  7618. up++;
  7619. } else if (up > 0) {
  7620. if (part === '') {
  7621. // The first part is blank if the path is absolute. Trying to go
  7622. // above the root is a no-op. Therefore we can remove all '..' parts
  7623. // directly after the root.
  7624. parts.splice(i + 1, up);
  7625. up = 0;
  7626. } else {
  7627. parts.splice(i, 2);
  7628. up--;
  7629. }
  7630. }
  7631. }
  7632. path = parts.join('/');
  7633. if (path === '') {
  7634. path = isAbsolute ? '/' : '.';
  7635. }
  7636. if (url) {
  7637. url.path = path;
  7638. return urlGenerate(url);
  7639. }
  7640. return path;
  7641. }
  7642. exports.normalize = normalize;
  7643. /**
  7644. * Joins two paths/URLs.
  7645. *
  7646. * @param aRoot The root path or URL.
  7647. * @param aPath The path or URL to be joined with the root.
  7648. *
  7649. * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  7650. * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  7651. * first.
  7652. * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
  7653. * is updated with the result and aRoot is returned. Otherwise the result
  7654. * is returned.
  7655. * - If aPath is absolute, the result is aPath.
  7656. * - Otherwise the two paths are joined with a slash.
  7657. * - Joining for example 'http://' and 'www.example.com' is also supported.
  7658. */
  7659. function join(aRoot, aPath) {
  7660. if (aRoot === "") {
  7661. aRoot = ".";
  7662. }
  7663. if (aPath === "") {
  7664. aPath = ".";
  7665. }
  7666. var aPathUrl = urlParse(aPath);
  7667. var aRootUrl = urlParse(aRoot);
  7668. if (aRootUrl) {
  7669. aRoot = aRootUrl.path || '/';
  7670. }
  7671. // `join(foo, '//www.example.org')`
  7672. if (aPathUrl && !aPathUrl.scheme) {
  7673. if (aRootUrl) {
  7674. aPathUrl.scheme = aRootUrl.scheme;
  7675. }
  7676. return urlGenerate(aPathUrl);
  7677. }
  7678. if (aPathUrl || aPath.match(dataUrlRegexp)) {
  7679. return aPath;
  7680. }
  7681. // `join('http://', 'www.example.com')`
  7682. if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
  7683. aRootUrl.host = aPath;
  7684. return urlGenerate(aRootUrl);
  7685. }
  7686. var joined = aPath.charAt(0) === '/'
  7687. ? aPath
  7688. : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
  7689. if (aRootUrl) {
  7690. aRootUrl.path = joined;
  7691. return urlGenerate(aRootUrl);
  7692. }
  7693. return joined;
  7694. }
  7695. exports.join = join;
  7696. exports.isAbsolute = function (aPath) {
  7697. return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
  7698. };
  7699. /**
  7700. * Make a path relative to a URL or another path.
  7701. *
  7702. * @param aRoot The root path or URL.
  7703. * @param aPath The path or URL to be made relative to aRoot.
  7704. */
  7705. function relative(aRoot, aPath) {
  7706. if (aRoot === "") {
  7707. aRoot = ".";
  7708. }
  7709. aRoot = aRoot.replace(/\/$/, '');
  7710. // It is possible for the path to be above the root. In this case, simply
  7711. // checking whether the root is a prefix of the path won't work. Instead, we
  7712. // need to remove components from the root one by one, until either we find
  7713. // a prefix that fits, or we run out of components to remove.
  7714. var level = 0;
  7715. while (aPath.indexOf(aRoot + '/') !== 0) {
  7716. var index = aRoot.lastIndexOf("/");
  7717. if (index < 0) {
  7718. return aPath;
  7719. }
  7720. // If the only part of the root that is left is the scheme (i.e. http://,
  7721. // file:///, etc.), one or more slashes (/), or simply nothing at all, we
  7722. // have exhausted all components, so the path is not relative to the root.
  7723. aRoot = aRoot.slice(0, index);
  7724. if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
  7725. return aPath;
  7726. }
  7727. ++level;
  7728. }
  7729. // Make sure we add a "../" for each component we removed from the root.
  7730. return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  7731. }
  7732. exports.relative = relative;
  7733. var supportsNullProto = (function () {
  7734. var obj = Object.create(null);
  7735. return !('__proto__' in obj);
  7736. }());
  7737. function identity (s) {
  7738. return s;
  7739. }
  7740. /**
  7741. * Because behavior goes wacky when you set `__proto__` on objects, we
  7742. * have to prefix all the strings in our set with an arbitrary character.
  7743. *
  7744. * See https://github.com/mozilla/source-map/pull/31 and
  7745. * https://github.com/mozilla/source-map/issues/30
  7746. *
  7747. * @param String aStr
  7748. */
  7749. function toSetString(aStr) {
  7750. if (isProtoString(aStr)) {
  7751. return '$' + aStr;
  7752. }
  7753. return aStr;
  7754. }
  7755. exports.toSetString = supportsNullProto ? identity : toSetString;
  7756. function fromSetString(aStr) {
  7757. if (isProtoString(aStr)) {
  7758. return aStr.slice(1);
  7759. }
  7760. return aStr;
  7761. }
  7762. exports.fromSetString = supportsNullProto ? identity : fromSetString;
  7763. function isProtoString(s) {
  7764. if (!s) {
  7765. return false;
  7766. }
  7767. var length = s.length;
  7768. if (length < 9 /* "__proto__".length */) {
  7769. return false;
  7770. }
  7771. if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
  7772. s.charCodeAt(length - 2) !== 95 /* '_' */ ||
  7773. s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
  7774. s.charCodeAt(length - 4) !== 116 /* 't' */ ||
  7775. s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
  7776. s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
  7777. s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
  7778. s.charCodeAt(length - 8) !== 95 /* '_' */ ||
  7779. s.charCodeAt(length - 9) !== 95 /* '_' */) {
  7780. return false;
  7781. }
  7782. for (var i = length - 10; i >= 0; i--) {
  7783. if (s.charCodeAt(i) !== 36 /* '$' */) {
  7784. return false;
  7785. }
  7786. }
  7787. return true;
  7788. }
  7789. /**
  7790. * Comparator between two mappings where the original positions are compared.
  7791. *
  7792. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  7793. * mappings with the same original source/line/column, but different generated
  7794. * line and column the same. Useful when searching for a mapping with a
  7795. * stubbed out mapping.
  7796. */
  7797. function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
  7798. var cmp = strcmp(mappingA.source, mappingB.source);
  7799. if (cmp !== 0) {
  7800. return cmp;
  7801. }
  7802. cmp = mappingA.originalLine - mappingB.originalLine;
  7803. if (cmp !== 0) {
  7804. return cmp;
  7805. }
  7806. cmp = mappingA.originalColumn - mappingB.originalColumn;
  7807. if (cmp !== 0 || onlyCompareOriginal) {
  7808. return cmp;
  7809. }
  7810. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  7811. if (cmp !== 0) {
  7812. return cmp;
  7813. }
  7814. cmp = mappingA.generatedLine - mappingB.generatedLine;
  7815. if (cmp !== 0) {
  7816. return cmp;
  7817. }
  7818. return strcmp(mappingA.name, mappingB.name);
  7819. }
  7820. exports.compareByOriginalPositions = compareByOriginalPositions;
  7821. /**
  7822. * Comparator between two mappings with deflated source and name indices where
  7823. * the generated positions are compared.
  7824. *
  7825. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  7826. * mappings with the same generated line and column, but different
  7827. * source/name/original line and column the same. Useful when searching for a
  7828. * mapping with a stubbed out mapping.
  7829. */
  7830. function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
  7831. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  7832. if (cmp !== 0) {
  7833. return cmp;
  7834. }
  7835. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  7836. if (cmp !== 0 || onlyCompareGenerated) {
  7837. return cmp;
  7838. }
  7839. cmp = strcmp(mappingA.source, mappingB.source);
  7840. if (cmp !== 0) {
  7841. return cmp;
  7842. }
  7843. cmp = mappingA.originalLine - mappingB.originalLine;
  7844. if (cmp !== 0) {
  7845. return cmp;
  7846. }
  7847. cmp = mappingA.originalColumn - mappingB.originalColumn;
  7848. if (cmp !== 0) {
  7849. return cmp;
  7850. }
  7851. return strcmp(mappingA.name, mappingB.name);
  7852. }
  7853. exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
  7854. function strcmp(aStr1, aStr2) {
  7855. if (aStr1 === aStr2) {
  7856. return 0;
  7857. }
  7858. if (aStr1 === null) {
  7859. return 1; // aStr2 !== null
  7860. }
  7861. if (aStr2 === null) {
  7862. return -1; // aStr1 !== null
  7863. }
  7864. if (aStr1 > aStr2) {
  7865. return 1;
  7866. }
  7867. return -1;
  7868. }
  7869. /**
  7870. * Comparator between two mappings with inflated source and name strings where
  7871. * the generated positions are compared.
  7872. */
  7873. function compareByGeneratedPositionsInflated(mappingA, mappingB) {
  7874. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  7875. if (cmp !== 0) {
  7876. return cmp;
  7877. }
  7878. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  7879. if (cmp !== 0) {
  7880. return cmp;
  7881. }
  7882. cmp = strcmp(mappingA.source, mappingB.source);
  7883. if (cmp !== 0) {
  7884. return cmp;
  7885. }
  7886. cmp = mappingA.originalLine - mappingB.originalLine;
  7887. if (cmp !== 0) {
  7888. return cmp;
  7889. }
  7890. cmp = mappingA.originalColumn - mappingB.originalColumn;
  7891. if (cmp !== 0) {
  7892. return cmp;
  7893. }
  7894. return strcmp(mappingA.name, mappingB.name);
  7895. }
  7896. exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
  7897. /**
  7898. * Strip any JSON XSSI avoidance prefix from the string (as documented
  7899. * in the source maps specification), and then parse the string as
  7900. * JSON.
  7901. */
  7902. function parseSourceMapInput(str) {
  7903. return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
  7904. }
  7905. exports.parseSourceMapInput = parseSourceMapInput;
  7906. /**
  7907. * Compute the URL of a source given the the source root, the source's
  7908. * URL, and the source map's URL.
  7909. */
  7910. function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
  7911. sourceURL = sourceURL || '';
  7912. if (sourceRoot) {
  7913. // This follows what Chrome does.
  7914. if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
  7915. sourceRoot += '/';
  7916. }
  7917. // The spec says:
  7918. // Line 4: An optional source root, useful for relocating source
  7919. // files on a server or removing repeated values in the
  7920. // “sources” entry. This value is prepended to the individual
  7921. // entries in the “source” field.
  7922. sourceURL = sourceRoot + sourceURL;
  7923. }
  7924. // Historically, SourceMapConsumer did not take the sourceMapURL as
  7925. // a parameter. This mode is still somewhat supported, which is why
  7926. // this code block is conditional. However, it's preferable to pass
  7927. // the source map URL to SourceMapConsumer, so that this function
  7928. // can implement the source URL resolution algorithm as outlined in
  7929. // the spec. This block is basically the equivalent of:
  7930. // new URL(sourceURL, sourceMapURL).toString()
  7931. // ... except it avoids using URL, which wasn't available in the
  7932. // older releases of node still supported by this library.
  7933. //
  7934. // The spec says:
  7935. // If the sources are not absolute URLs after prepending of the
  7936. // “sourceRoot”, the sources are resolved relative to the
  7937. // SourceMap (like resolving script src in a html document).
  7938. if (sourceMapURL) {
  7939. var parsed = urlParse(sourceMapURL);
  7940. if (!parsed) {
  7941. throw new Error("sourceMapURL could not be parsed");
  7942. }
  7943. if (parsed.path) {
  7944. // Strip the last path component, but keep the "/".
  7945. var index = parsed.path.lastIndexOf('/');
  7946. if (index >= 0) {
  7947. parsed.path = parsed.path.substring(0, index + 1);
  7948. }
  7949. }
  7950. sourceURL = join(urlGenerate(parsed), sourceURL);
  7951. }
  7952. return normalize(sourceURL);
  7953. }
  7954. exports.computeSourceURL = computeSourceURL;
  7955. });
  7956. var util_1 = util.getArg;
  7957. var util_2 = util.urlParse;
  7958. var util_3 = util.urlGenerate;
  7959. var util_4 = util.normalize;
  7960. var util_5 = util.join;
  7961. var util_6 = util.isAbsolute;
  7962. var util_7 = util.relative;
  7963. var util_8 = util.toSetString;
  7964. var util_9 = util.fromSetString;
  7965. var util_10 = util.compareByOriginalPositions;
  7966. var util_11 = util.compareByGeneratedPositionsDeflated;
  7967. var util_12 = util.compareByGeneratedPositionsInflated;
  7968. var util_13 = util.parseSourceMapInput;
  7969. var util_14 = util.computeSourceURL;
  7970. /* -*- Mode: js; js-indent-level: 2; -*- */
  7971. /*
  7972. * Copyright 2011 Mozilla Foundation and contributors
  7973. * Licensed under the New BSD license. See LICENSE or:
  7974. * http://opensource.org/licenses/BSD-3-Clause
  7975. */
  7976. var has = Object.prototype.hasOwnProperty;
  7977. var hasNativeMap = typeof Map !== "undefined";
  7978. /**
  7979. * A data structure which is a combination of an array and a set. Adding a new
  7980. * member is O(1), testing for membership is O(1), and finding the index of an
  7981. * element is O(1). Removing elements from the set is not supported. Only
  7982. * strings are supported for membership.
  7983. */
  7984. function ArraySet() {
  7985. this._array = [];
  7986. this._set = hasNativeMap ? new Map() : Object.create(null);
  7987. }
  7988. /**
  7989. * Static method for creating ArraySet instances from an existing array.
  7990. */
  7991. ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
  7992. var set = new ArraySet();
  7993. for (var i = 0, len = aArray.length; i < len; i++) {
  7994. set.add(aArray[i], aAllowDuplicates);
  7995. }
  7996. return set;
  7997. };
  7998. /**
  7999. * Return how many unique items are in this ArraySet. If duplicates have been
  8000. * added, than those do not count towards the size.
  8001. *
  8002. * @returns Number
  8003. */
  8004. ArraySet.prototype.size = function ArraySet_size() {
  8005. return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
  8006. };
  8007. /**
  8008. * Add the given string to this set.
  8009. *
  8010. * @param String aStr
  8011. */
  8012. ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
  8013. var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
  8014. var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
  8015. var idx = this._array.length;
  8016. if (!isDuplicate || aAllowDuplicates) {
  8017. this._array.push(aStr);
  8018. }
  8019. if (!isDuplicate) {
  8020. if (hasNativeMap) {
  8021. this._set.set(aStr, idx);
  8022. } else {
  8023. this._set[sStr] = idx;
  8024. }
  8025. }
  8026. };
  8027. /**
  8028. * Is the given string a member of this set?
  8029. *
  8030. * @param String aStr
  8031. */
  8032. ArraySet.prototype.has = function ArraySet_has(aStr) {
  8033. if (hasNativeMap) {
  8034. return this._set.has(aStr);
  8035. } else {
  8036. var sStr = util.toSetString(aStr);
  8037. return has.call(this._set, sStr);
  8038. }
  8039. };
  8040. /**
  8041. * What is the index of the given string in the array?
  8042. *
  8043. * @param String aStr
  8044. */
  8045. ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
  8046. if (hasNativeMap) {
  8047. var idx = this._set.get(aStr);
  8048. if (idx >= 0) {
  8049. return idx;
  8050. }
  8051. } else {
  8052. var sStr = util.toSetString(aStr);
  8053. if (has.call(this._set, sStr)) {
  8054. return this._set[sStr];
  8055. }
  8056. }
  8057. throw new Error('"' + aStr + '" is not in the set.');
  8058. };
  8059. /**
  8060. * What is the element at the given index?
  8061. *
  8062. * @param Number aIdx
  8063. */
  8064. ArraySet.prototype.at = function ArraySet_at(aIdx) {
  8065. if (aIdx >= 0 && aIdx < this._array.length) {
  8066. return this._array[aIdx];
  8067. }
  8068. throw new Error('No element indexed by ' + aIdx);
  8069. };
  8070. /**
  8071. * Returns the array representation of this set (which has the proper indices
  8072. * indicated by indexOf). Note that this is a copy of the internal array used
  8073. * for storing the members so that no one can mess with internal state.
  8074. */
  8075. ArraySet.prototype.toArray = function ArraySet_toArray() {
  8076. return this._array.slice();
  8077. };
  8078. var ArraySet_1 = ArraySet;
  8079. var arraySet = {
  8080. ArraySet: ArraySet_1
  8081. };
  8082. /* -*- Mode: js; js-indent-level: 2; -*- */
  8083. /*
  8084. * Copyright 2014 Mozilla Foundation and contributors
  8085. * Licensed under the New BSD license. See LICENSE or:
  8086. * http://opensource.org/licenses/BSD-3-Clause
  8087. */
  8088. /**
  8089. * Determine whether mappingB is after mappingA with respect to generated
  8090. * position.
  8091. */
  8092. function generatedPositionAfter(mappingA, mappingB) {
  8093. // Optimized for most common case
  8094. var lineA = mappingA.generatedLine;
  8095. var lineB = mappingB.generatedLine;
  8096. var columnA = mappingA.generatedColumn;
  8097. var columnB = mappingB.generatedColumn;
  8098. return lineB > lineA || lineB == lineA && columnB >= columnA ||
  8099. util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
  8100. }
  8101. /**
  8102. * A data structure to provide a sorted view of accumulated mappings in a
  8103. * performance conscious manner. It trades a neglibable overhead in general
  8104. * case for a large speedup in case of mappings being added in order.
  8105. */
  8106. function MappingList() {
  8107. this._array = [];
  8108. this._sorted = true;
  8109. // Serves as infimum
  8110. this._last = {generatedLine: -1, generatedColumn: 0};
  8111. }
  8112. /**
  8113. * Iterate through internal items. This method takes the same arguments that
  8114. * `Array.prototype.forEach` takes.
  8115. *
  8116. * NOTE: The order of the mappings is NOT guaranteed.
  8117. */
  8118. MappingList.prototype.unsortedForEach =
  8119. function MappingList_forEach(aCallback, aThisArg) {
  8120. this._array.forEach(aCallback, aThisArg);
  8121. };
  8122. /**
  8123. * Add the given source mapping.
  8124. *
  8125. * @param Object aMapping
  8126. */
  8127. MappingList.prototype.add = function MappingList_add(aMapping) {
  8128. if (generatedPositionAfter(this._last, aMapping)) {
  8129. this._last = aMapping;
  8130. this._array.push(aMapping);
  8131. } else {
  8132. this._sorted = false;
  8133. this._array.push(aMapping);
  8134. }
  8135. };
  8136. /**
  8137. * Returns the flat, sorted array of mappings. The mappings are sorted by
  8138. * generated position.
  8139. *
  8140. * WARNING: This method returns internal data without copying, for
  8141. * performance. The return value must NOT be mutated, and should be treated as
  8142. * an immutable borrow. If you want to take ownership, you must make your own
  8143. * copy.
  8144. */
  8145. MappingList.prototype.toArray = function MappingList_toArray() {
  8146. if (!this._sorted) {
  8147. this._array.sort(util.compareByGeneratedPositionsInflated);
  8148. this._sorted = true;
  8149. }
  8150. return this._array;
  8151. };
  8152. var MappingList_1 = MappingList;
  8153. var mappingList = {
  8154. MappingList: MappingList_1
  8155. };
  8156. /* -*- Mode: js; js-indent-level: 2; -*- */
  8157. /*
  8158. * Copyright 2011 Mozilla Foundation and contributors
  8159. * Licensed under the New BSD license. See LICENSE or:
  8160. * http://opensource.org/licenses/BSD-3-Clause
  8161. */
  8162. var ArraySet$1 = arraySet.ArraySet;
  8163. var MappingList$1 = mappingList.MappingList;
  8164. /**
  8165. * An instance of the SourceMapGenerator represents a source map which is
  8166. * being built incrementally. You may pass an object with the following
  8167. * properties:
  8168. *
  8169. * - file: The filename of the generated source.
  8170. * - sourceRoot: A root for all relative URLs in this source map.
  8171. */
  8172. function SourceMapGenerator(aArgs) {
  8173. if (!aArgs) {
  8174. aArgs = {};
  8175. }
  8176. this._file = util.getArg(aArgs, 'file', null);
  8177. this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
  8178. this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
  8179. this._sources = new ArraySet$1();
  8180. this._names = new ArraySet$1();
  8181. this._mappings = new MappingList$1();
  8182. this._sourcesContents = null;
  8183. }
  8184. SourceMapGenerator.prototype._version = 3;
  8185. /**
  8186. * Creates a new SourceMapGenerator based on a SourceMapConsumer
  8187. *
  8188. * @param aSourceMapConsumer The SourceMap.
  8189. */
  8190. SourceMapGenerator.fromSourceMap =
  8191. function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
  8192. var sourceRoot = aSourceMapConsumer.sourceRoot;
  8193. var generator = new SourceMapGenerator({
  8194. file: aSourceMapConsumer.file,
  8195. sourceRoot: sourceRoot
  8196. });
  8197. aSourceMapConsumer.eachMapping(function (mapping) {
  8198. var newMapping = {
  8199. generated: {
  8200. line: mapping.generatedLine,
  8201. column: mapping.generatedColumn
  8202. }
  8203. };
  8204. if (mapping.source != null) {
  8205. newMapping.source = mapping.source;
  8206. if (sourceRoot != null) {
  8207. newMapping.source = util.relative(sourceRoot, newMapping.source);
  8208. }
  8209. newMapping.original = {
  8210. line: mapping.originalLine,
  8211. column: mapping.originalColumn
  8212. };
  8213. if (mapping.name != null) {
  8214. newMapping.name = mapping.name;
  8215. }
  8216. }
  8217. generator.addMapping(newMapping);
  8218. });
  8219. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  8220. var sourceRelative = sourceFile;
  8221. if (sourceRoot !== null) {
  8222. sourceRelative = util.relative(sourceRoot, sourceFile);
  8223. }
  8224. if (!generator._sources.has(sourceRelative)) {
  8225. generator._sources.add(sourceRelative);
  8226. }
  8227. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  8228. if (content != null) {
  8229. generator.setSourceContent(sourceFile, content);
  8230. }
  8231. });
  8232. return generator;
  8233. };
  8234. /**
  8235. * Add a single mapping from original source line and column to the generated
  8236. * source's line and column for this source map being created. The mapping
  8237. * object should have the following properties:
  8238. *
  8239. * - generated: An object with the generated line and column positions.
  8240. * - original: An object with the original line and column positions.
  8241. * - source: The original source file (relative to the sourceRoot).
  8242. * - name: An optional original token name for this mapping.
  8243. */
  8244. SourceMapGenerator.prototype.addMapping =
  8245. function SourceMapGenerator_addMapping(aArgs) {
  8246. var generated = util.getArg(aArgs, 'generated');
  8247. var original = util.getArg(aArgs, 'original', null);
  8248. var source = util.getArg(aArgs, 'source', null);
  8249. var name = util.getArg(aArgs, 'name', null);
  8250. if (!this._skipValidation) {
  8251. this._validateMapping(generated, original, source, name);
  8252. }
  8253. if (source != null) {
  8254. source = String(source);
  8255. if (!this._sources.has(source)) {
  8256. this._sources.add(source);
  8257. }
  8258. }
  8259. if (name != null) {
  8260. name = String(name);
  8261. if (!this._names.has(name)) {
  8262. this._names.add(name);
  8263. }
  8264. }
  8265. this._mappings.add({
  8266. generatedLine: generated.line,
  8267. generatedColumn: generated.column,
  8268. originalLine: original != null && original.line,
  8269. originalColumn: original != null && original.column,
  8270. source: source,
  8271. name: name
  8272. });
  8273. };
  8274. /**
  8275. * Set the source content for a source file.
  8276. */
  8277. SourceMapGenerator.prototype.setSourceContent =
  8278. function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
  8279. var source = aSourceFile;
  8280. if (this._sourceRoot != null) {
  8281. source = util.relative(this._sourceRoot, source);
  8282. }
  8283. if (aSourceContent != null) {
  8284. // Add the source content to the _sourcesContents map.
  8285. // Create a new _sourcesContents map if the property is null.
  8286. if (!this._sourcesContents) {
  8287. this._sourcesContents = Object.create(null);
  8288. }
  8289. this._sourcesContents[util.toSetString(source)] = aSourceContent;
  8290. } else if (this._sourcesContents) {
  8291. // Remove the source file from the _sourcesContents map.
  8292. // If the _sourcesContents map is empty, set the property to null.
  8293. delete this._sourcesContents[util.toSetString(source)];
  8294. if (Object.keys(this._sourcesContents).length === 0) {
  8295. this._sourcesContents = null;
  8296. }
  8297. }
  8298. };
  8299. /**
  8300. * Applies the mappings of a sub-source-map for a specific source file to the
  8301. * source map being generated. Each mapping to the supplied source file is
  8302. * rewritten using the supplied source map. Note: The resolution for the
  8303. * resulting mappings is the minimium of this map and the supplied map.
  8304. *
  8305. * @param aSourceMapConsumer The source map to be applied.
  8306. * @param aSourceFile Optional. The filename of the source file.
  8307. * If omitted, SourceMapConsumer's file property will be used.
  8308. * @param aSourceMapPath Optional. The dirname of the path to the source map
  8309. * to be applied. If relative, it is relative to the SourceMapConsumer.
  8310. * This parameter is needed when the two source maps aren't in the same
  8311. * directory, and the source map to be applied contains relative source
  8312. * paths. If so, those relative source paths need to be rewritten
  8313. * relative to the SourceMapGenerator.
  8314. */
  8315. SourceMapGenerator.prototype.applySourceMap =
  8316. function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
  8317. var sourceFile = aSourceFile;
  8318. // If aSourceFile is omitted, we will use the file property of the SourceMap
  8319. if (aSourceFile == null) {
  8320. if (aSourceMapConsumer.file == null) {
  8321. throw new Error(
  8322. 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
  8323. 'or the source map\'s "file" property. Both were omitted.'
  8324. );
  8325. }
  8326. sourceFile = aSourceMapConsumer.file;
  8327. }
  8328. var sourceRoot = this._sourceRoot;
  8329. // Make "sourceFile" relative if an absolute Url is passed.
  8330. if (sourceRoot != null) {
  8331. sourceFile = util.relative(sourceRoot, sourceFile);
  8332. }
  8333. // Applying the SourceMap can add and remove items from the sources and
  8334. // the names array.
  8335. var newSources = new ArraySet$1();
  8336. var newNames = new ArraySet$1();
  8337. // Find mappings for the "sourceFile"
  8338. this._mappings.unsortedForEach(function (mapping) {
  8339. if (mapping.source === sourceFile && mapping.originalLine != null) {
  8340. // Check if it can be mapped by the source map, then update the mapping.
  8341. var original = aSourceMapConsumer.originalPositionFor({
  8342. line: mapping.originalLine,
  8343. column: mapping.originalColumn
  8344. });
  8345. if (original.source != null) {
  8346. // Copy mapping
  8347. mapping.source = original.source;
  8348. if (aSourceMapPath != null) {
  8349. mapping.source = util.join(aSourceMapPath, mapping.source);
  8350. }
  8351. if (sourceRoot != null) {
  8352. mapping.source = util.relative(sourceRoot, mapping.source);
  8353. }
  8354. mapping.originalLine = original.line;
  8355. mapping.originalColumn = original.column;
  8356. if (original.name != null) {
  8357. mapping.name = original.name;
  8358. }
  8359. }
  8360. }
  8361. var source = mapping.source;
  8362. if (source != null && !newSources.has(source)) {
  8363. newSources.add(source);
  8364. }
  8365. var name = mapping.name;
  8366. if (name != null && !newNames.has(name)) {
  8367. newNames.add(name);
  8368. }
  8369. }, this);
  8370. this._sources = newSources;
  8371. this._names = newNames;
  8372. // Copy sourcesContents of applied map.
  8373. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  8374. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  8375. if (content != null) {
  8376. if (aSourceMapPath != null) {
  8377. sourceFile = util.join(aSourceMapPath, sourceFile);
  8378. }
  8379. if (sourceRoot != null) {
  8380. sourceFile = util.relative(sourceRoot, sourceFile);
  8381. }
  8382. this.setSourceContent(sourceFile, content);
  8383. }
  8384. }, this);
  8385. };
  8386. /**
  8387. * A mapping can have one of the three levels of data:
  8388. *
  8389. * 1. Just the generated position.
  8390. * 2. The Generated position, original position, and original source.
  8391. * 3. Generated and original position, original source, as well as a name
  8392. * token.
  8393. *
  8394. * To maintain consistency, we validate that any new mapping being added falls
  8395. * in to one of these categories.
  8396. */
  8397. SourceMapGenerator.prototype._validateMapping =
  8398. function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
  8399. aName) {
  8400. // When aOriginal is truthy but has empty values for .line and .column,
  8401. // it is most likely a programmer error. In this case we throw a very
  8402. // specific error message to try to guide them the right way.
  8403. // For example: https://github.com/Polymer/polymer-bundler/pull/519
  8404. if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
  8405. throw new Error(
  8406. 'original.line and original.column are not numbers -- you probably meant to omit ' +
  8407. 'the original mapping entirely and only map the generated position. If so, pass ' +
  8408. 'null for the original mapping instead of an object with empty or null values.'
  8409. );
  8410. }
  8411. if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  8412. && aGenerated.line > 0 && aGenerated.column >= 0
  8413. && !aOriginal && !aSource && !aName) {
  8414. // Case 1.
  8415. return;
  8416. }
  8417. else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  8418. && aOriginal && 'line' in aOriginal && 'column' in aOriginal
  8419. && aGenerated.line > 0 && aGenerated.column >= 0
  8420. && aOriginal.line > 0 && aOriginal.column >= 0
  8421. && aSource) {
  8422. // Cases 2 and 3.
  8423. return;
  8424. }
  8425. else {
  8426. throw new Error('Invalid mapping: ' + JSON.stringify({
  8427. generated: aGenerated,
  8428. source: aSource,
  8429. original: aOriginal,
  8430. name: aName
  8431. }));
  8432. }
  8433. };
  8434. /**
  8435. * Serialize the accumulated mappings in to the stream of base 64 VLQs
  8436. * specified by the source map format.
  8437. */
  8438. SourceMapGenerator.prototype._serializeMappings =
  8439. function SourceMapGenerator_serializeMappings() {
  8440. var previousGeneratedColumn = 0;
  8441. var previousGeneratedLine = 1;
  8442. var previousOriginalColumn = 0;
  8443. var previousOriginalLine = 0;
  8444. var previousName = 0;
  8445. var previousSource = 0;
  8446. var result = '';
  8447. var next;
  8448. var mapping;
  8449. var nameIdx;
  8450. var sourceIdx;
  8451. var mappings = this._mappings.toArray();
  8452. for (var i = 0, len = mappings.length; i < len; i++) {
  8453. mapping = mappings[i];
  8454. next = '';
  8455. if (mapping.generatedLine !== previousGeneratedLine) {
  8456. previousGeneratedColumn = 0;
  8457. while (mapping.generatedLine !== previousGeneratedLine) {
  8458. next += ';';
  8459. previousGeneratedLine++;
  8460. }
  8461. }
  8462. else {
  8463. if (i > 0) {
  8464. if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
  8465. continue;
  8466. }
  8467. next += ',';
  8468. }
  8469. }
  8470. next += base64Vlq.encode(mapping.generatedColumn
  8471. - previousGeneratedColumn);
  8472. previousGeneratedColumn = mapping.generatedColumn;
  8473. if (mapping.source != null) {
  8474. sourceIdx = this._sources.indexOf(mapping.source);
  8475. next += base64Vlq.encode(sourceIdx - previousSource);
  8476. previousSource = sourceIdx;
  8477. // lines are stored 0-based in SourceMap spec version 3
  8478. next += base64Vlq.encode(mapping.originalLine - 1
  8479. - previousOriginalLine);
  8480. previousOriginalLine = mapping.originalLine - 1;
  8481. next += base64Vlq.encode(mapping.originalColumn
  8482. - previousOriginalColumn);
  8483. previousOriginalColumn = mapping.originalColumn;
  8484. if (mapping.name != null) {
  8485. nameIdx = this._names.indexOf(mapping.name);
  8486. next += base64Vlq.encode(nameIdx - previousName);
  8487. previousName = nameIdx;
  8488. }
  8489. }
  8490. result += next;
  8491. }
  8492. return result;
  8493. };
  8494. SourceMapGenerator.prototype._generateSourcesContent =
  8495. function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
  8496. return aSources.map(function (source) {
  8497. if (!this._sourcesContents) {
  8498. return null;
  8499. }
  8500. if (aSourceRoot != null) {
  8501. source = util.relative(aSourceRoot, source);
  8502. }
  8503. var key = util.toSetString(source);
  8504. return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
  8505. ? this._sourcesContents[key]
  8506. : null;
  8507. }, this);
  8508. };
  8509. /**
  8510. * Externalize the source map.
  8511. */
  8512. SourceMapGenerator.prototype.toJSON =
  8513. function SourceMapGenerator_toJSON() {
  8514. var map = {
  8515. version: this._version,
  8516. sources: this._sources.toArray(),
  8517. names: this._names.toArray(),
  8518. mappings: this._serializeMappings()
  8519. };
  8520. if (this._file != null) {
  8521. map.file = this._file;
  8522. }
  8523. if (this._sourceRoot != null) {
  8524. map.sourceRoot = this._sourceRoot;
  8525. }
  8526. if (this._sourcesContents) {
  8527. map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
  8528. }
  8529. return map;
  8530. };
  8531. /**
  8532. * Render the source map being generated to a string.
  8533. */
  8534. SourceMapGenerator.prototype.toString =
  8535. function SourceMapGenerator_toString() {
  8536. return JSON.stringify(this.toJSON());
  8537. };
  8538. var SourceMapGenerator_1 = SourceMapGenerator;
  8539. var sourceMapGenerator = {
  8540. SourceMapGenerator: SourceMapGenerator_1
  8541. };
  8542. var SourceMapGenerator$1 = sourceMapGenerator.SourceMapGenerator;
  8543. var trackNodes = {
  8544. Atrule: true,
  8545. Selector: true,
  8546. Declaration: true
  8547. };
  8548. var sourceMap = function generateSourceMap(handlers) {
  8549. var map = new SourceMapGenerator$1();
  8550. var line = 1;
  8551. var column = 0;
  8552. var generated = {
  8553. line: 1,
  8554. column: 0
  8555. };
  8556. var original = {
  8557. line: 0, // should be zero to add first mapping
  8558. column: 0
  8559. };
  8560. var sourceMappingActive = false;
  8561. var activatedGenerated = {
  8562. line: 1,
  8563. column: 0
  8564. };
  8565. var activatedMapping = {
  8566. generated: activatedGenerated
  8567. };
  8568. var handlersNode = handlers.node;
  8569. handlers.node = function(node) {
  8570. if (node.loc && node.loc.start && trackNodes.hasOwnProperty(node.type)) {
  8571. var nodeLine = node.loc.start.line;
  8572. var nodeColumn = node.loc.start.column - 1;
  8573. if (original.line !== nodeLine ||
  8574. original.column !== nodeColumn) {
  8575. original.line = nodeLine;
  8576. original.column = nodeColumn;
  8577. generated.line = line;
  8578. generated.column = column;
  8579. if (sourceMappingActive) {
  8580. sourceMappingActive = false;
  8581. if (generated.line !== activatedGenerated.line ||
  8582. generated.column !== activatedGenerated.column) {
  8583. map.addMapping(activatedMapping);
  8584. }
  8585. }
  8586. sourceMappingActive = true;
  8587. map.addMapping({
  8588. source: node.loc.source,
  8589. original: original,
  8590. generated: generated
  8591. });
  8592. }
  8593. }
  8594. handlersNode.call(this, node);
  8595. if (sourceMappingActive && trackNodes.hasOwnProperty(node.type)) {
  8596. activatedGenerated.line = line;
  8597. activatedGenerated.column = column;
  8598. }
  8599. };
  8600. var handlersChunk = handlers.chunk;
  8601. handlers.chunk = function(chunk) {
  8602. for (var i = 0; i < chunk.length; i++) {
  8603. if (chunk.charCodeAt(i) === 10) { // \n
  8604. line++;
  8605. column = 0;
  8606. } else {
  8607. column++;
  8608. }
  8609. }
  8610. handlersChunk(chunk);
  8611. };
  8612. var handlersResult = handlers.result;
  8613. handlers.result = function() {
  8614. if (sourceMappingActive) {
  8615. map.addMapping(activatedMapping);
  8616. }
  8617. return {
  8618. css: handlersResult(),
  8619. map: map
  8620. };
  8621. };
  8622. return handlers;
  8623. };
  8624. var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
  8625. function processChildren(node, delimeter) {
  8626. var list = node.children;
  8627. var prev = null;
  8628. if (typeof delimeter !== 'function') {
  8629. list.forEach(this.node, this);
  8630. } else {
  8631. list.forEach(function(node) {
  8632. if (prev !== null) {
  8633. delimeter.call(this, prev);
  8634. }
  8635. this.node(node);
  8636. prev = node;
  8637. }, this);
  8638. }
  8639. }
  8640. var create$2 = function createGenerator(config) {
  8641. function processNode(node) {
  8642. if (hasOwnProperty$3.call(types, node.type)) {
  8643. types[node.type].call(this, node);
  8644. } else {
  8645. throw new Error('Unknown node type: ' + node.type);
  8646. }
  8647. }
  8648. var types = {};
  8649. if (config.node) {
  8650. for (var name in config.node) {
  8651. types[name] = config.node[name].generate;
  8652. }
  8653. }
  8654. return function(node, options) {
  8655. var buffer = '';
  8656. var handlers = {
  8657. children: processChildren,
  8658. node: processNode,
  8659. chunk: function(chunk) {
  8660. buffer += chunk;
  8661. },
  8662. result: function() {
  8663. return buffer;
  8664. }
  8665. };
  8666. if (options) {
  8667. if (typeof options.decorator === 'function') {
  8668. handlers = options.decorator(handlers);
  8669. }
  8670. if (options.sourceMap) {
  8671. handlers = sourceMap(handlers);
  8672. }
  8673. }
  8674. handlers.node(node);
  8675. return handlers.result();
  8676. };
  8677. };
  8678. var create$3 = function createConvertors(walk) {
  8679. return {
  8680. fromPlainObject: function(ast) {
  8681. walk(ast, {
  8682. enter: function(node) {
  8683. if (node.children && node.children instanceof List_1 === false) {
  8684. node.children = new List_1().fromArray(node.children);
  8685. }
  8686. }
  8687. });
  8688. return ast;
  8689. },
  8690. toPlainObject: function(ast) {
  8691. walk(ast, {
  8692. leave: function(node) {
  8693. if (node.children && node.children instanceof List_1) {
  8694. node.children = node.children.toArray();
  8695. }
  8696. }
  8697. });
  8698. return ast;
  8699. }
  8700. };
  8701. };
  8702. var hasOwnProperty$4 = Object.prototype.hasOwnProperty;
  8703. var noop$4 = function() {};
  8704. function ensureFunction$1(value) {
  8705. return typeof value === 'function' ? value : noop$4;
  8706. }
  8707. function invokeForType(fn, type) {
  8708. return function(node, item, list) {
  8709. if (node.type === type) {
  8710. fn.call(this, node, item, list);
  8711. }
  8712. };
  8713. }
  8714. function getWalkersFromStructure(name, nodeType) {
  8715. var structure = nodeType.structure;
  8716. var walkers = [];
  8717. for (var key in structure) {
  8718. if (hasOwnProperty$4.call(structure, key) === false) {
  8719. continue;
  8720. }
  8721. var fieldTypes = structure[key];
  8722. var walker = {
  8723. name: key,
  8724. type: false,
  8725. nullable: false
  8726. };
  8727. if (!Array.isArray(structure[key])) {
  8728. fieldTypes = [structure[key]];
  8729. }
  8730. for (var i = 0; i < fieldTypes.length; i++) {
  8731. var fieldType = fieldTypes[i];
  8732. if (fieldType === null) {
  8733. walker.nullable = true;
  8734. } else if (typeof fieldType === 'string') {
  8735. walker.type = 'node';
  8736. } else if (Array.isArray(fieldType)) {
  8737. walker.type = 'list';
  8738. }
  8739. }
  8740. if (walker.type) {
  8741. walkers.push(walker);
  8742. }
  8743. }
  8744. if (walkers.length) {
  8745. return {
  8746. context: nodeType.walkContext,
  8747. fields: walkers
  8748. };
  8749. }
  8750. return null;
  8751. }
  8752. function getTypesFromConfig(config) {
  8753. var types = {};
  8754. for (var name in config.node) {
  8755. if (hasOwnProperty$4.call(config.node, name)) {
  8756. var nodeType = config.node[name];
  8757. if (!nodeType.structure) {
  8758. throw new Error('Missed `structure` field in `' + name + '` node type definition');
  8759. }
  8760. types[name] = getWalkersFromStructure(name, nodeType);
  8761. }
  8762. }
  8763. return types;
  8764. }
  8765. function createTypeIterator(config, reverse) {
  8766. var fields = config.fields.slice();
  8767. var contextName = config.context;
  8768. var useContext = typeof contextName === 'string';
  8769. if (reverse) {
  8770. fields.reverse();
  8771. }
  8772. return function(node, context, walk) {
  8773. var prevContextValue;
  8774. if (useContext) {
  8775. prevContextValue = context[contextName];
  8776. context[contextName] = node;
  8777. }
  8778. for (var i = 0; i < fields.length; i++) {
  8779. var field = fields[i];
  8780. var ref = node[field.name];
  8781. if (!field.nullable || ref) {
  8782. if (field.type === 'list') {
  8783. if (reverse) {
  8784. ref.forEachRight(walk);
  8785. } else {
  8786. ref.forEach(walk);
  8787. }
  8788. } else {
  8789. walk(ref);
  8790. }
  8791. }
  8792. }
  8793. if (useContext) {
  8794. context[contextName] = prevContextValue;
  8795. }
  8796. };
  8797. }
  8798. function createFastTraveralMap(iterators) {
  8799. return {
  8800. Atrule: {
  8801. StyleSheet: iterators.StyleSheet,
  8802. Atrule: iterators.Atrule,
  8803. Rule: iterators.Rule,
  8804. Block: iterators.Block
  8805. },
  8806. Rule: {
  8807. StyleSheet: iterators.StyleSheet,
  8808. Atrule: iterators.Atrule,
  8809. Rule: iterators.Rule,
  8810. Block: iterators.Block
  8811. },
  8812. Declaration: {
  8813. StyleSheet: iterators.StyleSheet,
  8814. Atrule: iterators.Atrule,
  8815. Rule: iterators.Rule,
  8816. Block: iterators.Block,
  8817. DeclarationList: iterators.DeclarationList
  8818. }
  8819. };
  8820. }
  8821. var create$4 = function createWalker(config) {
  8822. var types = getTypesFromConfig(config);
  8823. var iteratorsNatural = {};
  8824. var iteratorsReverse = {};
  8825. for (var name in types) {
  8826. if (hasOwnProperty$4.call(types, name) && types[name] !== null) {
  8827. iteratorsNatural[name] = createTypeIterator(types[name], false);
  8828. iteratorsReverse[name] = createTypeIterator(types[name], true);
  8829. }
  8830. }
  8831. var fastTraversalIteratorsNatural = createFastTraveralMap(iteratorsNatural);
  8832. var fastTraversalIteratorsReverse = createFastTraveralMap(iteratorsReverse);
  8833. var walk = function(root, options) {
  8834. function walkNode(node, item, list) {
  8835. enter.call(context, node, item, list);
  8836. if (iterators.hasOwnProperty(node.type)) {
  8837. iterators[node.type](node, context, walkNode);
  8838. }
  8839. leave.call(context, node, item, list);
  8840. }
  8841. var enter = noop$4;
  8842. var leave = noop$4;
  8843. var iterators = iteratorsNatural;
  8844. var context = {
  8845. root: root,
  8846. stylesheet: null,
  8847. atrule: null,
  8848. atrulePrelude: null,
  8849. rule: null,
  8850. selector: null,
  8851. block: null,
  8852. declaration: null,
  8853. function: null
  8854. };
  8855. if (typeof options === 'function') {
  8856. enter = options;
  8857. } else if (options) {
  8858. enter = ensureFunction$1(options.enter);
  8859. leave = ensureFunction$1(options.leave);
  8860. if (options.reverse) {
  8861. iterators = iteratorsReverse;
  8862. }
  8863. if (options.visit) {
  8864. if (fastTraversalIteratorsNatural.hasOwnProperty(options.visit)) {
  8865. iterators = options.reverse
  8866. ? fastTraversalIteratorsReverse[options.visit]
  8867. : fastTraversalIteratorsNatural[options.visit];
  8868. } else if (!types.hasOwnProperty(options.visit)) {
  8869. throw new Error('Bad value `' + options.visit + '` for `visit` option (should be: ' + Object.keys(types).join(', ') + ')');
  8870. }
  8871. enter = invokeForType(enter, options.visit);
  8872. leave = invokeForType(leave, options.visit);
  8873. }
  8874. }
  8875. if (enter === noop$4 && leave === noop$4) {
  8876. throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
  8877. }
  8878. // swap handlers in reverse mode to invert visit order
  8879. if (options.reverse) {
  8880. var tmp = enter;
  8881. enter = leave;
  8882. leave = tmp;
  8883. }
  8884. walkNode(root);
  8885. };
  8886. walk.find = function(ast, fn) {
  8887. var found = null;
  8888. walk(ast, function(node, item, list) {
  8889. if (found === null && fn.call(this, node, item, list)) {
  8890. found = node;
  8891. }
  8892. });
  8893. return found;
  8894. };
  8895. walk.findLast = function(ast, fn) {
  8896. var found = null;
  8897. walk(ast, {
  8898. reverse: true,
  8899. enter: function(node, item, list) {
  8900. if (found === null && fn.call(this, node, item, list)) {
  8901. found = node;
  8902. }
  8903. }
  8904. });
  8905. return found;
  8906. };
  8907. walk.findAll = function(ast, fn) {
  8908. var found = [];
  8909. walk(ast, function(node, item, list) {
  8910. if (fn.call(this, node, item, list)) {
  8911. found.push(node);
  8912. }
  8913. });
  8914. return found;
  8915. };
  8916. return walk;
  8917. };
  8918. var clone = function clone(node) {
  8919. var result = {};
  8920. for (var key in node) {
  8921. var value = node[key];
  8922. if (value) {
  8923. if (Array.isArray(value) || value instanceof List_1) {
  8924. value = value.map(clone);
  8925. } else if (value.constructor === Object) {
  8926. value = clone(value);
  8927. }
  8928. }
  8929. result[key] = value;
  8930. }
  8931. return result;
  8932. };
  8933. var hasOwnProperty$5 = Object.prototype.hasOwnProperty;
  8934. var shape = {
  8935. generic: true,
  8936. types: {},
  8937. atrules: {},
  8938. properties: {},
  8939. parseContext: {},
  8940. scope: {},
  8941. atrule: ['parse'],
  8942. pseudo: ['parse'],
  8943. node: ['name', 'structure', 'parse', 'generate', 'walkContext']
  8944. };
  8945. function isObject(value) {
  8946. return value && value.constructor === Object;
  8947. }
  8948. function copy(value) {
  8949. if (isObject(value)) {
  8950. return Object.assign({}, value);
  8951. } else {
  8952. return value;
  8953. }
  8954. }
  8955. function extend(dest, src) {
  8956. for (var key in src) {
  8957. if (hasOwnProperty$5.call(src, key)) {
  8958. if (isObject(dest[key])) {
  8959. extend(dest[key], copy(src[key]));
  8960. } else {
  8961. dest[key] = copy(src[key]);
  8962. }
  8963. }
  8964. }
  8965. }
  8966. function mix(dest, src, shape) {
  8967. for (var key in shape) {
  8968. if (hasOwnProperty$5.call(shape, key) === false) {
  8969. continue;
  8970. }
  8971. if (shape[key] === true) {
  8972. if (key in src) {
  8973. if (hasOwnProperty$5.call(src, key)) {
  8974. dest[key] = copy(src[key]);
  8975. }
  8976. }
  8977. } else if (shape[key]) {
  8978. if (isObject(shape[key])) {
  8979. var res = {};
  8980. extend(res, dest[key]);
  8981. extend(res, src[key]);
  8982. dest[key] = res;
  8983. } else if (Array.isArray(shape[key])) {
  8984. var res = {};
  8985. var innerShape = shape[key].reduce(function(s, k) {
  8986. s[k] = true;
  8987. return s;
  8988. }, {});
  8989. for (var name in dest[key]) {
  8990. if (hasOwnProperty$5.call(dest[key], name)) {
  8991. res[name] = {};
  8992. if (dest[key] && dest[key][name]) {
  8993. mix(res[name], dest[key][name], innerShape);
  8994. }
  8995. }
  8996. }
  8997. for (var name in src[key]) {
  8998. if (hasOwnProperty$5.call(src[key], name)) {
  8999. if (!res[name]) {
  9000. res[name] = {};
  9001. }
  9002. if (src[key] && src[key][name]) {
  9003. mix(res[name], src[key][name], innerShape);
  9004. }
  9005. }
  9006. }
  9007. dest[key] = res;
  9008. }
  9009. }
  9010. }
  9011. return dest;
  9012. }
  9013. var mix_1 = function(dest, src) {
  9014. return mix(dest, src, shape);
  9015. };
  9016. function createSyntax(config) {
  9017. var parse = create$1(config);
  9018. var walk = create$4(config);
  9019. var generate = create$2(config);
  9020. var convert = create$3(walk);
  9021. var syntax = {
  9022. List: List_1,
  9023. SyntaxError: _SyntaxError,
  9024. TokenStream: TokenStream_1,
  9025. Lexer: Lexer_1,
  9026. vendorPrefix: names.vendorPrefix,
  9027. keyword: names.keyword,
  9028. property: names.property,
  9029. isCustomProperty: names.isCustomProperty,
  9030. definitionSyntax: definitionSyntax,
  9031. lexer: null,
  9032. createLexer: function(config) {
  9033. return new Lexer_1(config, syntax, syntax.lexer.structure);
  9034. },
  9035. tokenize: tokenizer,
  9036. parse: parse,
  9037. walk: walk,
  9038. generate: generate,
  9039. find: walk.find,
  9040. findLast: walk.findLast,
  9041. findAll: walk.findAll,
  9042. clone: clone,
  9043. fromPlainObject: convert.fromPlainObject,
  9044. toPlainObject: convert.toPlainObject,
  9045. createSyntax: function(config) {
  9046. return createSyntax(mix_1({}, config));
  9047. },
  9048. fork: function(extension) {
  9049. var base = mix_1({}, config); // copy of config
  9050. return createSyntax(
  9051. typeof extension === 'function'
  9052. ? extension(base, Object.assign)
  9053. : mix_1(base, extension)
  9054. );
  9055. }
  9056. };
  9057. syntax.lexer = new Lexer_1({
  9058. generic: true,
  9059. types: config.types,
  9060. atrules: config.atrules,
  9061. properties: config.properties,
  9062. node: config.node
  9063. }, syntax);
  9064. return syntax;
  9065. }
  9066. var create_1 = function(config) {
  9067. return createSyntax(mix_1({}, config));
  9068. };
  9069. var create$5 = {
  9070. create: create_1
  9071. };
  9072. var atRules = {
  9073. "@charset": {
  9074. syntax: "@charset \"<charset>\";",
  9075. groups: [
  9076. "CSS Charsets"
  9077. ],
  9078. status: "standard",
  9079. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@charset"
  9080. },
  9081. "@counter-style": {
  9082. 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}",
  9083. interfaces: [
  9084. "CSSCounterStyleRule"
  9085. ],
  9086. groups: [
  9087. "CSS Counter Styles"
  9088. ],
  9089. descriptors: {
  9090. "additive-symbols": {
  9091. syntax: "[ <integer> && <symbol> ]#",
  9092. media: "all",
  9093. initial: "N/A",
  9094. percentages: "no",
  9095. computed: "asSpecified",
  9096. order: "orderOfAppearance",
  9097. status: "standard"
  9098. },
  9099. fallback: {
  9100. syntax: "<counter-style-name>",
  9101. media: "all",
  9102. initial: "decimal",
  9103. percentages: "no",
  9104. computed: "asSpecified",
  9105. order: "uniqueOrder",
  9106. status: "standard"
  9107. },
  9108. negative: {
  9109. syntax: "<symbol> <symbol>?",
  9110. media: "all",
  9111. initial: "\"-\" hyphen-minus",
  9112. percentages: "no",
  9113. computed: "asSpecified",
  9114. order: "orderOfAppearance",
  9115. status: "standard"
  9116. },
  9117. pad: {
  9118. syntax: "<integer> && <symbol>",
  9119. media: "all",
  9120. initial: "0 \"\"",
  9121. percentages: "no",
  9122. computed: "asSpecified",
  9123. order: "uniqueOrder",
  9124. status: "standard"
  9125. },
  9126. prefix: {
  9127. syntax: "<symbol>",
  9128. media: "all",
  9129. initial: "\"\"",
  9130. percentages: "no",
  9131. computed: "asSpecified",
  9132. order: "uniqueOrder",
  9133. status: "standard"
  9134. },
  9135. range: {
  9136. syntax: "[ [ <integer> | infinite ]{2} ]# | auto",
  9137. media: "all",
  9138. initial: "auto",
  9139. percentages: "no",
  9140. computed: "asSpecified",
  9141. order: "orderOfAppearance",
  9142. status: "standard"
  9143. },
  9144. "speak-as": {
  9145. syntax: "auto | bullets | numbers | words | spell-out | <counter-style-name>",
  9146. media: "all",
  9147. initial: "auto",
  9148. percentages: "no",
  9149. computed: "asSpecified",
  9150. order: "uniqueOrder",
  9151. status: "standard"
  9152. },
  9153. suffix: {
  9154. syntax: "<symbol>",
  9155. media: "all",
  9156. initial: "\". \"",
  9157. percentages: "no",
  9158. computed: "asSpecified",
  9159. order: "uniqueOrder",
  9160. status: "standard"
  9161. },
  9162. symbols: {
  9163. syntax: "<symbol>+",
  9164. media: "all",
  9165. initial: "N/A",
  9166. percentages: "no",
  9167. computed: "asSpecified",
  9168. order: "orderOfAppearance",
  9169. status: "standard"
  9170. },
  9171. system: {
  9172. syntax: "cyclic | numeric | alphabetic | symbolic | additive | [ fixed <integer>? ] | [ extends <counter-style-name> ]",
  9173. media: "all",
  9174. initial: "symbolic",
  9175. percentages: "no",
  9176. computed: "asSpecified",
  9177. order: "uniqueOrder",
  9178. status: "standard"
  9179. }
  9180. },
  9181. status: "standard",
  9182. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@counter-style"
  9183. },
  9184. "@document": {
  9185. syntax: "@document [ <url> | url-prefix(<string>) | domain(<string>) | media-document(<string>) | regexp(<string>) ]# {\n <group-rule-body>\n}",
  9186. interfaces: [
  9187. "CSSGroupingRule",
  9188. "CSSConditionRule"
  9189. ],
  9190. groups: [
  9191. "CSS Conditional Rules"
  9192. ],
  9193. status: "nonstandard",
  9194. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@document"
  9195. },
  9196. "@font-face": {
  9197. 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}",
  9198. interfaces: [
  9199. "CSSFontFaceRule"
  9200. ],
  9201. groups: [
  9202. "CSS Fonts"
  9203. ],
  9204. descriptors: {
  9205. "font-display": {
  9206. syntax: "[ auto | block | swap | fallback | optional ]",
  9207. media: "visual",
  9208. percentages: "no",
  9209. initial: "auto",
  9210. computed: "asSpecified",
  9211. order: "uniqueOrder",
  9212. status: "experimental"
  9213. },
  9214. "font-family": {
  9215. syntax: "<family-name>",
  9216. media: "all",
  9217. initial: "n/a (required)",
  9218. percentages: "no",
  9219. computed: "asSpecified",
  9220. order: "uniqueOrder",
  9221. status: "standard"
  9222. },
  9223. "font-feature-settings": {
  9224. syntax: "normal | <feature-tag-value>#",
  9225. media: "all",
  9226. initial: "normal",
  9227. percentages: "no",
  9228. computed: "asSpecified",
  9229. order: "orderOfAppearance",
  9230. status: "standard"
  9231. },
  9232. "font-variation-settings": {
  9233. syntax: "normal | [ <string> <number> ]#",
  9234. media: "all",
  9235. initial: "normal",
  9236. percentages: "no",
  9237. computed: "asSpecified",
  9238. order: "orderOfAppearance",
  9239. status: "standard"
  9240. },
  9241. "font-stretch": {
  9242. syntax: "<font-stretch-absolute>{1,2}",
  9243. media: "all",
  9244. initial: "normal",
  9245. percentages: "no",
  9246. computed: "asSpecified",
  9247. order: "uniqueOrder",
  9248. status: "standard"
  9249. },
  9250. "font-style": {
  9251. syntax: "normal | italic | oblique <angle>{0,2}",
  9252. media: "all",
  9253. initial: "normal",
  9254. percentages: "no",
  9255. computed: "asSpecified",
  9256. order: "uniqueOrder",
  9257. status: "standard"
  9258. },
  9259. "font-weight": {
  9260. syntax: "<font-weight-absolute>{1,2}",
  9261. media: "all",
  9262. initial: "normal",
  9263. percentages: "no",
  9264. computed: "asSpecified",
  9265. order: "uniqueOrder",
  9266. status: "standard"
  9267. },
  9268. "font-variant": {
  9269. 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 ]",
  9270. media: "all",
  9271. initial: "normal",
  9272. percentages: "no",
  9273. computed: "asSpecified",
  9274. order: "orderOfAppearance",
  9275. status: "standard"
  9276. },
  9277. src: {
  9278. syntax: "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#",
  9279. media: "all",
  9280. initial: "n/a (required)",
  9281. percentages: "no",
  9282. computed: "asSpecified",
  9283. order: "orderOfAppearance",
  9284. status: "standard"
  9285. },
  9286. "unicode-range": {
  9287. syntax: "<unicode-range>#",
  9288. media: "all",
  9289. initial: "U+0-10FFFF",
  9290. percentages: "no",
  9291. computed: "asSpecified",
  9292. order: "orderOfAppearance",
  9293. status: "standard"
  9294. }
  9295. },
  9296. status: "standard",
  9297. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@font-face"
  9298. },
  9299. "@font-feature-values": {
  9300. syntax: "@font-feature-values <family-name># {\n <feature-value-block-list>\n}",
  9301. interfaces: [
  9302. "CSSFontFeatureValuesRule"
  9303. ],
  9304. groups: [
  9305. "CSS Fonts"
  9306. ],
  9307. status: "standard",
  9308. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@font-feature-values"
  9309. },
  9310. "@import": {
  9311. syntax: "@import [ <string> | <url> ] [ <media-query-list> ]?;",
  9312. groups: [
  9313. "Media Queries"
  9314. ],
  9315. status: "standard",
  9316. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@import"
  9317. },
  9318. "@keyframes": {
  9319. syntax: "@keyframes <keyframes-name> {\n <keyframe-block-list>\n}",
  9320. interfaces: [
  9321. "CSSKeyframeRule",
  9322. "CSSKeyframesRule"
  9323. ],
  9324. groups: [
  9325. "CSS Animations"
  9326. ],
  9327. status: "standard",
  9328. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@keyframes"
  9329. },
  9330. "@media": {
  9331. syntax: "@media <media-query-list> {\n <group-rule-body>\n}",
  9332. interfaces: [
  9333. "CSSGroupingRule",
  9334. "CSSConditionRule",
  9335. "CSSMediaRule",
  9336. "CSSCustomMediaRule"
  9337. ],
  9338. groups: [
  9339. "CSS Conditional Rules",
  9340. "Media Queries"
  9341. ],
  9342. status: "standard",
  9343. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@media"
  9344. },
  9345. "@namespace": {
  9346. syntax: "@namespace <namespace-prefix>? [ <string> | <url> ];",
  9347. groups: [
  9348. "CSS Namespaces"
  9349. ],
  9350. status: "standard",
  9351. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@namespace"
  9352. },
  9353. "@page": {
  9354. syntax: "@page <page-selector-list> {\n <page-body>\n}",
  9355. interfaces: [
  9356. "CSSPageRule"
  9357. ],
  9358. groups: [
  9359. "CSS Pages"
  9360. ],
  9361. descriptors: {
  9362. bleed: {
  9363. syntax: "auto | <length>",
  9364. media: [
  9365. "visual",
  9366. "paged"
  9367. ],
  9368. initial: "auto",
  9369. percentages: "no",
  9370. computed: "asSpecified",
  9371. order: "uniqueOrder",
  9372. status: "experimental"
  9373. },
  9374. marks: {
  9375. syntax: "none | [ crop || cross ]",
  9376. media: [
  9377. "visual",
  9378. "paged"
  9379. ],
  9380. initial: "none",
  9381. percentages: "no",
  9382. computed: "asSpecified",
  9383. order: "orderOfAppearance",
  9384. status: "experimental"
  9385. }
  9386. },
  9387. status: "standard",
  9388. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@page"
  9389. },
  9390. "@supports": {
  9391. syntax: "@supports <supports-condition> {\n <group-rule-body>\n}",
  9392. interfaces: [
  9393. "CSSGroupingRule",
  9394. "CSSConditionRule",
  9395. "CSSSupportsRule"
  9396. ],
  9397. groups: [
  9398. "CSS Conditional Rules"
  9399. ],
  9400. status: "standard",
  9401. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@supports"
  9402. },
  9403. "@viewport": {
  9404. syntax: "@viewport {\n <group-rule-body>\n}",
  9405. interfaces: [
  9406. "CSSViewportRule"
  9407. ],
  9408. groups: [
  9409. "CSS Device Adaptation"
  9410. ],
  9411. descriptors: {
  9412. height: {
  9413. syntax: "<viewport-length>{1,2}",
  9414. media: [
  9415. "visual",
  9416. "continuous"
  9417. ],
  9418. initial: [
  9419. "min-height",
  9420. "max-height"
  9421. ],
  9422. percentages: [
  9423. "min-height",
  9424. "max-height"
  9425. ],
  9426. computed: [
  9427. "min-height",
  9428. "max-height"
  9429. ],
  9430. order: "orderOfAppearance",
  9431. status: "standard"
  9432. },
  9433. "max-height": {
  9434. syntax: "<viewport-length>",
  9435. media: [
  9436. "visual",
  9437. "continuous"
  9438. ],
  9439. initial: "auto",
  9440. percentages: "referToHeightOfInitialViewport",
  9441. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  9442. order: "uniqueOrder",
  9443. status: "standard"
  9444. },
  9445. "max-width": {
  9446. syntax: "<viewport-length>",
  9447. media: [
  9448. "visual",
  9449. "continuous"
  9450. ],
  9451. initial: "auto",
  9452. percentages: "referToWidthOfInitialViewport",
  9453. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  9454. order: "uniqueOrder",
  9455. status: "standard"
  9456. },
  9457. "max-zoom": {
  9458. syntax: "auto | <number> | <percentage>",
  9459. media: [
  9460. "visual",
  9461. "continuous"
  9462. ],
  9463. initial: "auto",
  9464. percentages: "the zoom factor itself",
  9465. computed: "autoNonNegativeOrPercentage",
  9466. order: "uniqueOrder",
  9467. status: "standard"
  9468. },
  9469. "min-height": {
  9470. syntax: "<viewport-length>",
  9471. media: [
  9472. "visual",
  9473. "continuous"
  9474. ],
  9475. initial: "auto",
  9476. percentages: "referToHeightOfInitialViewport",
  9477. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  9478. order: "uniqueOrder",
  9479. status: "standard"
  9480. },
  9481. "min-width": {
  9482. syntax: "<viewport-length>",
  9483. media: [
  9484. "visual",
  9485. "continuous"
  9486. ],
  9487. initial: "auto",
  9488. percentages: "referToWidthOfInitialViewport",
  9489. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  9490. order: "uniqueOrder",
  9491. status: "standard"
  9492. },
  9493. "min-zoom": {
  9494. syntax: "auto | <number> | <percentage>",
  9495. media: [
  9496. "visual",
  9497. "continuous"
  9498. ],
  9499. initial: "auto",
  9500. percentages: "the zoom factor itself",
  9501. computed: "autoNonNegativeOrPercentage",
  9502. order: "uniqueOrder",
  9503. status: "standard"
  9504. },
  9505. orientation: {
  9506. syntax: "auto | portrait | landscape",
  9507. media: [
  9508. "visual",
  9509. "continuous"
  9510. ],
  9511. initial: "auto",
  9512. percentages: "referToSizeOfBoundingBox",
  9513. computed: "asSpecified",
  9514. order: "uniqueOrder",
  9515. status: "standard"
  9516. },
  9517. "user-zoom": {
  9518. syntax: "zoom | fixed",
  9519. media: [
  9520. "visual",
  9521. "continuous"
  9522. ],
  9523. initial: "zoom",
  9524. percentages: "referToSizeOfBoundingBox",
  9525. computed: "asSpecified",
  9526. order: "uniqueOrder",
  9527. status: "standard"
  9528. },
  9529. width: {
  9530. syntax: "<viewport-length>{1,2}",
  9531. media: [
  9532. "visual",
  9533. "continuous"
  9534. ],
  9535. initial: [
  9536. "min-width",
  9537. "max-width"
  9538. ],
  9539. percentages: [
  9540. "min-width",
  9541. "max-width"
  9542. ],
  9543. computed: [
  9544. "min-width",
  9545. "max-width"
  9546. ],
  9547. order: "orderOfAppearance",
  9548. status: "standard"
  9549. },
  9550. zoom: {
  9551. syntax: "auto | <number> | <percentage>",
  9552. media: [
  9553. "visual",
  9554. "continuous"
  9555. ],
  9556. initial: "auto",
  9557. percentages: "the zoom factor itself",
  9558. computed: "autoNonNegativeOrPercentage",
  9559. order: "uniqueOrder",
  9560. status: "standard"
  9561. }
  9562. },
  9563. status: "standard",
  9564. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@viewport"
  9565. }
  9566. };
  9567. var atRules$1 = /*#__PURE__*/Object.freeze({
  9568. __proto__: null,
  9569. 'default': atRules
  9570. });
  9571. var all = {
  9572. syntax: "initial | inherit | unset | revert",
  9573. media: "noPracticalMedia",
  9574. inherited: false,
  9575. animationType: "eachOfShorthandPropertiesExceptUnicodeBiDiAndDirection",
  9576. percentages: "no",
  9577. groups: [
  9578. "CSS Miscellaneous"
  9579. ],
  9580. initial: "noPracticalInitialValue",
  9581. appliesto: "allElements",
  9582. computed: "asSpecifiedAppliesToEachProperty",
  9583. order: "uniqueOrder",
  9584. status: "standard",
  9585. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/all"
  9586. };
  9587. var animation = {
  9588. syntax: "<single-animation>#",
  9589. media: "visual",
  9590. inherited: false,
  9591. animationType: "discrete",
  9592. percentages: "no",
  9593. groups: [
  9594. "CSS Animations"
  9595. ],
  9596. initial: [
  9597. "animation-name",
  9598. "animation-duration",
  9599. "animation-timing-function",
  9600. "animation-delay",
  9601. "animation-iteration-count",
  9602. "animation-direction",
  9603. "animation-fill-mode",
  9604. "animation-play-state"
  9605. ],
  9606. appliesto: "allElementsAndPseudos",
  9607. computed: [
  9608. "animation-name",
  9609. "animation-duration",
  9610. "animation-timing-function",
  9611. "animation-delay",
  9612. "animation-direction",
  9613. "animation-iteration-count",
  9614. "animation-fill-mode",
  9615. "animation-play-state"
  9616. ],
  9617. order: "orderOfAppearance",
  9618. status: "standard",
  9619. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation"
  9620. };
  9621. var appearance = {
  9622. syntax: "none | auto | button | textfield | <compat>",
  9623. media: "all",
  9624. inherited: false,
  9625. animationType: "discrete",
  9626. percentages: "no",
  9627. groups: [
  9628. "CSS Basic User Interface"
  9629. ],
  9630. initial: "auto",
  9631. appliesto: "allElements",
  9632. computed: "asSpecified",
  9633. order: "perGrammar",
  9634. status: "experimental",
  9635. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-appearance"
  9636. };
  9637. var azimuth = {
  9638. syntax: "<angle> | [ [ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards",
  9639. media: "aural",
  9640. inherited: true,
  9641. animationType: "discrete",
  9642. percentages: "no",
  9643. groups: [
  9644. "CSS Speech"
  9645. ],
  9646. initial: "center",
  9647. appliesto: "allElements",
  9648. computed: "normalizedAngle",
  9649. order: "orderOfAppearance",
  9650. status: "obsolete",
  9651. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/azimuth"
  9652. };
  9653. var background = {
  9654. syntax: "[ <bg-layer> , ]* <final-bg-layer>",
  9655. media: "visual",
  9656. inherited: false,
  9657. animationType: [
  9658. "background-color",
  9659. "background-image",
  9660. "background-clip",
  9661. "background-position",
  9662. "background-size",
  9663. "background-repeat",
  9664. "background-attachment"
  9665. ],
  9666. percentages: [
  9667. "background-position",
  9668. "background-size"
  9669. ],
  9670. groups: [
  9671. "CSS Backgrounds and Borders"
  9672. ],
  9673. initial: [
  9674. "background-image",
  9675. "background-position",
  9676. "background-size",
  9677. "background-repeat",
  9678. "background-origin",
  9679. "background-clip",
  9680. "background-attachment",
  9681. "background-color"
  9682. ],
  9683. appliesto: "allElements",
  9684. computed: [
  9685. "background-image",
  9686. "background-position",
  9687. "background-size",
  9688. "background-repeat",
  9689. "background-origin",
  9690. "background-clip",
  9691. "background-attachment",
  9692. "background-color"
  9693. ],
  9694. order: "orderOfAppearance",
  9695. alsoAppliesTo: [
  9696. "::first-letter",
  9697. "::first-line",
  9698. "::placeholder"
  9699. ],
  9700. status: "standard",
  9701. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background"
  9702. };
  9703. var border = {
  9704. syntax: "<line-width> || <line-style> || <color>",
  9705. media: "visual",
  9706. inherited: false,
  9707. animationType: [
  9708. "border-color",
  9709. "border-style",
  9710. "border-width"
  9711. ],
  9712. percentages: "no",
  9713. groups: [
  9714. "CSS Backgrounds and Borders"
  9715. ],
  9716. initial: [
  9717. "border-width",
  9718. "border-style",
  9719. "border-color"
  9720. ],
  9721. appliesto: "allElements",
  9722. computed: [
  9723. "border-width",
  9724. "border-style",
  9725. "border-color"
  9726. ],
  9727. order: "orderOfAppearance",
  9728. alsoAppliesTo: [
  9729. "::first-letter"
  9730. ],
  9731. status: "standard",
  9732. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border"
  9733. };
  9734. var bottom = {
  9735. syntax: "<length> | <percentage> | auto",
  9736. media: "visual",
  9737. inherited: false,
  9738. animationType: "lpc",
  9739. percentages: "referToContainingBlockHeight",
  9740. groups: [
  9741. "CSS Positioning"
  9742. ],
  9743. initial: "auto",
  9744. appliesto: "positionedElements",
  9745. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  9746. order: "uniqueOrder",
  9747. status: "standard",
  9748. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/bottom"
  9749. };
  9750. var clear = {
  9751. syntax: "none | left | right | both | inline-start | inline-end",
  9752. media: "visual",
  9753. inherited: false,
  9754. animationType: "discrete",
  9755. percentages: "no",
  9756. groups: [
  9757. "CSS Positioning"
  9758. ],
  9759. initial: "none",
  9760. appliesto: "blockLevelElements",
  9761. computed: "asSpecified",
  9762. order: "uniqueOrder",
  9763. status: "standard",
  9764. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clear"
  9765. };
  9766. var clip = {
  9767. syntax: "<shape> | auto",
  9768. media: "visual",
  9769. inherited: false,
  9770. animationType: "rectangle",
  9771. percentages: "no",
  9772. groups: [
  9773. "CSS Masking"
  9774. ],
  9775. initial: "auto",
  9776. appliesto: "absolutelyPositionedElements",
  9777. computed: "autoOrRectangle",
  9778. order: "uniqueOrder",
  9779. status: "standard",
  9780. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clip"
  9781. };
  9782. var color = {
  9783. syntax: "<color>",
  9784. media: "visual",
  9785. inherited: true,
  9786. animationType: "color",
  9787. percentages: "no",
  9788. groups: [
  9789. "CSS Color"
  9790. ],
  9791. initial: "variesFromBrowserToBrowser",
  9792. appliesto: "allElements",
  9793. computed: "translucentValuesRGBAOtherwiseRGB",
  9794. order: "uniqueOrder",
  9795. alsoAppliesTo: [
  9796. "::first-letter",
  9797. "::first-line",
  9798. "::placeholder"
  9799. ],
  9800. status: "standard",
  9801. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/color"
  9802. };
  9803. var columns = {
  9804. syntax: "<'column-width'> || <'column-count'>",
  9805. media: "visual",
  9806. inherited: false,
  9807. animationType: [
  9808. "column-width",
  9809. "column-count"
  9810. ],
  9811. percentages: "no",
  9812. groups: [
  9813. "CSS Columns"
  9814. ],
  9815. initial: [
  9816. "column-width",
  9817. "column-count"
  9818. ],
  9819. appliesto: "blockContainersExceptTableWrappers",
  9820. computed: [
  9821. "column-width",
  9822. "column-count"
  9823. ],
  9824. order: "perGrammar",
  9825. status: "standard",
  9826. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/columns"
  9827. };
  9828. var contain = {
  9829. syntax: "none | strict | content | [ size || layout || style || paint ]",
  9830. media: "all",
  9831. inherited: false,
  9832. animationType: "discrete",
  9833. percentages: "no",
  9834. groups: [
  9835. "CSS Containment"
  9836. ],
  9837. initial: "none",
  9838. appliesto: "allElements",
  9839. computed: "asSpecified",
  9840. order: "perGrammar",
  9841. status: "experimental",
  9842. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/contain"
  9843. };
  9844. var content = {
  9845. syntax: "normal | none | [ <content-replacement> | <content-list> ] [/ <string> ]?",
  9846. media: "all",
  9847. inherited: false,
  9848. animationType: "discrete",
  9849. percentages: "no",
  9850. groups: [
  9851. "CSS Generated Content"
  9852. ],
  9853. initial: "normal",
  9854. appliesto: "beforeAndAfterPseudos",
  9855. computed: "normalOnElementsForPseudosNoneAbsoluteURIStringOrAsSpecified",
  9856. order: "uniqueOrder",
  9857. status: "standard",
  9858. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/content"
  9859. };
  9860. var cursor = {
  9861. 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 ] ]",
  9862. media: [
  9863. "visual",
  9864. "interactive"
  9865. ],
  9866. inherited: true,
  9867. animationType: "discrete",
  9868. percentages: "no",
  9869. groups: [
  9870. "CSS Basic User Interface"
  9871. ],
  9872. initial: "auto",
  9873. appliesto: "allElements",
  9874. computed: "asSpecifiedURLsAbsolute",
  9875. order: "uniqueOrder",
  9876. status: "standard",
  9877. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/cursor"
  9878. };
  9879. var direction = {
  9880. syntax: "ltr | rtl",
  9881. media: "visual",
  9882. inherited: true,
  9883. animationType: "discrete",
  9884. percentages: "no",
  9885. groups: [
  9886. "CSS Writing Modes"
  9887. ],
  9888. initial: "ltr",
  9889. appliesto: "allElements",
  9890. computed: "asSpecified",
  9891. order: "uniqueOrder",
  9892. status: "standard",
  9893. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/direction"
  9894. };
  9895. var display = {
  9896. syntax: "[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>",
  9897. media: "all",
  9898. inherited: false,
  9899. animationType: "discrete",
  9900. percentages: "no",
  9901. groups: [
  9902. "CSS Display"
  9903. ],
  9904. initial: "inline",
  9905. appliesto: "allElements",
  9906. computed: "asSpecifiedExceptPositionedFloatingAndRootElementsKeywordMaybeDifferent",
  9907. order: "uniqueOrder",
  9908. status: "standard",
  9909. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/display"
  9910. };
  9911. var filter = {
  9912. syntax: "none | <filter-function-list>",
  9913. media: "visual",
  9914. inherited: false,
  9915. animationType: "filterList",
  9916. percentages: "no",
  9917. groups: [
  9918. "Filter Effects"
  9919. ],
  9920. initial: "none",
  9921. appliesto: "allElementsSVGContainerElements",
  9922. computed: "asSpecified",
  9923. order: "uniqueOrder",
  9924. status: "standard",
  9925. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/filter"
  9926. };
  9927. var flex = {
  9928. syntax: "none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]",
  9929. media: "visual",
  9930. inherited: false,
  9931. animationType: [
  9932. "flex-grow",
  9933. "flex-shrink",
  9934. "flex-basis"
  9935. ],
  9936. percentages: "no",
  9937. groups: [
  9938. "CSS Flexible Box Layout"
  9939. ],
  9940. initial: [
  9941. "flex-grow",
  9942. "flex-shrink",
  9943. "flex-basis"
  9944. ],
  9945. appliesto: "flexItemsAndInFlowPseudos",
  9946. computed: [
  9947. "flex-grow",
  9948. "flex-shrink",
  9949. "flex-basis"
  9950. ],
  9951. order: "orderOfAppearance",
  9952. status: "standard",
  9953. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex"
  9954. };
  9955. var float = {
  9956. syntax: "left | right | none | inline-start | inline-end",
  9957. media: "visual",
  9958. inherited: false,
  9959. animationType: "discrete",
  9960. percentages: "no",
  9961. groups: [
  9962. "CSS Positioning"
  9963. ],
  9964. initial: "none",
  9965. appliesto: "allElementsNoEffectIfDisplayNone",
  9966. computed: "asSpecified",
  9967. order: "uniqueOrder",
  9968. status: "standard",
  9969. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/float"
  9970. };
  9971. var font = {
  9972. 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",
  9973. media: "visual",
  9974. inherited: true,
  9975. animationType: [
  9976. "font-style",
  9977. "font-variant",
  9978. "font-weight",
  9979. "font-stretch",
  9980. "font-size",
  9981. "line-height",
  9982. "font-family"
  9983. ],
  9984. percentages: [
  9985. "font-size",
  9986. "line-height"
  9987. ],
  9988. groups: [
  9989. "CSS Fonts"
  9990. ],
  9991. initial: [
  9992. "font-style",
  9993. "font-variant",
  9994. "font-weight",
  9995. "font-stretch",
  9996. "font-size",
  9997. "line-height",
  9998. "font-family"
  9999. ],
  10000. appliesto: "allElements",
  10001. computed: [
  10002. "font-style",
  10003. "font-variant",
  10004. "font-weight",
  10005. "font-stretch",
  10006. "font-size",
  10007. "line-height",
  10008. "font-family"
  10009. ],
  10010. order: "orderOfAppearance",
  10011. alsoAppliesTo: [
  10012. "::first-letter",
  10013. "::first-line",
  10014. "::placeholder"
  10015. ],
  10016. status: "standard",
  10017. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font"
  10018. };
  10019. var gap = {
  10020. syntax: "<'row-gap'> <'column-gap'>?",
  10021. media: "visual",
  10022. inherited: false,
  10023. animationType: [
  10024. "row-gap",
  10025. "column-gap"
  10026. ],
  10027. percentages: "no",
  10028. groups: [
  10029. "CSS Box Alignment"
  10030. ],
  10031. initial: [
  10032. "row-gap",
  10033. "column-gap"
  10034. ],
  10035. appliesto: "gridContainers",
  10036. computed: [
  10037. "row-gap",
  10038. "column-gap"
  10039. ],
  10040. order: "uniqueOrder",
  10041. status: "standard",
  10042. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/gap"
  10043. };
  10044. var grid = {
  10045. syntax: "<'grid-template'> | <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? | [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'>",
  10046. media: "visual",
  10047. inherited: false,
  10048. animationType: "discrete",
  10049. percentages: [
  10050. "grid-template-rows",
  10051. "grid-template-columns",
  10052. "grid-auto-rows",
  10053. "grid-auto-columns"
  10054. ],
  10055. groups: [
  10056. "CSS Grid Layout"
  10057. ],
  10058. initial: [
  10059. "grid-template-rows",
  10060. "grid-template-columns",
  10061. "grid-template-areas",
  10062. "grid-auto-rows",
  10063. "grid-auto-columns",
  10064. "grid-auto-flow",
  10065. "grid-column-gap",
  10066. "grid-row-gap",
  10067. "column-gap",
  10068. "row-gap"
  10069. ],
  10070. appliesto: "gridContainers",
  10071. computed: [
  10072. "grid-template-rows",
  10073. "grid-template-columns",
  10074. "grid-template-areas",
  10075. "grid-auto-rows",
  10076. "grid-auto-columns",
  10077. "grid-auto-flow",
  10078. "grid-column-gap",
  10079. "grid-row-gap",
  10080. "column-gap",
  10081. "row-gap"
  10082. ],
  10083. order: "uniqueOrder",
  10084. status: "standard",
  10085. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid"
  10086. };
  10087. var height = {
  10088. syntax: "[ <length> | <percentage> ] && [ border-box | content-box ]? | available | min-content | max-content | fit-content | auto",
  10089. media: "visual",
  10090. inherited: false,
  10091. animationType: "lpc",
  10092. percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentagesRelativeToContainingBlock",
  10093. groups: [
  10094. "CSS Box Model"
  10095. ],
  10096. initial: "auto",
  10097. appliesto: "allElementsButNonReplacedAndTableColumns",
  10098. computed: "percentageAutoOrAbsoluteLength",
  10099. order: "uniqueOrder",
  10100. status: "standard",
  10101. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/height"
  10102. };
  10103. var hyphens = {
  10104. syntax: "none | manual | auto",
  10105. media: "visual",
  10106. inherited: true,
  10107. animationType: "discrete",
  10108. percentages: "no",
  10109. groups: [
  10110. "CSS Text"
  10111. ],
  10112. initial: "manual",
  10113. appliesto: "allElements",
  10114. computed: "asSpecified",
  10115. order: "uniqueOrder",
  10116. status: "standard",
  10117. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/hyphens"
  10118. };
  10119. var inset = {
  10120. syntax: "<'top'>{1,4}",
  10121. media: "visual",
  10122. inherited: false,
  10123. animationType: "lpc",
  10124. percentages: "logicalHeightOfContainingBlock",
  10125. groups: [
  10126. "CSS Logical Properties"
  10127. ],
  10128. initial: "auto",
  10129. appliesto: "positionedElements",
  10130. computed: "sameAsBoxOffsets",
  10131. order: "uniqueOrder",
  10132. status: "standard",
  10133. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset"
  10134. };
  10135. var isolation = {
  10136. syntax: "auto | isolate",
  10137. media: "visual",
  10138. inherited: false,
  10139. animationType: "discrete",
  10140. percentages: "no",
  10141. groups: [
  10142. "Compositing and Blending"
  10143. ],
  10144. initial: "auto",
  10145. appliesto: "allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
  10146. computed: "asSpecified",
  10147. order: "uniqueOrder",
  10148. status: "standard",
  10149. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/isolation"
  10150. };
  10151. var left = {
  10152. syntax: "<length> | <percentage> | auto",
  10153. media: "visual",
  10154. inherited: false,
  10155. animationType: "lpc",
  10156. percentages: "referToWidthOfContainingBlock",
  10157. groups: [
  10158. "CSS Positioning"
  10159. ],
  10160. initial: "auto",
  10161. appliesto: "positionedElements",
  10162. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10163. order: "uniqueOrder",
  10164. status: "standard",
  10165. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/left"
  10166. };
  10167. var margin = {
  10168. syntax: "[ <length> | <percentage> | auto ]{1,4}",
  10169. media: "visual",
  10170. inherited: false,
  10171. animationType: "length",
  10172. percentages: "referToWidthOfContainingBlock",
  10173. groups: [
  10174. "CSS Box Model"
  10175. ],
  10176. initial: [
  10177. "margin-bottom",
  10178. "margin-left",
  10179. "margin-right",
  10180. "margin-top"
  10181. ],
  10182. appliesto: "allElementsExceptTableDisplayTypes",
  10183. computed: [
  10184. "margin-bottom",
  10185. "margin-left",
  10186. "margin-right",
  10187. "margin-top"
  10188. ],
  10189. order: "uniqueOrder",
  10190. alsoAppliesTo: [
  10191. "::first-letter"
  10192. ],
  10193. status: "standard",
  10194. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin"
  10195. };
  10196. var mask = {
  10197. syntax: "<mask-layer>#",
  10198. media: "visual",
  10199. inherited: false,
  10200. animationType: [
  10201. "mask-image",
  10202. "mask-mode",
  10203. "mask-repeat",
  10204. "mask-position",
  10205. "mask-clip",
  10206. "mask-origin",
  10207. "mask-size",
  10208. "mask-composite"
  10209. ],
  10210. percentages: [
  10211. "mask-position"
  10212. ],
  10213. groups: [
  10214. "CSS Masking"
  10215. ],
  10216. initial: [
  10217. "mask-image",
  10218. "mask-mode",
  10219. "mask-repeat",
  10220. "mask-position",
  10221. "mask-clip",
  10222. "mask-origin",
  10223. "mask-size",
  10224. "mask-composite"
  10225. ],
  10226. appliesto: "allElementsSVGContainerElements",
  10227. computed: [
  10228. "mask-image",
  10229. "mask-mode",
  10230. "mask-repeat",
  10231. "mask-position",
  10232. "mask-clip",
  10233. "mask-origin",
  10234. "mask-size",
  10235. "mask-composite"
  10236. ],
  10237. order: "perGrammar",
  10238. stacking: true,
  10239. status: "standard",
  10240. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask"
  10241. };
  10242. var offset = {
  10243. syntax: "[ <'offset-position'>? [ <'offset-path'> [ <'offset-distance'> || <'offset-rotate'> ]? ]? ]! [ / <'offset-anchor'> ]?",
  10244. media: "visual",
  10245. inherited: false,
  10246. animationType: [
  10247. "offset-position",
  10248. "offset-path",
  10249. "offset-distance",
  10250. "offset-anchor",
  10251. "offset-rotate"
  10252. ],
  10253. percentages: [
  10254. "offset-position",
  10255. "offset-distance",
  10256. "offset-anchor"
  10257. ],
  10258. groups: [
  10259. "CSS Motion Path"
  10260. ],
  10261. initial: [
  10262. "offset-position",
  10263. "offset-path",
  10264. "offset-distance",
  10265. "offset-anchor",
  10266. "offset-rotate"
  10267. ],
  10268. appliesto: "transformableElements",
  10269. computed: [
  10270. "offset-position",
  10271. "offset-path",
  10272. "offset-distance",
  10273. "offset-anchor",
  10274. "offset-rotate"
  10275. ],
  10276. order: "perGrammar",
  10277. stacking: true,
  10278. status: "experimental",
  10279. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset"
  10280. };
  10281. var opacity = {
  10282. syntax: "<alpha-value>",
  10283. media: "visual",
  10284. inherited: false,
  10285. animationType: "number",
  10286. percentages: "no",
  10287. groups: [
  10288. "CSS Color"
  10289. ],
  10290. initial: "1.0",
  10291. appliesto: "allElements",
  10292. computed: "specifiedValueClipped0To1",
  10293. order: "uniqueOrder",
  10294. alsoAppliesTo: [
  10295. "::placeholder"
  10296. ],
  10297. status: "standard",
  10298. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/opacity"
  10299. };
  10300. var order = {
  10301. syntax: "<integer>",
  10302. media: "visual",
  10303. inherited: false,
  10304. animationType: "integer",
  10305. percentages: "no",
  10306. groups: [
  10307. "CSS Flexible Box Layout"
  10308. ],
  10309. initial: "0",
  10310. appliesto: "flexItemsAndAbsolutelyPositionedFlexContainerChildren",
  10311. computed: "asSpecified",
  10312. order: "uniqueOrder",
  10313. status: "standard",
  10314. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/order"
  10315. };
  10316. var orphans = {
  10317. syntax: "<integer>",
  10318. media: "visual",
  10319. inherited: true,
  10320. animationType: "discrete",
  10321. percentages: "no",
  10322. groups: [
  10323. "CSS Fragmentation"
  10324. ],
  10325. initial: "2",
  10326. appliesto: "blockContainerElements",
  10327. computed: "asSpecified",
  10328. order: "perGrammar",
  10329. status: "standard",
  10330. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/orphans"
  10331. };
  10332. var outline = {
  10333. syntax: "[ <'outline-color'> || <'outline-style'> || <'outline-width'> ]",
  10334. media: [
  10335. "visual",
  10336. "interactive"
  10337. ],
  10338. inherited: false,
  10339. animationType: [
  10340. "outline-color",
  10341. "outline-width",
  10342. "outline-style"
  10343. ],
  10344. percentages: "no",
  10345. groups: [
  10346. "CSS Basic User Interface"
  10347. ],
  10348. initial: [
  10349. "outline-color",
  10350. "outline-style",
  10351. "outline-width"
  10352. ],
  10353. appliesto: "allElements",
  10354. computed: [
  10355. "outline-color",
  10356. "outline-width",
  10357. "outline-style"
  10358. ],
  10359. order: "orderOfAppearance",
  10360. status: "standard",
  10361. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline"
  10362. };
  10363. var overflow = {
  10364. syntax: "[ visible | hidden | clip | scroll | auto ]{1,2}",
  10365. media: "visual",
  10366. inherited: false,
  10367. animationType: "discrete",
  10368. percentages: "no",
  10369. groups: [
  10370. "CSS Overflow"
  10371. ],
  10372. initial: "visible",
  10373. appliesto: "blockContainersFlexContainersGridContainers",
  10374. computed: "asSpecified",
  10375. order: "uniqueOrder",
  10376. status: "standard",
  10377. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow"
  10378. };
  10379. var padding = {
  10380. syntax: "[ <length> | <percentage> ]{1,4}",
  10381. media: "visual",
  10382. inherited: false,
  10383. animationType: "length",
  10384. percentages: "referToWidthOfContainingBlock",
  10385. groups: [
  10386. "CSS Box Model"
  10387. ],
  10388. initial: [
  10389. "padding-bottom",
  10390. "padding-left",
  10391. "padding-right",
  10392. "padding-top"
  10393. ],
  10394. appliesto: "allElementsExceptInternalTableDisplayTypes",
  10395. computed: [
  10396. "padding-bottom",
  10397. "padding-left",
  10398. "padding-right",
  10399. "padding-top"
  10400. ],
  10401. order: "uniqueOrder",
  10402. alsoAppliesTo: [
  10403. "::first-letter"
  10404. ],
  10405. status: "standard",
  10406. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding"
  10407. };
  10408. var perspective = {
  10409. syntax: "none | <length>",
  10410. media: "visual",
  10411. inherited: false,
  10412. animationType: "length",
  10413. percentages: "no",
  10414. groups: [
  10415. "CSS Transforms"
  10416. ],
  10417. initial: "none",
  10418. appliesto: "transformableElements",
  10419. computed: "absoluteLengthOrNone",
  10420. order: "uniqueOrder",
  10421. stacking: true,
  10422. status: "standard",
  10423. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/perspective"
  10424. };
  10425. var position = {
  10426. syntax: "static | relative | absolute | sticky | fixed",
  10427. media: "visual",
  10428. inherited: false,
  10429. animationType: "discrete",
  10430. percentages: "no",
  10431. groups: [
  10432. "CSS Positioning"
  10433. ],
  10434. initial: "static",
  10435. appliesto: "allElements",
  10436. computed: "asSpecified",
  10437. order: "uniqueOrder",
  10438. stacking: true,
  10439. status: "standard",
  10440. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/position"
  10441. };
  10442. var quotes = {
  10443. syntax: "none | auto | [ <string> <string> ]+",
  10444. media: "visual",
  10445. inherited: true,
  10446. animationType: "discrete",
  10447. percentages: "no",
  10448. groups: [
  10449. "CSS Generated Content"
  10450. ],
  10451. initial: "dependsOnUserAgent",
  10452. appliesto: "allElements",
  10453. computed: "asSpecified",
  10454. order: "uniqueOrder",
  10455. status: "standard",
  10456. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/quotes"
  10457. };
  10458. var resize = {
  10459. syntax: "none | both | horizontal | vertical | block | inline",
  10460. media: "visual",
  10461. inherited: false,
  10462. animationType: "discrete",
  10463. percentages: "no",
  10464. groups: [
  10465. "CSS Basic User Interface"
  10466. ],
  10467. initial: "none",
  10468. appliesto: "elementsWithOverflowNotVisibleAndReplacedElements",
  10469. computed: "asSpecified",
  10470. order: "uniqueOrder",
  10471. status: "standard",
  10472. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/resize"
  10473. };
  10474. var right = {
  10475. syntax: "<length> | <percentage> | auto",
  10476. media: "visual",
  10477. inherited: false,
  10478. animationType: "lpc",
  10479. percentages: "referToWidthOfContainingBlock",
  10480. groups: [
  10481. "CSS Positioning"
  10482. ],
  10483. initial: "auto",
  10484. appliesto: "positionedElements",
  10485. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10486. order: "uniqueOrder",
  10487. status: "standard",
  10488. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/right"
  10489. };
  10490. var rotate = {
  10491. syntax: "none | <angle> | [ x | y | z | <number>{3} ] && <angle>",
  10492. media: "visual",
  10493. inherited: false,
  10494. animationType: "transform",
  10495. percentages: "no",
  10496. groups: [
  10497. "CSS Transforms"
  10498. ],
  10499. initial: "none",
  10500. appliesto: "transformableElements",
  10501. computed: "asSpecified",
  10502. order: "perGrammar",
  10503. stacking: true,
  10504. status: "standard",
  10505. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/rotate"
  10506. };
  10507. var scale = {
  10508. syntax: "none | <number>{1,3}",
  10509. media: "visual",
  10510. inherited: false,
  10511. animationType: "transform",
  10512. percentages: "no",
  10513. groups: [
  10514. "CSS Transforms"
  10515. ],
  10516. initial: "none",
  10517. appliesto: "transformableElements",
  10518. computed: "asSpecified",
  10519. order: "perGrammar",
  10520. stacking: true,
  10521. status: "standard",
  10522. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scale"
  10523. };
  10524. var top = {
  10525. syntax: "<length> | <percentage> | auto",
  10526. media: "visual",
  10527. inherited: false,
  10528. animationType: "lpc",
  10529. percentages: "referToContainingBlockHeight",
  10530. groups: [
  10531. "CSS Positioning"
  10532. ],
  10533. initial: "auto",
  10534. appliesto: "positionedElements",
  10535. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10536. order: "uniqueOrder",
  10537. status: "standard",
  10538. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/top"
  10539. };
  10540. var transform = {
  10541. syntax: "none | <transform-list>",
  10542. media: "visual",
  10543. inherited: false,
  10544. animationType: "transform",
  10545. percentages: "referToSizeOfBoundingBox",
  10546. groups: [
  10547. "CSS Transforms"
  10548. ],
  10549. initial: "none",
  10550. appliesto: "transformableElements",
  10551. computed: "asSpecifiedRelativeToAbsoluteLengths",
  10552. order: "uniqueOrder",
  10553. stacking: true,
  10554. status: "standard",
  10555. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform"
  10556. };
  10557. var transition = {
  10558. syntax: "<single-transition>#",
  10559. media: "interactive",
  10560. inherited: false,
  10561. animationType: "discrete",
  10562. percentages: "no",
  10563. groups: [
  10564. "CSS Transitions"
  10565. ],
  10566. initial: [
  10567. "transition-delay",
  10568. "transition-duration",
  10569. "transition-property",
  10570. "transition-timing-function"
  10571. ],
  10572. appliesto: "allElementsAndPseudos",
  10573. computed: [
  10574. "transition-delay",
  10575. "transition-duration",
  10576. "transition-property",
  10577. "transition-timing-function"
  10578. ],
  10579. order: "orderOfAppearance",
  10580. status: "standard",
  10581. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition"
  10582. };
  10583. var translate = {
  10584. syntax: "none | <length-percentage> [ <length-percentage> <length>? ]?",
  10585. media: "visual",
  10586. inherited: false,
  10587. animationType: "transform",
  10588. percentages: "referToSizeOfBoundingBox",
  10589. groups: [
  10590. "CSS Transforms"
  10591. ],
  10592. initial: "none",
  10593. appliesto: "transformableElements",
  10594. computed: "asSpecifiedRelativeToAbsoluteLengths",
  10595. order: "perGrammar",
  10596. stacking: true,
  10597. status: "standard",
  10598. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/translate"
  10599. };
  10600. var visibility = {
  10601. syntax: "visible | hidden | collapse",
  10602. media: "visual",
  10603. inherited: true,
  10604. animationType: "visibility",
  10605. percentages: "no",
  10606. groups: [
  10607. "CSS Box Model"
  10608. ],
  10609. initial: "visible",
  10610. appliesto: "allElements",
  10611. computed: "asSpecified",
  10612. order: "uniqueOrder",
  10613. status: "standard",
  10614. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/visibility"
  10615. };
  10616. var widows = {
  10617. syntax: "<integer>",
  10618. media: "visual",
  10619. inherited: true,
  10620. animationType: "discrete",
  10621. percentages: "no",
  10622. groups: [
  10623. "CSS Fragmentation"
  10624. ],
  10625. initial: "2",
  10626. appliesto: "blockContainerElements",
  10627. computed: "asSpecified",
  10628. order: "perGrammar",
  10629. status: "standard",
  10630. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/widows"
  10631. };
  10632. var width = {
  10633. syntax: "[ <length> | <percentage> ] && [ border-box | content-box ]? | available | min-content | max-content | fit-content | auto",
  10634. media: "visual",
  10635. inherited: false,
  10636. animationType: "lpc",
  10637. percentages: "referToWidthOfContainingBlock",
  10638. groups: [
  10639. "CSS Box Model"
  10640. ],
  10641. initial: "auto",
  10642. appliesto: "allElementsButNonReplacedAndTableRows",
  10643. computed: "percentageAutoOrAbsoluteLength",
  10644. order: "lengthOrPercentageBeforeKeywordIfBothPresent",
  10645. status: "standard",
  10646. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/width"
  10647. };
  10648. var zoom = {
  10649. syntax: "normal | reset | <number> | <percentage>",
  10650. media: "visual",
  10651. inherited: false,
  10652. animationType: "integer",
  10653. percentages: "no",
  10654. groups: [
  10655. "Microsoft Extensions"
  10656. ],
  10657. initial: "normal",
  10658. appliesto: "allElements",
  10659. computed: "asSpecified",
  10660. order: "uniqueOrder",
  10661. status: "nonstandard",
  10662. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/zoom"
  10663. };
  10664. var properties$1 = {
  10665. "--*": {
  10666. syntax: "<declaration-value>",
  10667. media: "all",
  10668. inherited: true,
  10669. animationType: "discrete",
  10670. percentages: "no",
  10671. groups: [
  10672. "CSS Variables"
  10673. ],
  10674. initial: "seeProse",
  10675. appliesto: "allElements",
  10676. computed: "asSpecifiedWithVarsSubstituted",
  10677. order: "perGrammar",
  10678. status: "experimental",
  10679. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/--*"
  10680. },
  10681. "-ms-accelerator": {
  10682. syntax: "false | true",
  10683. media: "visual",
  10684. inherited: false,
  10685. animationType: "discrete",
  10686. percentages: "no",
  10687. groups: [
  10688. "Microsoft Extensions"
  10689. ],
  10690. initial: "false",
  10691. appliesto: "allElements",
  10692. computed: "asSpecified",
  10693. order: "uniqueOrder",
  10694. status: "nonstandard",
  10695. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-accelerator"
  10696. },
  10697. "-ms-block-progression": {
  10698. syntax: "tb | rl | bt | lr",
  10699. media: "visual",
  10700. inherited: false,
  10701. animationType: "discrete",
  10702. percentages: "no",
  10703. groups: [
  10704. "Microsoft Extensions"
  10705. ],
  10706. initial: "tb",
  10707. appliesto: "allElements",
  10708. computed: "asSpecified",
  10709. order: "uniqueOrder",
  10710. status: "nonstandard",
  10711. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-block-progression"
  10712. },
  10713. "-ms-content-zoom-chaining": {
  10714. syntax: "none | chained",
  10715. media: "interactive",
  10716. inherited: false,
  10717. animationType: "discrete",
  10718. percentages: "no",
  10719. groups: [
  10720. "Microsoft Extensions"
  10721. ],
  10722. initial: "none",
  10723. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10724. computed: "asSpecified",
  10725. order: "uniqueOrder",
  10726. status: "nonstandard",
  10727. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-chaining"
  10728. },
  10729. "-ms-content-zooming": {
  10730. syntax: "none | zoom",
  10731. media: "interactive",
  10732. inherited: false,
  10733. animationType: "discrete",
  10734. percentages: "no",
  10735. groups: [
  10736. "Microsoft Extensions"
  10737. ],
  10738. initial: "zoomForTheTopLevelNoneForTheRest",
  10739. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10740. computed: "asSpecified",
  10741. order: "uniqueOrder",
  10742. status: "nonstandard",
  10743. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zooming"
  10744. },
  10745. "-ms-content-zoom-limit": {
  10746. syntax: "<'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'>",
  10747. media: "interactive",
  10748. inherited: false,
  10749. animationType: "discrete",
  10750. percentages: [
  10751. "-ms-content-zoom-limit-max",
  10752. "-ms-content-zoom-limit-min"
  10753. ],
  10754. groups: [
  10755. "Microsoft Extensions"
  10756. ],
  10757. initial: [
  10758. "-ms-content-zoom-limit-max",
  10759. "-ms-content-zoom-limit-min"
  10760. ],
  10761. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10762. computed: [
  10763. "-ms-content-zoom-limit-max",
  10764. "-ms-content-zoom-limit-min"
  10765. ],
  10766. order: "uniqueOrder",
  10767. status: "nonstandard",
  10768. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit"
  10769. },
  10770. "-ms-content-zoom-limit-max": {
  10771. syntax: "<percentage>",
  10772. media: "interactive",
  10773. inherited: false,
  10774. animationType: "discrete",
  10775. percentages: "maxZoomFactor",
  10776. groups: [
  10777. "Microsoft Extensions"
  10778. ],
  10779. initial: "400%",
  10780. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10781. computed: "asSpecified",
  10782. order: "uniqueOrder",
  10783. status: "nonstandard",
  10784. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit-max"
  10785. },
  10786. "-ms-content-zoom-limit-min": {
  10787. syntax: "<percentage>",
  10788. media: "interactive",
  10789. inherited: false,
  10790. animationType: "discrete",
  10791. percentages: "minZoomFactor",
  10792. groups: [
  10793. "Microsoft Extensions"
  10794. ],
  10795. initial: "100%",
  10796. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10797. computed: "asSpecified",
  10798. order: "uniqueOrder",
  10799. status: "nonstandard",
  10800. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit-min"
  10801. },
  10802. "-ms-content-zoom-snap": {
  10803. syntax: "<'-ms-content-zoom-snap-type'> || <'-ms-content-zoom-snap-points'>",
  10804. media: "interactive",
  10805. inherited: false,
  10806. animationType: "discrete",
  10807. percentages: "no",
  10808. groups: [
  10809. "Microsoft Extensions"
  10810. ],
  10811. initial: [
  10812. "-ms-content-zoom-snap-type",
  10813. "-ms-content-zoom-snap-points"
  10814. ],
  10815. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10816. computed: [
  10817. "-ms-content-zoom-snap-type",
  10818. "-ms-content-zoom-snap-points"
  10819. ],
  10820. order: "uniqueOrder",
  10821. status: "nonstandard",
  10822. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap"
  10823. },
  10824. "-ms-content-zoom-snap-points": {
  10825. syntax: "snapInterval( <percentage>, <percentage> ) | snapList( <percentage># )",
  10826. media: "interactive",
  10827. inherited: false,
  10828. animationType: "discrete",
  10829. percentages: "no",
  10830. groups: [
  10831. "Microsoft Extensions"
  10832. ],
  10833. initial: "snapInterval(0%, 100%)",
  10834. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10835. computed: "asSpecified",
  10836. order: "uniqueOrder",
  10837. status: "nonstandard",
  10838. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap-points"
  10839. },
  10840. "-ms-content-zoom-snap-type": {
  10841. syntax: "none | proximity | mandatory",
  10842. media: "interactive",
  10843. inherited: false,
  10844. animationType: "discrete",
  10845. percentages: "no",
  10846. groups: [
  10847. "Microsoft Extensions"
  10848. ],
  10849. initial: "none",
  10850. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10851. computed: "asSpecified",
  10852. order: "uniqueOrder",
  10853. status: "nonstandard",
  10854. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap-type"
  10855. },
  10856. "-ms-filter": {
  10857. syntax: "<string>",
  10858. media: "visual",
  10859. inherited: false,
  10860. animationType: "discrete",
  10861. percentages: "no",
  10862. groups: [
  10863. "Microsoft Extensions"
  10864. ],
  10865. initial: "\"\"",
  10866. appliesto: "allElements",
  10867. computed: "asSpecified",
  10868. order: "uniqueOrder",
  10869. status: "nonstandard",
  10870. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-filter"
  10871. },
  10872. "-ms-flow-from": {
  10873. syntax: "[ none | <custom-ident> ]#",
  10874. media: "visual",
  10875. inherited: false,
  10876. animationType: "discrete",
  10877. percentages: "no",
  10878. groups: [
  10879. "Microsoft Extensions"
  10880. ],
  10881. initial: "none",
  10882. appliesto: "nonReplacedElements",
  10883. computed: "asSpecified",
  10884. order: "uniqueOrder",
  10885. status: "nonstandard",
  10886. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-flow-from"
  10887. },
  10888. "-ms-flow-into": {
  10889. syntax: "[ none | <custom-ident> ]#",
  10890. media: "visual",
  10891. inherited: false,
  10892. animationType: "discrete",
  10893. percentages: "no",
  10894. groups: [
  10895. "Microsoft Extensions"
  10896. ],
  10897. initial: "none",
  10898. appliesto: "iframeElements",
  10899. computed: "asSpecified",
  10900. order: "uniqueOrder",
  10901. status: "nonstandard",
  10902. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-flow-into"
  10903. },
  10904. "-ms-high-contrast-adjust": {
  10905. syntax: "auto | none",
  10906. media: "visual",
  10907. inherited: true,
  10908. animationType: "discrete",
  10909. percentages: "no",
  10910. groups: [
  10911. "Microsoft Extensions"
  10912. ],
  10913. initial: "auto",
  10914. appliesto: "allElements",
  10915. computed: "asSpecified",
  10916. order: "uniqueOrder",
  10917. status: "nonstandard",
  10918. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-high-contrast-adjust"
  10919. },
  10920. "-ms-hyphenate-limit-chars": {
  10921. syntax: "auto | <integer>{1,3}",
  10922. media: "visual",
  10923. inherited: true,
  10924. animationType: "discrete",
  10925. percentages: "no",
  10926. groups: [
  10927. "Microsoft Extensions"
  10928. ],
  10929. initial: "auto",
  10930. appliesto: "allElements",
  10931. computed: "asSpecified",
  10932. order: "uniqueOrder",
  10933. status: "nonstandard",
  10934. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-chars"
  10935. },
  10936. "-ms-hyphenate-limit-lines": {
  10937. syntax: "no-limit | <integer>",
  10938. media: "visual",
  10939. inherited: true,
  10940. animationType: "discrete",
  10941. percentages: "no",
  10942. groups: [
  10943. "Microsoft Extensions"
  10944. ],
  10945. initial: "no-limit",
  10946. appliesto: "blockContainerElements",
  10947. computed: "asSpecified",
  10948. order: "uniqueOrder",
  10949. status: "nonstandard",
  10950. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-lines"
  10951. },
  10952. "-ms-hyphenate-limit-zone": {
  10953. syntax: "<percentage> | <length>",
  10954. media: "visual",
  10955. inherited: true,
  10956. animationType: "discrete",
  10957. percentages: "referToLineBoxWidth",
  10958. groups: [
  10959. "Microsoft Extensions"
  10960. ],
  10961. initial: "0",
  10962. appliesto: "blockContainerElements",
  10963. computed: "asSpecified",
  10964. order: "uniqueOrder",
  10965. status: "nonstandard",
  10966. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-zone"
  10967. },
  10968. "-ms-ime-align": {
  10969. syntax: "auto | after",
  10970. media: "visual",
  10971. inherited: false,
  10972. animationType: "discrete",
  10973. percentages: "no",
  10974. groups: [
  10975. "Microsoft Extensions"
  10976. ],
  10977. initial: "auto",
  10978. appliesto: "allElements",
  10979. computed: "asSpecified",
  10980. order: "uniqueOrder",
  10981. status: "nonstandard",
  10982. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-ime-align"
  10983. },
  10984. "-ms-overflow-style": {
  10985. syntax: "auto | none | scrollbar | -ms-autohiding-scrollbar",
  10986. media: "interactive",
  10987. inherited: true,
  10988. animationType: "discrete",
  10989. percentages: "no",
  10990. groups: [
  10991. "Microsoft Extensions"
  10992. ],
  10993. initial: "auto",
  10994. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10995. computed: "asSpecified",
  10996. order: "uniqueOrder",
  10997. status: "nonstandard",
  10998. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-overflow-style"
  10999. },
  11000. "-ms-scrollbar-3dlight-color": {
  11001. syntax: "<color>",
  11002. media: "visual",
  11003. inherited: true,
  11004. animationType: "discrete",
  11005. percentages: "no",
  11006. groups: [
  11007. "Microsoft Extensions"
  11008. ],
  11009. initial: "dependsOnUserAgent",
  11010. appliesto: "allElements",
  11011. computed: "asSpecified",
  11012. order: "uniqueOrder",
  11013. status: "nonstandard",
  11014. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-3dlight-color"
  11015. },
  11016. "-ms-scrollbar-arrow-color": {
  11017. syntax: "<color>",
  11018. media: "visual",
  11019. inherited: true,
  11020. animationType: "discrete",
  11021. percentages: "no",
  11022. groups: [
  11023. "Microsoft Extensions"
  11024. ],
  11025. initial: "ButtonText",
  11026. appliesto: "allElements",
  11027. computed: "asSpecified",
  11028. order: "uniqueOrder",
  11029. status: "nonstandard",
  11030. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-arrow-color"
  11031. },
  11032. "-ms-scrollbar-base-color": {
  11033. syntax: "<color>",
  11034. media: "visual",
  11035. inherited: true,
  11036. animationType: "discrete",
  11037. percentages: "no",
  11038. groups: [
  11039. "Microsoft Extensions"
  11040. ],
  11041. initial: "dependsOnUserAgent",
  11042. appliesto: "allElements",
  11043. computed: "asSpecified",
  11044. order: "uniqueOrder",
  11045. status: "nonstandard",
  11046. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-base-color"
  11047. },
  11048. "-ms-scrollbar-darkshadow-color": {
  11049. syntax: "<color>",
  11050. media: "visual",
  11051. inherited: true,
  11052. animationType: "discrete",
  11053. percentages: "no",
  11054. groups: [
  11055. "Microsoft Extensions"
  11056. ],
  11057. initial: "ThreeDDarkShadow",
  11058. appliesto: "allElements",
  11059. computed: "asSpecified",
  11060. order: "uniqueOrder",
  11061. status: "nonstandard",
  11062. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-darkshadow-color"
  11063. },
  11064. "-ms-scrollbar-face-color": {
  11065. syntax: "<color>",
  11066. media: "visual",
  11067. inherited: true,
  11068. animationType: "discrete",
  11069. percentages: "no",
  11070. groups: [
  11071. "Microsoft Extensions"
  11072. ],
  11073. initial: "ThreeDFace",
  11074. appliesto: "allElements",
  11075. computed: "asSpecified",
  11076. order: "uniqueOrder",
  11077. status: "nonstandard",
  11078. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-face-color"
  11079. },
  11080. "-ms-scrollbar-highlight-color": {
  11081. syntax: "<color>",
  11082. media: "visual",
  11083. inherited: true,
  11084. animationType: "discrete",
  11085. percentages: "no",
  11086. groups: [
  11087. "Microsoft Extensions"
  11088. ],
  11089. initial: "ThreeDHighlight",
  11090. appliesto: "allElements",
  11091. computed: "asSpecified",
  11092. order: "uniqueOrder",
  11093. status: "nonstandard",
  11094. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-highlight-color"
  11095. },
  11096. "-ms-scrollbar-shadow-color": {
  11097. syntax: "<color>",
  11098. media: "visual",
  11099. inherited: true,
  11100. animationType: "discrete",
  11101. percentages: "no",
  11102. groups: [
  11103. "Microsoft Extensions"
  11104. ],
  11105. initial: "ThreeDDarkShadow",
  11106. appliesto: "allElements",
  11107. computed: "asSpecified",
  11108. order: "uniqueOrder",
  11109. status: "nonstandard",
  11110. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-shadow-color"
  11111. },
  11112. "-ms-scrollbar-track-color": {
  11113. syntax: "<color>",
  11114. media: "visual",
  11115. inherited: true,
  11116. animationType: "discrete",
  11117. percentages: "no",
  11118. groups: [
  11119. "Microsoft Extensions"
  11120. ],
  11121. initial: "Scrollbar",
  11122. appliesto: "allElements",
  11123. computed: "asSpecified",
  11124. order: "uniqueOrder",
  11125. status: "nonstandard",
  11126. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-track-color"
  11127. },
  11128. "-ms-scroll-chaining": {
  11129. syntax: "chained | none",
  11130. media: "interactive",
  11131. inherited: false,
  11132. animationType: "discrete",
  11133. percentages: "no",
  11134. groups: [
  11135. "Microsoft Extensions"
  11136. ],
  11137. initial: "chained",
  11138. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11139. computed: "asSpecified",
  11140. order: "uniqueOrder",
  11141. status: "nonstandard",
  11142. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-chaining"
  11143. },
  11144. "-ms-scroll-limit": {
  11145. syntax: "<'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-scroll-limit-x-max'> <'-ms-scroll-limit-y-max'>",
  11146. media: "interactive",
  11147. inherited: false,
  11148. animationType: "discrete",
  11149. percentages: "no",
  11150. groups: [
  11151. "Microsoft Extensions"
  11152. ],
  11153. initial: [
  11154. "-ms-scroll-limit-x-min",
  11155. "-ms-scroll-limit-y-min",
  11156. "-ms-scroll-limit-x-max",
  11157. "-ms-scroll-limit-y-max"
  11158. ],
  11159. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11160. computed: [
  11161. "-ms-scroll-limit-x-min",
  11162. "-ms-scroll-limit-y-min",
  11163. "-ms-scroll-limit-x-max",
  11164. "-ms-scroll-limit-y-max"
  11165. ],
  11166. order: "uniqueOrder",
  11167. status: "nonstandard",
  11168. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit"
  11169. },
  11170. "-ms-scroll-limit-x-max": {
  11171. syntax: "auto | <length>",
  11172. media: "interactive",
  11173. inherited: false,
  11174. animationType: "discrete",
  11175. percentages: "no",
  11176. groups: [
  11177. "Microsoft Extensions"
  11178. ],
  11179. initial: "auto",
  11180. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11181. computed: "asSpecified",
  11182. order: "uniqueOrder",
  11183. status: "nonstandard",
  11184. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-x-max"
  11185. },
  11186. "-ms-scroll-limit-x-min": {
  11187. syntax: "<length>",
  11188. media: "interactive",
  11189. inherited: false,
  11190. animationType: "discrete",
  11191. percentages: "no",
  11192. groups: [
  11193. "Microsoft Extensions"
  11194. ],
  11195. initial: "0",
  11196. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11197. computed: "asSpecified",
  11198. order: "uniqueOrder",
  11199. status: "nonstandard",
  11200. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-x-min"
  11201. },
  11202. "-ms-scroll-limit-y-max": {
  11203. syntax: "auto | <length>",
  11204. media: "interactive",
  11205. inherited: false,
  11206. animationType: "discrete",
  11207. percentages: "no",
  11208. groups: [
  11209. "Microsoft Extensions"
  11210. ],
  11211. initial: "auto",
  11212. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11213. computed: "asSpecified",
  11214. order: "uniqueOrder",
  11215. status: "nonstandard",
  11216. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-y-max"
  11217. },
  11218. "-ms-scroll-limit-y-min": {
  11219. syntax: "<length>",
  11220. media: "interactive",
  11221. inherited: false,
  11222. animationType: "discrete",
  11223. percentages: "no",
  11224. groups: [
  11225. "Microsoft Extensions"
  11226. ],
  11227. initial: "0",
  11228. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11229. computed: "asSpecified",
  11230. order: "uniqueOrder",
  11231. status: "nonstandard",
  11232. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-y-min"
  11233. },
  11234. "-ms-scroll-rails": {
  11235. syntax: "none | railed",
  11236. media: "interactive",
  11237. inherited: false,
  11238. animationType: "discrete",
  11239. percentages: "no",
  11240. groups: [
  11241. "Microsoft Extensions"
  11242. ],
  11243. initial: "railed",
  11244. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11245. computed: "asSpecified",
  11246. order: "uniqueOrder",
  11247. status: "nonstandard",
  11248. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-rails"
  11249. },
  11250. "-ms-scroll-snap-points-x": {
  11251. syntax: "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )",
  11252. media: "interactive",
  11253. inherited: false,
  11254. animationType: "discrete",
  11255. percentages: "no",
  11256. groups: [
  11257. "Microsoft Extensions"
  11258. ],
  11259. initial: "snapInterval(0px, 100%)",
  11260. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11261. computed: "asSpecified",
  11262. order: "uniqueOrder",
  11263. status: "nonstandard",
  11264. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-points-x"
  11265. },
  11266. "-ms-scroll-snap-points-y": {
  11267. syntax: "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )",
  11268. media: "interactive",
  11269. inherited: false,
  11270. animationType: "discrete",
  11271. percentages: "no",
  11272. groups: [
  11273. "Microsoft Extensions"
  11274. ],
  11275. initial: "snapInterval(0px, 100%)",
  11276. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11277. computed: "asSpecified",
  11278. order: "uniqueOrder",
  11279. status: "nonstandard",
  11280. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-points-y"
  11281. },
  11282. "-ms-scroll-snap-type": {
  11283. syntax: "none | proximity | mandatory",
  11284. media: "interactive",
  11285. inherited: false,
  11286. animationType: "discrete",
  11287. percentages: "no",
  11288. groups: [
  11289. "Microsoft Extensions"
  11290. ],
  11291. initial: "none",
  11292. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11293. computed: "asSpecified",
  11294. order: "uniqueOrder",
  11295. status: "nonstandard",
  11296. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-type"
  11297. },
  11298. "-ms-scroll-snap-x": {
  11299. syntax: "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'>",
  11300. media: "interactive",
  11301. inherited: false,
  11302. animationType: "discrete",
  11303. percentages: "no",
  11304. groups: [
  11305. "Microsoft Extensions"
  11306. ],
  11307. initial: [
  11308. "-ms-scroll-snap-type",
  11309. "-ms-scroll-snap-points-x"
  11310. ],
  11311. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11312. computed: [
  11313. "-ms-scroll-snap-type",
  11314. "-ms-scroll-snap-points-x"
  11315. ],
  11316. order: "uniqueOrder",
  11317. status: "nonstandard",
  11318. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-x"
  11319. },
  11320. "-ms-scroll-snap-y": {
  11321. syntax: "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'>",
  11322. media: "interactive",
  11323. inherited: false,
  11324. animationType: "discrete",
  11325. percentages: "no",
  11326. groups: [
  11327. "Microsoft Extensions"
  11328. ],
  11329. initial: [
  11330. "-ms-scroll-snap-type",
  11331. "-ms-scroll-snap-points-y"
  11332. ],
  11333. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11334. computed: [
  11335. "-ms-scroll-snap-type",
  11336. "-ms-scroll-snap-points-y"
  11337. ],
  11338. order: "uniqueOrder",
  11339. status: "nonstandard",
  11340. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-y"
  11341. },
  11342. "-ms-scroll-translation": {
  11343. syntax: "none | vertical-to-horizontal",
  11344. media: "interactive",
  11345. inherited: true,
  11346. animationType: "discrete",
  11347. percentages: "no",
  11348. groups: [
  11349. "Microsoft Extensions"
  11350. ],
  11351. initial: "none",
  11352. appliesto: "allElements",
  11353. computed: "asSpecified",
  11354. order: "uniqueOrder",
  11355. status: "nonstandard",
  11356. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-translation"
  11357. },
  11358. "-ms-text-autospace": {
  11359. syntax: "none | ideograph-alpha | ideograph-numeric | ideograph-parenthesis | ideograph-space",
  11360. media: "visual",
  11361. inherited: false,
  11362. animationType: "discrete",
  11363. percentages: "no",
  11364. groups: [
  11365. "Microsoft Extensions"
  11366. ],
  11367. initial: "none",
  11368. appliesto: "allElements",
  11369. computed: "asSpecified",
  11370. order: "uniqueOrder",
  11371. status: "nonstandard",
  11372. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-text-autospace"
  11373. },
  11374. "-ms-touch-select": {
  11375. syntax: "grippers | none",
  11376. media: "interactive",
  11377. inherited: true,
  11378. animationType: "discrete",
  11379. percentages: "no",
  11380. groups: [
  11381. "Microsoft Extensions"
  11382. ],
  11383. initial: "grippers",
  11384. appliesto: "allElements",
  11385. computed: "asSpecified",
  11386. order: "uniqueOrder",
  11387. status: "nonstandard",
  11388. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-touch-select"
  11389. },
  11390. "-ms-user-select": {
  11391. syntax: "none | element | text",
  11392. media: "interactive",
  11393. inherited: false,
  11394. animationType: "discrete",
  11395. percentages: "no",
  11396. groups: [
  11397. "Microsoft Extensions"
  11398. ],
  11399. initial: "text",
  11400. appliesto: "nonReplacedElements",
  11401. computed: "asSpecified",
  11402. order: "uniqueOrder",
  11403. status: "nonstandard",
  11404. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-user-select"
  11405. },
  11406. "-ms-wrap-flow": {
  11407. syntax: "auto | both | start | end | maximum | clear",
  11408. media: "visual",
  11409. inherited: false,
  11410. animationType: "discrete",
  11411. percentages: "no",
  11412. groups: [
  11413. "Microsoft Extensions"
  11414. ],
  11415. initial: "auto",
  11416. appliesto: "blockLevelElements",
  11417. computed: "asSpecified",
  11418. order: "uniqueOrder",
  11419. status: "nonstandard",
  11420. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-flow"
  11421. },
  11422. "-ms-wrap-margin": {
  11423. syntax: "<length>",
  11424. media: "visual",
  11425. inherited: false,
  11426. animationType: "discrete",
  11427. percentages: "no",
  11428. groups: [
  11429. "Microsoft Extensions"
  11430. ],
  11431. initial: "0",
  11432. appliesto: "exclusionElements",
  11433. computed: "asSpecified",
  11434. order: "uniqueOrder",
  11435. status: "nonstandard",
  11436. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-margin"
  11437. },
  11438. "-ms-wrap-through": {
  11439. syntax: "wrap | none",
  11440. media: "visual",
  11441. inherited: false,
  11442. animationType: "discrete",
  11443. percentages: "no",
  11444. groups: [
  11445. "Microsoft Extensions"
  11446. ],
  11447. initial: "wrap",
  11448. appliesto: "blockLevelElements",
  11449. computed: "asSpecified",
  11450. order: "uniqueOrder",
  11451. status: "nonstandard",
  11452. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-through"
  11453. },
  11454. "-moz-appearance": {
  11455. 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",
  11456. media: "visual",
  11457. inherited: false,
  11458. animationType: "discrete",
  11459. percentages: "no",
  11460. groups: [
  11461. "Mozilla Extensions",
  11462. "WebKit Extensions"
  11463. ],
  11464. initial: "noneButOverriddenInUserAgentCSS",
  11465. appliesto: "allElements",
  11466. computed: "asSpecified",
  11467. order: "uniqueOrder",
  11468. status: "nonstandard",
  11469. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-appearance"
  11470. },
  11471. "-moz-binding": {
  11472. syntax: "<url> | none",
  11473. media: "visual",
  11474. inherited: false,
  11475. animationType: "discrete",
  11476. percentages: "no",
  11477. groups: [
  11478. "Mozilla Extensions"
  11479. ],
  11480. initial: "none",
  11481. appliesto: "allElementsExceptGeneratedContentOrPseudoElements",
  11482. computed: "asSpecified",
  11483. order: "uniqueOrder",
  11484. status: "nonstandard",
  11485. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-binding"
  11486. },
  11487. "-moz-border-bottom-colors": {
  11488. syntax: "<color>+ | none",
  11489. media: "visual",
  11490. inherited: false,
  11491. animationType: "discrete",
  11492. percentages: "no",
  11493. groups: [
  11494. "Mozilla Extensions"
  11495. ],
  11496. initial: "none",
  11497. appliesto: "allElements",
  11498. computed: "asSpecified",
  11499. order: "uniqueOrder",
  11500. status: "nonstandard",
  11501. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-bottom-colors"
  11502. },
  11503. "-moz-border-left-colors": {
  11504. syntax: "<color>+ | none",
  11505. media: "visual",
  11506. inherited: false,
  11507. animationType: "discrete",
  11508. percentages: "no",
  11509. groups: [
  11510. "Mozilla Extensions"
  11511. ],
  11512. initial: "none",
  11513. appliesto: "allElements",
  11514. computed: "asSpecified",
  11515. order: "uniqueOrder",
  11516. status: "nonstandard",
  11517. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-left-colors"
  11518. },
  11519. "-moz-border-right-colors": {
  11520. syntax: "<color>+ | none",
  11521. media: "visual",
  11522. inherited: false,
  11523. animationType: "discrete",
  11524. percentages: "no",
  11525. groups: [
  11526. "Mozilla Extensions"
  11527. ],
  11528. initial: "none",
  11529. appliesto: "allElements",
  11530. computed: "asSpecified",
  11531. order: "uniqueOrder",
  11532. status: "nonstandard",
  11533. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-right-colors"
  11534. },
  11535. "-moz-border-top-colors": {
  11536. syntax: "<color>+ | none",
  11537. media: "visual",
  11538. inherited: false,
  11539. animationType: "discrete",
  11540. percentages: "no",
  11541. groups: [
  11542. "Mozilla Extensions"
  11543. ],
  11544. initial: "none",
  11545. appliesto: "allElements",
  11546. computed: "asSpecified",
  11547. order: "uniqueOrder",
  11548. status: "nonstandard",
  11549. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-top-colors"
  11550. },
  11551. "-moz-context-properties": {
  11552. syntax: "none | [ fill | fill-opacity | stroke | stroke-opacity ]#",
  11553. media: "visual",
  11554. inherited: true,
  11555. animationType: "discrete",
  11556. percentages: "no",
  11557. groups: [
  11558. "Mozilla Extensions"
  11559. ],
  11560. initial: "none",
  11561. appliesto: "allElementsThatCanReferenceImages",
  11562. computed: "asSpecified",
  11563. order: "uniqueOrder",
  11564. status: "nonstandard",
  11565. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-context-properties"
  11566. },
  11567. "-moz-float-edge": {
  11568. syntax: "border-box | content-box | margin-box | padding-box",
  11569. media: "visual",
  11570. inherited: false,
  11571. animationType: "discrete",
  11572. percentages: "no",
  11573. groups: [
  11574. "Mozilla Extensions"
  11575. ],
  11576. initial: "content-box",
  11577. appliesto: "allElements",
  11578. computed: "asSpecified",
  11579. order: "uniqueOrder",
  11580. status: "nonstandard",
  11581. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-float-edge"
  11582. },
  11583. "-moz-force-broken-image-icon": {
  11584. syntax: "<integer>",
  11585. media: "visual",
  11586. inherited: false,
  11587. animationType: "discrete",
  11588. percentages: "no",
  11589. groups: [
  11590. "Mozilla Extensions"
  11591. ],
  11592. initial: "0",
  11593. appliesto: "images",
  11594. computed: "asSpecified",
  11595. order: "uniqueOrder",
  11596. status: "nonstandard",
  11597. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-force-broken-image-icon"
  11598. },
  11599. "-moz-image-region": {
  11600. syntax: "<shape> | auto",
  11601. media: "visual",
  11602. inherited: true,
  11603. animationType: "discrete",
  11604. percentages: "no",
  11605. groups: [
  11606. "Mozilla Extensions"
  11607. ],
  11608. initial: "auto",
  11609. appliesto: "xulImageElements",
  11610. computed: "asSpecified",
  11611. order: "uniqueOrder",
  11612. status: "nonstandard",
  11613. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-image-region"
  11614. },
  11615. "-moz-orient": {
  11616. syntax: "inline | block | horizontal | vertical",
  11617. media: "visual",
  11618. inherited: false,
  11619. animationType: "discrete",
  11620. percentages: "no",
  11621. groups: [
  11622. "Mozilla Extensions"
  11623. ],
  11624. initial: "inline",
  11625. appliesto: "anyElementEffectOnProgressAndMeter",
  11626. computed: "asSpecified",
  11627. order: "uniqueOrder",
  11628. status: "nonstandard",
  11629. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-orient"
  11630. },
  11631. "-moz-outline-radius": {
  11632. syntax: "<outline-radius>{1,4} [ / <outline-radius>{1,4} ]?",
  11633. media: "visual",
  11634. inherited: false,
  11635. animationType: [
  11636. "-moz-outline-radius-topleft",
  11637. "-moz-outline-radius-topright",
  11638. "-moz-outline-radius-bottomright",
  11639. "-moz-outline-radius-bottomleft"
  11640. ],
  11641. percentages: [
  11642. "-moz-outline-radius-topleft",
  11643. "-moz-outline-radius-topright",
  11644. "-moz-outline-radius-bottomright",
  11645. "-moz-outline-radius-bottomleft"
  11646. ],
  11647. groups: [
  11648. "Mozilla Extensions"
  11649. ],
  11650. initial: [
  11651. "-moz-outline-radius-topleft",
  11652. "-moz-outline-radius-topright",
  11653. "-moz-outline-radius-bottomright",
  11654. "-moz-outline-radius-bottomleft"
  11655. ],
  11656. appliesto: "allElements",
  11657. computed: [
  11658. "-moz-outline-radius-topleft",
  11659. "-moz-outline-radius-topright",
  11660. "-moz-outline-radius-bottomright",
  11661. "-moz-outline-radius-bottomleft"
  11662. ],
  11663. order: "uniqueOrder",
  11664. status: "nonstandard",
  11665. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius"
  11666. },
  11667. "-moz-outline-radius-bottomleft": {
  11668. syntax: "<outline-radius>",
  11669. media: "visual",
  11670. inherited: false,
  11671. animationType: "lpc",
  11672. percentages: "referToDimensionOfBorderBox",
  11673. groups: [
  11674. "Mozilla Extensions"
  11675. ],
  11676. initial: "0",
  11677. appliesto: "allElements",
  11678. computed: "asSpecified",
  11679. order: "uniqueOrder",
  11680. status: "nonstandard",
  11681. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomleft"
  11682. },
  11683. "-moz-outline-radius-bottomright": {
  11684. syntax: "<outline-radius>",
  11685. media: "visual",
  11686. inherited: false,
  11687. animationType: "lpc",
  11688. percentages: "referToDimensionOfBorderBox",
  11689. groups: [
  11690. "Mozilla Extensions"
  11691. ],
  11692. initial: "0",
  11693. appliesto: "allElements",
  11694. computed: "asSpecified",
  11695. order: "uniqueOrder",
  11696. status: "nonstandard",
  11697. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomright"
  11698. },
  11699. "-moz-outline-radius-topleft": {
  11700. syntax: "<outline-radius>",
  11701. media: "visual",
  11702. inherited: false,
  11703. animationType: "lpc",
  11704. percentages: "referToDimensionOfBorderBox",
  11705. groups: [
  11706. "Mozilla Extensions"
  11707. ],
  11708. initial: "0",
  11709. appliesto: "allElements",
  11710. computed: "asSpecified",
  11711. order: "uniqueOrder",
  11712. status: "nonstandard",
  11713. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topleft"
  11714. },
  11715. "-moz-outline-radius-topright": {
  11716. syntax: "<outline-radius>",
  11717. media: "visual",
  11718. inherited: false,
  11719. animationType: "lpc",
  11720. percentages: "referToDimensionOfBorderBox",
  11721. groups: [
  11722. "Mozilla Extensions"
  11723. ],
  11724. initial: "0",
  11725. appliesto: "allElements",
  11726. computed: "asSpecified",
  11727. order: "uniqueOrder",
  11728. status: "nonstandard",
  11729. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topright"
  11730. },
  11731. "-moz-stack-sizing": {
  11732. syntax: "ignore | stretch-to-fit",
  11733. media: "visual",
  11734. inherited: true,
  11735. animationType: "discrete",
  11736. percentages: "no",
  11737. groups: [
  11738. "Mozilla Extensions"
  11739. ],
  11740. initial: "stretch-to-fit",
  11741. appliesto: "allElements",
  11742. computed: "asSpecified",
  11743. order: "uniqueOrder",
  11744. status: "nonstandard",
  11745. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-stack-sizing"
  11746. },
  11747. "-moz-text-blink": {
  11748. syntax: "none | blink",
  11749. media: "visual",
  11750. inherited: false,
  11751. animationType: "discrete",
  11752. percentages: "no",
  11753. groups: [
  11754. "Mozilla Extensions"
  11755. ],
  11756. initial: "none",
  11757. appliesto: "allElements",
  11758. computed: "asSpecified",
  11759. order: "uniqueOrder",
  11760. status: "nonstandard",
  11761. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-text-blink"
  11762. },
  11763. "-moz-user-focus": {
  11764. syntax: "ignore | normal | select-after | select-before | select-menu | select-same | select-all | none",
  11765. media: "interactive",
  11766. inherited: false,
  11767. animationType: "discrete",
  11768. percentages: "no",
  11769. groups: [
  11770. "Mozilla Extensions"
  11771. ],
  11772. initial: "none",
  11773. appliesto: "allElements",
  11774. computed: "asSpecified",
  11775. order: "uniqueOrder",
  11776. status: "nonstandard",
  11777. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-focus"
  11778. },
  11779. "-moz-user-input": {
  11780. syntax: "auto | none | enabled | disabled",
  11781. media: "visual",
  11782. inherited: true,
  11783. animationType: "discrete",
  11784. percentages: "no",
  11785. groups: [
  11786. "Mozilla Extensions"
  11787. ],
  11788. initial: "auto",
  11789. appliesto: "allElements",
  11790. computed: "asSpecified",
  11791. order: "uniqueOrder",
  11792. status: "nonstandard",
  11793. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-input"
  11794. },
  11795. "-moz-user-modify": {
  11796. syntax: "read-only | read-write | write-only",
  11797. media: "interactive",
  11798. inherited: true,
  11799. animationType: "discrete",
  11800. percentages: "no",
  11801. groups: [
  11802. "Mozilla Extensions"
  11803. ],
  11804. initial: "read-only",
  11805. appliesto: "allElements",
  11806. computed: "asSpecified",
  11807. order: "uniqueOrder",
  11808. status: "nonstandard",
  11809. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-modify"
  11810. },
  11811. "-moz-window-dragging": {
  11812. syntax: "drag | no-drag",
  11813. media: "visual",
  11814. inherited: false,
  11815. animationType: "discrete",
  11816. percentages: "no",
  11817. groups: [
  11818. "Mozilla Extensions"
  11819. ],
  11820. initial: "drag",
  11821. appliesto: "allElementsCreatingNativeWindows",
  11822. computed: "asSpecified",
  11823. order: "uniqueOrder",
  11824. status: "nonstandard",
  11825. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-window-dragging"
  11826. },
  11827. "-moz-window-shadow": {
  11828. syntax: "default | menu | tooltip | sheet | none",
  11829. media: "visual",
  11830. inherited: false,
  11831. animationType: "discrete",
  11832. percentages: "no",
  11833. groups: [
  11834. "Mozilla Extensions"
  11835. ],
  11836. initial: "default",
  11837. appliesto: "allElementsCreatingNativeWindows",
  11838. computed: "asSpecified",
  11839. order: "uniqueOrder",
  11840. status: "nonstandard",
  11841. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-window-shadow"
  11842. },
  11843. "-webkit-appearance": {
  11844. 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",
  11845. media: "visual",
  11846. inherited: false,
  11847. animationType: "discrete",
  11848. percentages: "no",
  11849. groups: [
  11850. "WebKit Extensions"
  11851. ],
  11852. initial: "noneButOverriddenInUserAgentCSS",
  11853. appliesto: "allElements",
  11854. computed: "asSpecified",
  11855. order: "uniqueOrder",
  11856. status: "nonstandard",
  11857. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-appearance"
  11858. },
  11859. "-webkit-border-before": {
  11860. syntax: "<'border-width'> || <'border-style'> || <'color'>",
  11861. media: "visual",
  11862. inherited: true,
  11863. animationType: "discrete",
  11864. percentages: [
  11865. "-webkit-border-before-width"
  11866. ],
  11867. groups: [
  11868. "WebKit Extensions"
  11869. ],
  11870. initial: [
  11871. "border-width",
  11872. "border-style",
  11873. "color"
  11874. ],
  11875. appliesto: "allElements",
  11876. computed: [
  11877. "border-width",
  11878. "border-style",
  11879. "color"
  11880. ],
  11881. order: "uniqueOrder",
  11882. status: "nonstandard",
  11883. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-border-before"
  11884. },
  11885. "-webkit-border-before-color": {
  11886. syntax: "<'color'>",
  11887. media: "visual",
  11888. inherited: true,
  11889. animationType: "discrete",
  11890. percentages: "no",
  11891. groups: [
  11892. "WebKit Extensions"
  11893. ],
  11894. initial: "currentcolor",
  11895. appliesto: "allElements",
  11896. computed: "computedColor",
  11897. order: "uniqueOrder",
  11898. status: "nonstandard"
  11899. },
  11900. "-webkit-border-before-style": {
  11901. syntax: "<'border-style'>",
  11902. media: "visual",
  11903. inherited: true,
  11904. animationType: "discrete",
  11905. percentages: "no",
  11906. groups: [
  11907. "WebKit Extensions"
  11908. ],
  11909. initial: "none",
  11910. appliesto: "allElements",
  11911. computed: "asSpecified",
  11912. order: "uniqueOrder",
  11913. status: "nonstandard"
  11914. },
  11915. "-webkit-border-before-width": {
  11916. syntax: "<'border-width'>",
  11917. media: "visual",
  11918. inherited: true,
  11919. animationType: "discrete",
  11920. percentages: "logicalWidthOfContainingBlock",
  11921. groups: [
  11922. "WebKit Extensions"
  11923. ],
  11924. initial: "medium",
  11925. appliesto: "allElements",
  11926. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  11927. order: "uniqueOrder",
  11928. status: "nonstandard"
  11929. },
  11930. "-webkit-box-reflect": {
  11931. syntax: "[ above | below | right | left ]? <length>? <image>?",
  11932. media: "visual",
  11933. inherited: false,
  11934. animationType: "discrete",
  11935. percentages: "no",
  11936. groups: [
  11937. "WebKit Extensions"
  11938. ],
  11939. initial: "none",
  11940. appliesto: "allElements",
  11941. computed: "asSpecified",
  11942. order: "uniqueOrder",
  11943. status: "nonstandard",
  11944. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-box-reflect"
  11945. },
  11946. "-webkit-line-clamp": {
  11947. syntax: "none | <integer>",
  11948. media: "visual",
  11949. inherited: false,
  11950. animationType: "byComputedValueType",
  11951. percentages: "no",
  11952. groups: [
  11953. "WebKit Extensions",
  11954. "CSS Overflow"
  11955. ],
  11956. initial: "none",
  11957. appliesto: "allElements",
  11958. computed: "asSpecified",
  11959. order: "uniqueOrder",
  11960. status: "standard",
  11961. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-line-clamp"
  11962. },
  11963. "-webkit-mask": {
  11964. syntax: "[ <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || [ <box> | border | padding | content | text ] || [ <box> | border | padding | content ] ]#",
  11965. media: "visual",
  11966. inherited: false,
  11967. animationType: "discrete",
  11968. percentages: "no",
  11969. groups: [
  11970. "WebKit Extensions"
  11971. ],
  11972. initial: [
  11973. "-webkit-mask-image",
  11974. "-webkit-mask-repeat",
  11975. "-webkit-mask-attachment",
  11976. "-webkit-mask-position",
  11977. "-webkit-mask-origin",
  11978. "-webkit-mask-clip"
  11979. ],
  11980. appliesto: "allElements",
  11981. computed: [
  11982. "-webkit-mask-image",
  11983. "-webkit-mask-repeat",
  11984. "-webkit-mask-attachment",
  11985. "-webkit-mask-position",
  11986. "-webkit-mask-origin",
  11987. "-webkit-mask-clip"
  11988. ],
  11989. order: "uniqueOrder",
  11990. status: "nonstandard",
  11991. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask"
  11992. },
  11993. "-webkit-mask-attachment": {
  11994. syntax: "<attachment>#",
  11995. media: "visual",
  11996. inherited: false,
  11997. animationType: "discrete",
  11998. percentages: "no",
  11999. groups: [
  12000. "WebKit Extensions"
  12001. ],
  12002. initial: "scroll",
  12003. appliesto: "allElements",
  12004. computed: "asSpecified",
  12005. order: "orderOfAppearance",
  12006. status: "nonstandard",
  12007. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-attachment"
  12008. },
  12009. "-webkit-mask-clip": {
  12010. syntax: "[ <box> | border | padding | content | text ]#",
  12011. media: "visual",
  12012. inherited: false,
  12013. animationType: "discrete",
  12014. percentages: "no",
  12015. groups: [
  12016. "WebKit Extensions"
  12017. ],
  12018. initial: "border",
  12019. appliesto: "allElements",
  12020. computed: "asSpecified",
  12021. order: "orderOfAppearance",
  12022. status: "nonstandard",
  12023. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-clip"
  12024. },
  12025. "-webkit-mask-composite": {
  12026. syntax: "<composite-style>#",
  12027. media: "visual",
  12028. inherited: false,
  12029. animationType: "discrete",
  12030. percentages: "no",
  12031. groups: [
  12032. "WebKit Extensions"
  12033. ],
  12034. initial: "source-over",
  12035. appliesto: "allElements",
  12036. computed: "asSpecified",
  12037. order: "orderOfAppearance",
  12038. status: "nonstandard",
  12039. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-composite"
  12040. },
  12041. "-webkit-mask-image": {
  12042. syntax: "<mask-reference>#",
  12043. media: "visual",
  12044. inherited: false,
  12045. animationType: "discrete",
  12046. percentages: "no",
  12047. groups: [
  12048. "WebKit Extensions"
  12049. ],
  12050. initial: "none",
  12051. appliesto: "allElements",
  12052. computed: "absoluteURIOrNone",
  12053. order: "orderOfAppearance",
  12054. status: "nonstandard",
  12055. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-image"
  12056. },
  12057. "-webkit-mask-origin": {
  12058. syntax: "[ <box> | border | padding | content ]#",
  12059. media: "visual",
  12060. inherited: false,
  12061. animationType: "discrete",
  12062. percentages: "no",
  12063. groups: [
  12064. "WebKit Extensions"
  12065. ],
  12066. initial: "padding",
  12067. appliesto: "allElements",
  12068. computed: "asSpecified",
  12069. order: "orderOfAppearance",
  12070. status: "nonstandard",
  12071. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-origin"
  12072. },
  12073. "-webkit-mask-position": {
  12074. syntax: "<position>#",
  12075. media: "visual",
  12076. inherited: false,
  12077. animationType: "discrete",
  12078. percentages: "referToSizeOfElement",
  12079. groups: [
  12080. "WebKit Extensions"
  12081. ],
  12082. initial: "0% 0%",
  12083. appliesto: "allElements",
  12084. computed: "absoluteLengthOrPercentage",
  12085. order: "orderOfAppearance",
  12086. status: "nonstandard",
  12087. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-position"
  12088. },
  12089. "-webkit-mask-position-x": {
  12090. syntax: "[ <length-percentage> | left | center | right ]#",
  12091. media: "visual",
  12092. inherited: false,
  12093. animationType: "discrete",
  12094. percentages: "referToSizeOfElement",
  12095. groups: [
  12096. "WebKit Extensions"
  12097. ],
  12098. initial: "0%",
  12099. appliesto: "allElements",
  12100. computed: "absoluteLengthOrPercentage",
  12101. order: "orderOfAppearance",
  12102. status: "nonstandard",
  12103. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-x"
  12104. },
  12105. "-webkit-mask-position-y": {
  12106. syntax: "[ <length-percentage> | top | center | bottom ]#",
  12107. media: "visual",
  12108. inherited: false,
  12109. animationType: "discrete",
  12110. percentages: "referToSizeOfElement",
  12111. groups: [
  12112. "WebKit Extensions"
  12113. ],
  12114. initial: "0%",
  12115. appliesto: "allElements",
  12116. computed: "absoluteLengthOrPercentage",
  12117. order: "orderOfAppearance",
  12118. status: "nonstandard",
  12119. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-y"
  12120. },
  12121. "-webkit-mask-repeat": {
  12122. syntax: "<repeat-style>#",
  12123. media: "visual",
  12124. inherited: false,
  12125. animationType: "discrete",
  12126. percentages: "no",
  12127. groups: [
  12128. "WebKit Extensions"
  12129. ],
  12130. initial: "repeat",
  12131. appliesto: "allElements",
  12132. computed: "asSpecified",
  12133. order: "orderOfAppearance",
  12134. status: "nonstandard",
  12135. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-repeat"
  12136. },
  12137. "-webkit-mask-repeat-x": {
  12138. syntax: "repeat | no-repeat | space | round",
  12139. media: "visual",
  12140. inherited: false,
  12141. animationType: "discrete",
  12142. percentages: "no",
  12143. groups: [
  12144. "WebKit Extensions"
  12145. ],
  12146. initial: "repeat",
  12147. appliesto: "allElements",
  12148. computed: "asSpecified",
  12149. order: "orderOfAppearance",
  12150. status: "nonstandard",
  12151. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-x"
  12152. },
  12153. "-webkit-mask-repeat-y": {
  12154. syntax: "repeat | no-repeat | space | round",
  12155. media: "visual",
  12156. inherited: false,
  12157. animationType: "discrete",
  12158. percentages: "no",
  12159. groups: [
  12160. "WebKit Extensions"
  12161. ],
  12162. initial: "repeat",
  12163. appliesto: "allElements",
  12164. computed: "absoluteLengthOrPercentage",
  12165. order: "orderOfAppearance",
  12166. status: "nonstandard",
  12167. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-y"
  12168. },
  12169. "-webkit-mask-size": {
  12170. syntax: "<bg-size>#",
  12171. media: "visual",
  12172. inherited: false,
  12173. animationType: "discrete",
  12174. percentages: "relativeToBackgroundPositioningArea",
  12175. groups: [
  12176. "WebKit Extensions"
  12177. ],
  12178. initial: "auto auto",
  12179. appliesto: "allElements",
  12180. computed: "asSpecified",
  12181. order: "orderOfAppearance",
  12182. status: "nonstandard",
  12183. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-size"
  12184. },
  12185. "-webkit-overflow-scrolling": {
  12186. syntax: "auto | touch",
  12187. media: "visual",
  12188. inherited: true,
  12189. animationType: "discrete",
  12190. percentages: "no",
  12191. groups: [
  12192. "WebKit Extensions"
  12193. ],
  12194. initial: "auto",
  12195. appliesto: "scrollingBoxes",
  12196. computed: "asSpecified",
  12197. order: "orderOfAppearance",
  12198. status: "nonstandard",
  12199. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-overflow-scrolling"
  12200. },
  12201. "-webkit-tap-highlight-color": {
  12202. syntax: "<color>",
  12203. media: "visual",
  12204. inherited: false,
  12205. animationType: "discrete",
  12206. percentages: "no",
  12207. groups: [
  12208. "WebKit Extensions"
  12209. ],
  12210. initial: "black",
  12211. appliesto: "allElements",
  12212. computed: "asSpecified",
  12213. order: "uniqueOrder",
  12214. status: "nonstandard",
  12215. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-tap-highlight-color"
  12216. },
  12217. "-webkit-text-fill-color": {
  12218. syntax: "<color>",
  12219. media: "visual",
  12220. inherited: true,
  12221. animationType: "color",
  12222. percentages: "no",
  12223. groups: [
  12224. "WebKit Extensions"
  12225. ],
  12226. initial: "currentcolor",
  12227. appliesto: "allElements",
  12228. computed: "computedColor",
  12229. order: "uniqueOrder",
  12230. status: "nonstandard",
  12231. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-fill-color"
  12232. },
  12233. "-webkit-text-stroke": {
  12234. syntax: "<length> || <color>",
  12235. media: "visual",
  12236. inherited: true,
  12237. animationType: [
  12238. "-webkit-text-stroke-width",
  12239. "-webkit-text-stroke-color"
  12240. ],
  12241. percentages: "no",
  12242. groups: [
  12243. "WebKit Extensions"
  12244. ],
  12245. initial: [
  12246. "-webkit-text-stroke-width",
  12247. "-webkit-text-stroke-color"
  12248. ],
  12249. appliesto: "allElements",
  12250. computed: [
  12251. "-webkit-text-stroke-width",
  12252. "-webkit-text-stroke-color"
  12253. ],
  12254. order: "canonicalOrder",
  12255. status: "nonstandard",
  12256. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke"
  12257. },
  12258. "-webkit-text-stroke-color": {
  12259. syntax: "<color>",
  12260. media: "visual",
  12261. inherited: true,
  12262. animationType: "color",
  12263. percentages: "no",
  12264. groups: [
  12265. "WebKit Extensions"
  12266. ],
  12267. initial: "currentcolor",
  12268. appliesto: "allElements",
  12269. computed: "computedColor",
  12270. order: "uniqueOrder",
  12271. status: "nonstandard",
  12272. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-color"
  12273. },
  12274. "-webkit-text-stroke-width": {
  12275. syntax: "<length>",
  12276. media: "visual",
  12277. inherited: true,
  12278. animationType: "discrete",
  12279. percentages: "no",
  12280. groups: [
  12281. "WebKit Extensions"
  12282. ],
  12283. initial: "0",
  12284. appliesto: "allElements",
  12285. computed: "absoluteLength",
  12286. order: "uniqueOrder",
  12287. status: "nonstandard",
  12288. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-width"
  12289. },
  12290. "-webkit-touch-callout": {
  12291. syntax: "default | none",
  12292. media: "visual",
  12293. inherited: true,
  12294. animationType: "discrete",
  12295. percentages: "no",
  12296. groups: [
  12297. "WebKit Extensions"
  12298. ],
  12299. initial: "default",
  12300. appliesto: "allElements",
  12301. computed: "asSpecified",
  12302. order: "uniqueOrder",
  12303. status: "nonstandard",
  12304. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-touch-callout"
  12305. },
  12306. "-webkit-user-modify": {
  12307. syntax: "read-only | read-write | read-write-plaintext-only",
  12308. media: "interactive",
  12309. inherited: true,
  12310. animationType: "discrete",
  12311. percentages: "no",
  12312. groups: [
  12313. "WebKit Extensions"
  12314. ],
  12315. initial: "read-only",
  12316. appliesto: "allElements",
  12317. computed: "asSpecified",
  12318. order: "uniqueOrder",
  12319. status: "nonstandard"
  12320. },
  12321. "align-content": {
  12322. syntax: "normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position>",
  12323. media: "visual",
  12324. inherited: false,
  12325. animationType: "discrete",
  12326. percentages: "no",
  12327. groups: [
  12328. "CSS Box Alignment"
  12329. ],
  12330. initial: "normal",
  12331. appliesto: "multilineFlexContainers",
  12332. computed: "asSpecified",
  12333. order: "uniqueOrder",
  12334. status: "standard",
  12335. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-content"
  12336. },
  12337. "align-items": {
  12338. syntax: "normal | stretch | <baseline-position> | [ <overflow-position>? <self-position> ]",
  12339. media: "visual",
  12340. inherited: false,
  12341. animationType: "discrete",
  12342. percentages: "no",
  12343. groups: [
  12344. "CSS Box Alignment"
  12345. ],
  12346. initial: "normal",
  12347. appliesto: "allElements",
  12348. computed: "asSpecified",
  12349. order: "uniqueOrder",
  12350. status: "standard",
  12351. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-items"
  12352. },
  12353. "align-self": {
  12354. syntax: "auto | normal | stretch | <baseline-position> | <overflow-position>? <self-position>",
  12355. media: "visual",
  12356. inherited: false,
  12357. animationType: "discrete",
  12358. percentages: "no",
  12359. groups: [
  12360. "CSS Box Alignment"
  12361. ],
  12362. initial: "auto",
  12363. appliesto: "flexItemsGridItemsAndAbsolutelyPositionedBoxes",
  12364. computed: "autoOnAbsolutelyPositionedElementsValueOfAlignItemsOnParent",
  12365. order: "uniqueOrder",
  12366. status: "standard",
  12367. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-self"
  12368. },
  12369. all: all,
  12370. animation: animation,
  12371. "animation-delay": {
  12372. syntax: "<time>#",
  12373. media: "visual",
  12374. inherited: false,
  12375. animationType: "discrete",
  12376. percentages: "no",
  12377. groups: [
  12378. "CSS Animations"
  12379. ],
  12380. initial: "0s",
  12381. appliesto: "allElementsAndPseudos",
  12382. computed: "asSpecified",
  12383. order: "uniqueOrder",
  12384. status: "standard",
  12385. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-delay"
  12386. },
  12387. "animation-direction": {
  12388. syntax: "<single-animation-direction>#",
  12389. media: "visual",
  12390. inherited: false,
  12391. animationType: "discrete",
  12392. percentages: "no",
  12393. groups: [
  12394. "CSS Animations"
  12395. ],
  12396. initial: "normal",
  12397. appliesto: "allElementsAndPseudos",
  12398. computed: "asSpecified",
  12399. order: "uniqueOrder",
  12400. status: "standard",
  12401. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-direction"
  12402. },
  12403. "animation-duration": {
  12404. syntax: "<time>#",
  12405. media: "visual",
  12406. inherited: false,
  12407. animationType: "discrete",
  12408. percentages: "no",
  12409. groups: [
  12410. "CSS Animations"
  12411. ],
  12412. initial: "0s",
  12413. appliesto: "allElementsAndPseudos",
  12414. computed: "asSpecified",
  12415. order: "uniqueOrder",
  12416. status: "standard",
  12417. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-duration"
  12418. },
  12419. "animation-fill-mode": {
  12420. syntax: "<single-animation-fill-mode>#",
  12421. media: "visual",
  12422. inherited: false,
  12423. animationType: "discrete",
  12424. percentages: "no",
  12425. groups: [
  12426. "CSS Animations"
  12427. ],
  12428. initial: "none",
  12429. appliesto: "allElementsAndPseudos",
  12430. computed: "asSpecified",
  12431. order: "uniqueOrder",
  12432. status: "standard",
  12433. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode"
  12434. },
  12435. "animation-iteration-count": {
  12436. syntax: "<single-animation-iteration-count>#",
  12437. media: "visual",
  12438. inherited: false,
  12439. animationType: "discrete",
  12440. percentages: "no",
  12441. groups: [
  12442. "CSS Animations"
  12443. ],
  12444. initial: "1",
  12445. appliesto: "allElementsAndPseudos",
  12446. computed: "asSpecified",
  12447. order: "uniqueOrder",
  12448. status: "standard",
  12449. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count"
  12450. },
  12451. "animation-name": {
  12452. syntax: "[ none | <keyframes-name> ]#",
  12453. media: "visual",
  12454. inherited: false,
  12455. animationType: "discrete",
  12456. percentages: "no",
  12457. groups: [
  12458. "CSS Animations"
  12459. ],
  12460. initial: "none",
  12461. appliesto: "allElementsAndPseudos",
  12462. computed: "asSpecified",
  12463. order: "uniqueOrder",
  12464. status: "standard",
  12465. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-name"
  12466. },
  12467. "animation-play-state": {
  12468. syntax: "<single-animation-play-state>#",
  12469. media: "visual",
  12470. inherited: false,
  12471. animationType: "discrete",
  12472. percentages: "no",
  12473. groups: [
  12474. "CSS Animations"
  12475. ],
  12476. initial: "running",
  12477. appliesto: "allElementsAndPseudos",
  12478. computed: "asSpecified",
  12479. order: "uniqueOrder",
  12480. status: "standard",
  12481. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-play-state"
  12482. },
  12483. "animation-timing-function": {
  12484. syntax: "<timing-function>#",
  12485. media: "visual",
  12486. inherited: false,
  12487. animationType: "discrete",
  12488. percentages: "no",
  12489. groups: [
  12490. "CSS Animations"
  12491. ],
  12492. initial: "ease",
  12493. appliesto: "allElementsAndPseudos",
  12494. computed: "asSpecified",
  12495. order: "uniqueOrder",
  12496. status: "standard",
  12497. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-timing-function"
  12498. },
  12499. appearance: appearance,
  12500. "aspect-ratio": {
  12501. syntax: "auto | <ratio>",
  12502. media: "all",
  12503. inherited: false,
  12504. animationType: "discrete",
  12505. percentages: "no",
  12506. groups: [
  12507. "CSS Basic User Interface"
  12508. ],
  12509. initial: "auto",
  12510. appliesto: "allElementsExceptInlineBoxesAndInternalRubyOrTableBoxes",
  12511. computed: "asSpecified",
  12512. order: "perGrammar",
  12513. status: "experimental",
  12514. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/aspect-ratio"
  12515. },
  12516. azimuth: azimuth,
  12517. "backdrop-filter": {
  12518. syntax: "none | <filter-function-list>",
  12519. media: "visual",
  12520. inherited: false,
  12521. animationType: "filterList",
  12522. percentages: "no",
  12523. groups: [
  12524. "Filter Effects"
  12525. ],
  12526. initial: "none",
  12527. appliesto: "allElementsSVGContainerElements",
  12528. computed: "asSpecified",
  12529. order: "uniqueOrder",
  12530. status: "experimental",
  12531. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/backdrop-filter"
  12532. },
  12533. "backface-visibility": {
  12534. syntax: "visible | hidden",
  12535. media: "visual",
  12536. inherited: false,
  12537. animationType: "discrete",
  12538. percentages: "no",
  12539. groups: [
  12540. "CSS Transforms"
  12541. ],
  12542. initial: "visible",
  12543. appliesto: "transformableElements",
  12544. computed: "asSpecified",
  12545. order: "uniqueOrder",
  12546. status: "standard",
  12547. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/backface-visibility"
  12548. },
  12549. background: background,
  12550. "background-attachment": {
  12551. syntax: "<attachment>#",
  12552. media: "visual",
  12553. inherited: false,
  12554. animationType: "discrete",
  12555. percentages: "no",
  12556. groups: [
  12557. "CSS Backgrounds and Borders"
  12558. ],
  12559. initial: "scroll",
  12560. appliesto: "allElements",
  12561. computed: "asSpecified",
  12562. order: "uniqueOrder",
  12563. alsoAppliesTo: [
  12564. "::first-letter",
  12565. "::first-line",
  12566. "::placeholder"
  12567. ],
  12568. status: "standard",
  12569. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-attachment"
  12570. },
  12571. "background-blend-mode": {
  12572. syntax: "<blend-mode>#",
  12573. media: "none",
  12574. inherited: false,
  12575. animationType: "discrete",
  12576. percentages: "no",
  12577. groups: [
  12578. "Compositing and Blending"
  12579. ],
  12580. initial: "normal",
  12581. appliesto: "allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
  12582. computed: "asSpecified",
  12583. order: "uniqueOrder",
  12584. alsoAppliesTo: [
  12585. "::first-letter",
  12586. "::first-line",
  12587. "::placeholder"
  12588. ],
  12589. status: "standard",
  12590. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-blend-mode"
  12591. },
  12592. "background-clip": {
  12593. syntax: "<box>#",
  12594. media: "visual",
  12595. inherited: false,
  12596. animationType: "discrete",
  12597. percentages: "no",
  12598. groups: [
  12599. "CSS Backgrounds and Borders"
  12600. ],
  12601. initial: "border-box",
  12602. appliesto: "allElements",
  12603. computed: "asSpecified",
  12604. order: "uniqueOrder",
  12605. alsoAppliesTo: [
  12606. "::first-letter",
  12607. "::first-line",
  12608. "::placeholder"
  12609. ],
  12610. status: "standard",
  12611. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-clip"
  12612. },
  12613. "background-color": {
  12614. syntax: "<color>",
  12615. media: "visual",
  12616. inherited: false,
  12617. animationType: "color",
  12618. percentages: "no",
  12619. groups: [
  12620. "CSS Backgrounds and Borders"
  12621. ],
  12622. initial: "transparent",
  12623. appliesto: "allElements",
  12624. computed: "computedColor",
  12625. order: "uniqueOrder",
  12626. alsoAppliesTo: [
  12627. "::first-letter",
  12628. "::first-line",
  12629. "::placeholder"
  12630. ],
  12631. status: "standard",
  12632. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-color"
  12633. },
  12634. "background-image": {
  12635. syntax: "<bg-image>#",
  12636. media: "visual",
  12637. inherited: false,
  12638. animationType: "discrete",
  12639. percentages: "no",
  12640. groups: [
  12641. "CSS Backgrounds and Borders"
  12642. ],
  12643. initial: "none",
  12644. appliesto: "allElements",
  12645. computed: "asSpecifiedURLsAbsolute",
  12646. order: "uniqueOrder",
  12647. alsoAppliesTo: [
  12648. "::first-letter",
  12649. "::first-line",
  12650. "::placeholder"
  12651. ],
  12652. status: "standard",
  12653. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-image"
  12654. },
  12655. "background-origin": {
  12656. syntax: "<box>#",
  12657. media: "visual",
  12658. inherited: false,
  12659. animationType: "discrete",
  12660. percentages: "no",
  12661. groups: [
  12662. "CSS Backgrounds and Borders"
  12663. ],
  12664. initial: "padding-box",
  12665. appliesto: "allElements",
  12666. computed: "asSpecified",
  12667. order: "uniqueOrder",
  12668. alsoAppliesTo: [
  12669. "::first-letter",
  12670. "::first-line",
  12671. "::placeholder"
  12672. ],
  12673. status: "standard",
  12674. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-origin"
  12675. },
  12676. "background-position": {
  12677. syntax: "<bg-position>#",
  12678. media: "visual",
  12679. inherited: false,
  12680. animationType: "repeatableListOfSimpleListOfLpc",
  12681. percentages: "referToSizeOfBackgroundPositioningAreaMinusBackgroundImageSize",
  12682. groups: [
  12683. "CSS Backgrounds and Borders"
  12684. ],
  12685. initial: "0% 0%",
  12686. appliesto: "allElements",
  12687. computed: "listEachItemTwoKeywordsOriginOffsets",
  12688. order: "uniqueOrder",
  12689. alsoAppliesTo: [
  12690. "::first-letter",
  12691. "::first-line",
  12692. "::placeholder"
  12693. ],
  12694. status: "standard",
  12695. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position"
  12696. },
  12697. "background-position-x": {
  12698. syntax: "[ center | [ left | right | x-start | x-end ]? <length-percentage>? ]#",
  12699. media: "visual",
  12700. inherited: false,
  12701. animationType: "discrete",
  12702. percentages: "referToWidthOfBackgroundPositioningAreaMinusBackgroundImageHeight",
  12703. groups: [
  12704. "CSS Backgrounds and Borders"
  12705. ],
  12706. initial: "left",
  12707. appliesto: "allElements",
  12708. computed: "listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
  12709. order: "uniqueOrder",
  12710. status: "experimental",
  12711. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position-x"
  12712. },
  12713. "background-position-y": {
  12714. syntax: "[ center | [ top | bottom | y-start | y-end ]? <length-percentage>? ]#",
  12715. media: "visual",
  12716. inherited: false,
  12717. animationType: "discrete",
  12718. percentages: "referToHeightOfBackgroundPositioningAreaMinusBackgroundImageHeight",
  12719. groups: [
  12720. "CSS Backgrounds and Borders"
  12721. ],
  12722. initial: "top",
  12723. appliesto: "allElements",
  12724. computed: "listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
  12725. order: "uniqueOrder",
  12726. status: "experimental",
  12727. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position-y"
  12728. },
  12729. "background-repeat": {
  12730. syntax: "<repeat-style>#",
  12731. media: "visual",
  12732. inherited: false,
  12733. animationType: "discrete",
  12734. percentages: "no",
  12735. groups: [
  12736. "CSS Backgrounds and Borders"
  12737. ],
  12738. initial: "repeat",
  12739. appliesto: "allElements",
  12740. computed: "listEachItemHasTwoKeywordsOnePerDimension",
  12741. order: "uniqueOrder",
  12742. alsoAppliesTo: [
  12743. "::first-letter",
  12744. "::first-line",
  12745. "::placeholder"
  12746. ],
  12747. status: "standard",
  12748. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-repeat"
  12749. },
  12750. "background-size": {
  12751. syntax: "<bg-size>#",
  12752. media: "visual",
  12753. inherited: false,
  12754. animationType: "repeatableListOfSimpleListOfLpc",
  12755. percentages: "relativeToBackgroundPositioningArea",
  12756. groups: [
  12757. "CSS Backgrounds and Borders"
  12758. ],
  12759. initial: "auto auto",
  12760. appliesto: "allElements",
  12761. computed: "asSpecifiedRelativeToAbsoluteLengths",
  12762. order: "uniqueOrder",
  12763. alsoAppliesTo: [
  12764. "::first-letter",
  12765. "::first-line",
  12766. "::placeholder"
  12767. ],
  12768. status: "standard",
  12769. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-size"
  12770. },
  12771. "block-overflow": {
  12772. syntax: "clip | ellipsis | <string>",
  12773. media: "visual",
  12774. inherited: true,
  12775. animationType: "discrete",
  12776. percentages: "no",
  12777. groups: [
  12778. "CSS Overflow"
  12779. ],
  12780. initial: "clip",
  12781. appliesto: "blockContainers",
  12782. computed: "asSpecified",
  12783. order: "perGrammar",
  12784. status: "experimental"
  12785. },
  12786. "block-size": {
  12787. syntax: "<'width'>",
  12788. media: "visual",
  12789. inherited: false,
  12790. animationType: "discrete",
  12791. percentages: "blockSizeOfContainingBlock",
  12792. groups: [
  12793. "CSS Logical Properties"
  12794. ],
  12795. initial: "auto",
  12796. appliesto: "sameAsWidthAndHeight",
  12797. computed: "sameAsWidthAndHeight",
  12798. order: "uniqueOrder",
  12799. status: "standard",
  12800. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/block-size"
  12801. },
  12802. border: border,
  12803. "border-block": {
  12804. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  12805. media: "visual",
  12806. inherited: false,
  12807. animationType: "discrete",
  12808. percentages: "no",
  12809. groups: [
  12810. "CSS Logical Properties"
  12811. ],
  12812. initial: [
  12813. "border-top-width",
  12814. "border-top-style",
  12815. "border-top-color"
  12816. ],
  12817. appliesto: "allElements",
  12818. computed: [
  12819. "border-top-width",
  12820. "border-top-style",
  12821. "border-top-color"
  12822. ],
  12823. order: "uniqueOrder",
  12824. status: "standard",
  12825. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block"
  12826. },
  12827. "border-block-color": {
  12828. syntax: "<'border-top-color'>{1,2}",
  12829. media: "visual",
  12830. inherited: false,
  12831. animationType: "discrete",
  12832. percentages: "no",
  12833. groups: [
  12834. "CSS Logical Properties"
  12835. ],
  12836. initial: "currentcolor",
  12837. appliesto: "allElements",
  12838. computed: "computedColor",
  12839. order: "uniqueOrder",
  12840. status: "standard",
  12841. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-color"
  12842. },
  12843. "border-block-style": {
  12844. syntax: "<'border-top-style'>",
  12845. media: "visual",
  12846. inherited: false,
  12847. animationType: "discrete",
  12848. percentages: "no",
  12849. groups: [
  12850. "CSS Logical Properties"
  12851. ],
  12852. initial: "none",
  12853. appliesto: "allElements",
  12854. computed: "asSpecified",
  12855. order: "uniqueOrder",
  12856. status: "standard",
  12857. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-style"
  12858. },
  12859. "border-block-width": {
  12860. syntax: "<'border-top-width'>",
  12861. media: "visual",
  12862. inherited: false,
  12863. animationType: "discrete",
  12864. percentages: "logicalWidthOfContainingBlock",
  12865. groups: [
  12866. "CSS Logical Properties"
  12867. ],
  12868. initial: "medium",
  12869. appliesto: "allElements",
  12870. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  12871. order: "uniqueOrder",
  12872. status: "standard",
  12873. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-width"
  12874. },
  12875. "border-block-end": {
  12876. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  12877. media: "visual",
  12878. inherited: false,
  12879. animationType: "discrete",
  12880. percentages: "no",
  12881. groups: [
  12882. "CSS Logical Properties"
  12883. ],
  12884. initial: [
  12885. "border-top-width",
  12886. "border-top-style",
  12887. "border-top-color"
  12888. ],
  12889. appliesto: "allElements",
  12890. computed: [
  12891. "border-top-width",
  12892. "border-top-style",
  12893. "border-top-color"
  12894. ],
  12895. order: "uniqueOrder",
  12896. status: "standard",
  12897. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end"
  12898. },
  12899. "border-block-end-color": {
  12900. syntax: "<'border-top-color'>",
  12901. media: "visual",
  12902. inherited: false,
  12903. animationType: "discrete",
  12904. percentages: "no",
  12905. groups: [
  12906. "CSS Logical Properties"
  12907. ],
  12908. initial: "currentcolor",
  12909. appliesto: "allElements",
  12910. computed: "computedColor",
  12911. order: "uniqueOrder",
  12912. status: "standard",
  12913. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-color"
  12914. },
  12915. "border-block-end-style": {
  12916. syntax: "<'border-top-style'>",
  12917. media: "visual",
  12918. inherited: false,
  12919. animationType: "discrete",
  12920. percentages: "no",
  12921. groups: [
  12922. "CSS Logical Properties"
  12923. ],
  12924. initial: "none",
  12925. appliesto: "allElements",
  12926. computed: "asSpecified",
  12927. order: "uniqueOrder",
  12928. status: "standard",
  12929. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-style"
  12930. },
  12931. "border-block-end-width": {
  12932. syntax: "<'border-top-width'>",
  12933. media: "visual",
  12934. inherited: false,
  12935. animationType: "discrete",
  12936. percentages: "logicalWidthOfContainingBlock",
  12937. groups: [
  12938. "CSS Logical Properties"
  12939. ],
  12940. initial: "medium",
  12941. appliesto: "allElements",
  12942. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  12943. order: "uniqueOrder",
  12944. status: "standard",
  12945. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-width"
  12946. },
  12947. "border-block-start": {
  12948. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  12949. media: "visual",
  12950. inherited: false,
  12951. animationType: "discrete",
  12952. percentages: "no",
  12953. groups: [
  12954. "CSS Logical Properties"
  12955. ],
  12956. initial: [
  12957. "border-width",
  12958. "border-style",
  12959. "color"
  12960. ],
  12961. appliesto: "allElements",
  12962. computed: [
  12963. "border-width",
  12964. "border-style",
  12965. "border-block-start-color"
  12966. ],
  12967. order: "uniqueOrder",
  12968. status: "standard",
  12969. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start"
  12970. },
  12971. "border-block-start-color": {
  12972. syntax: "<'border-top-color'>",
  12973. media: "visual",
  12974. inherited: false,
  12975. animationType: "discrete",
  12976. percentages: "no",
  12977. groups: [
  12978. "CSS Logical Properties"
  12979. ],
  12980. initial: "currentcolor",
  12981. appliesto: "allElements",
  12982. computed: "computedColor",
  12983. order: "uniqueOrder",
  12984. status: "standard",
  12985. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-color"
  12986. },
  12987. "border-block-start-style": {
  12988. syntax: "<'border-top-style'>",
  12989. media: "visual",
  12990. inherited: false,
  12991. animationType: "discrete",
  12992. percentages: "no",
  12993. groups: [
  12994. "CSS Logical Properties"
  12995. ],
  12996. initial: "none",
  12997. appliesto: "allElements",
  12998. computed: "asSpecified",
  12999. order: "uniqueOrder",
  13000. status: "standard",
  13001. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-style"
  13002. },
  13003. "border-block-start-width": {
  13004. syntax: "<'border-top-width'>",
  13005. media: "visual",
  13006. inherited: false,
  13007. animationType: "discrete",
  13008. percentages: "logicalWidthOfContainingBlock",
  13009. groups: [
  13010. "CSS Logical Properties"
  13011. ],
  13012. initial: "medium",
  13013. appliesto: "allElements",
  13014. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13015. order: "uniqueOrder",
  13016. status: "standard",
  13017. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-width"
  13018. },
  13019. "border-bottom": {
  13020. syntax: "<line-width> || <line-style> || <color>",
  13021. media: "visual",
  13022. inherited: false,
  13023. animationType: [
  13024. "border-bottom-color",
  13025. "border-bottom-style",
  13026. "border-bottom-width"
  13027. ],
  13028. percentages: "no",
  13029. groups: [
  13030. "CSS Backgrounds and Borders"
  13031. ],
  13032. initial: [
  13033. "border-bottom-width",
  13034. "border-bottom-style",
  13035. "border-bottom-color"
  13036. ],
  13037. appliesto: "allElements",
  13038. computed: [
  13039. "border-bottom-width",
  13040. "border-bottom-style",
  13041. "border-bottom-color"
  13042. ],
  13043. order: "orderOfAppearance",
  13044. alsoAppliesTo: [
  13045. "::first-letter"
  13046. ],
  13047. status: "standard",
  13048. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom"
  13049. },
  13050. "border-bottom-color": {
  13051. syntax: "<'border-top-color'>",
  13052. media: "visual",
  13053. inherited: false,
  13054. animationType: "color",
  13055. percentages: "no",
  13056. groups: [
  13057. "CSS Backgrounds and Borders"
  13058. ],
  13059. initial: "currentcolor",
  13060. appliesto: "allElements",
  13061. computed: "computedColor",
  13062. order: "uniqueOrder",
  13063. alsoAppliesTo: [
  13064. "::first-letter"
  13065. ],
  13066. status: "standard",
  13067. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-color"
  13068. },
  13069. "border-bottom-left-radius": {
  13070. syntax: "<length-percentage>{1,2}",
  13071. media: "visual",
  13072. inherited: false,
  13073. animationType: "lpc",
  13074. percentages: "referToDimensionOfBorderBox",
  13075. groups: [
  13076. "CSS Backgrounds and Borders"
  13077. ],
  13078. initial: "0",
  13079. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13080. computed: "twoAbsoluteLengthOrPercentages",
  13081. order: "uniqueOrder",
  13082. alsoAppliesTo: [
  13083. "::first-letter"
  13084. ],
  13085. status: "standard",
  13086. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-left-radius"
  13087. },
  13088. "border-bottom-right-radius": {
  13089. syntax: "<length-percentage>{1,2}",
  13090. media: "visual",
  13091. inherited: false,
  13092. animationType: "lpc",
  13093. percentages: "referToDimensionOfBorderBox",
  13094. groups: [
  13095. "CSS Backgrounds and Borders"
  13096. ],
  13097. initial: "0",
  13098. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13099. computed: "twoAbsoluteLengthOrPercentages",
  13100. order: "uniqueOrder",
  13101. alsoAppliesTo: [
  13102. "::first-letter"
  13103. ],
  13104. status: "standard",
  13105. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-right-radius"
  13106. },
  13107. "border-bottom-style": {
  13108. syntax: "<line-style>",
  13109. media: "visual",
  13110. inherited: false,
  13111. animationType: "discrete",
  13112. percentages: "no",
  13113. groups: [
  13114. "CSS Backgrounds and Borders"
  13115. ],
  13116. initial: "none",
  13117. appliesto: "allElements",
  13118. computed: "asSpecified",
  13119. order: "uniqueOrder",
  13120. alsoAppliesTo: [
  13121. "::first-letter"
  13122. ],
  13123. status: "standard",
  13124. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-style"
  13125. },
  13126. "border-bottom-width": {
  13127. syntax: "<line-width>",
  13128. media: "visual",
  13129. inherited: false,
  13130. animationType: "length",
  13131. percentages: "no",
  13132. groups: [
  13133. "CSS Backgrounds and Borders"
  13134. ],
  13135. initial: "medium",
  13136. appliesto: "allElements",
  13137. computed: "absoluteLengthOr0IfBorderBottomStyleNoneOrHidden",
  13138. order: "uniqueOrder",
  13139. alsoAppliesTo: [
  13140. "::first-letter"
  13141. ],
  13142. status: "standard",
  13143. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-width"
  13144. },
  13145. "border-collapse": {
  13146. syntax: "collapse | separate",
  13147. media: "visual",
  13148. inherited: true,
  13149. animationType: "discrete",
  13150. percentages: "no",
  13151. groups: [
  13152. "CSS Table"
  13153. ],
  13154. initial: "separate",
  13155. appliesto: "tableElements",
  13156. computed: "asSpecified",
  13157. order: "uniqueOrder",
  13158. status: "standard",
  13159. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-collapse"
  13160. },
  13161. "border-color": {
  13162. syntax: "<color>{1,4}",
  13163. media: "visual",
  13164. inherited: false,
  13165. animationType: [
  13166. "border-bottom-color",
  13167. "border-left-color",
  13168. "border-right-color",
  13169. "border-top-color"
  13170. ],
  13171. percentages: "no",
  13172. groups: [
  13173. "CSS Backgrounds and Borders"
  13174. ],
  13175. initial: [
  13176. "border-top-color",
  13177. "border-right-color",
  13178. "border-bottom-color",
  13179. "border-left-color"
  13180. ],
  13181. appliesto: "allElements",
  13182. computed: [
  13183. "border-bottom-color",
  13184. "border-left-color",
  13185. "border-right-color",
  13186. "border-top-color"
  13187. ],
  13188. order: "uniqueOrder",
  13189. alsoAppliesTo: [
  13190. "::first-letter"
  13191. ],
  13192. status: "standard",
  13193. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-color"
  13194. },
  13195. "border-end-end-radius": {
  13196. syntax: "<length-percentage>{1,2}",
  13197. media: "visual",
  13198. inherited: false,
  13199. animationType: "lpc",
  13200. percentages: "referToDimensionOfBorderBox",
  13201. groups: [
  13202. "CSS Logical Properties"
  13203. ],
  13204. initial: "0",
  13205. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13206. computed: "twoAbsoluteLengthOrPercentages",
  13207. order: "uniqueOrder",
  13208. alsoAppliesTo: [
  13209. "::first-letter"
  13210. ],
  13211. status: "standard",
  13212. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-end-end-radius"
  13213. },
  13214. "border-end-start-radius": {
  13215. syntax: "<length-percentage>{1,2}",
  13216. media: "visual",
  13217. inherited: false,
  13218. animationType: "lpc",
  13219. percentages: "referToDimensionOfBorderBox",
  13220. groups: [
  13221. "CSS Logical Properties"
  13222. ],
  13223. initial: "0",
  13224. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13225. computed: "twoAbsoluteLengthOrPercentages",
  13226. order: "uniqueOrder",
  13227. alsoAppliesTo: [
  13228. "::first-letter"
  13229. ],
  13230. status: "standard",
  13231. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-end-start-radius"
  13232. },
  13233. "border-image": {
  13234. syntax: "<'border-image-source'> || <'border-image-slice'> [ / <'border-image-width'> | / <'border-image-width'>? / <'border-image-outset'> ]? || <'border-image-repeat'>",
  13235. media: "visual",
  13236. inherited: false,
  13237. animationType: "discrete",
  13238. percentages: [
  13239. "border-image-slice",
  13240. "border-image-width"
  13241. ],
  13242. groups: [
  13243. "CSS Backgrounds and Borders"
  13244. ],
  13245. initial: [
  13246. "border-image-source",
  13247. "border-image-slice",
  13248. "border-image-width",
  13249. "border-image-outset",
  13250. "border-image-repeat"
  13251. ],
  13252. appliesto: "allElementsExceptTableElementsWhenCollapse",
  13253. computed: [
  13254. "border-image-outset",
  13255. "border-image-repeat",
  13256. "border-image-slice",
  13257. "border-image-source",
  13258. "border-image-width"
  13259. ],
  13260. order: "uniqueOrder",
  13261. alsoAppliesTo: [
  13262. "::first-letter"
  13263. ],
  13264. status: "standard",
  13265. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image"
  13266. },
  13267. "border-image-outset": {
  13268. syntax: "[ <length> | <number> ]{1,4}",
  13269. media: "visual",
  13270. inherited: false,
  13271. animationType: "byComputedValueType",
  13272. percentages: "no",
  13273. groups: [
  13274. "CSS Backgrounds and Borders"
  13275. ],
  13276. initial: "0",
  13277. appliesto: "allElementsExceptTableElementsWhenCollapse",
  13278. computed: "asSpecifiedRelativeToAbsoluteLengths",
  13279. order: "uniqueOrder",
  13280. alsoAppliesTo: [
  13281. "::first-letter"
  13282. ],
  13283. status: "standard",
  13284. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-outset"
  13285. },
  13286. "border-image-repeat": {
  13287. syntax: "[ stretch | repeat | round | space ]{1,2}",
  13288. media: "visual",
  13289. inherited: false,
  13290. animationType: "discrete",
  13291. percentages: "no",
  13292. groups: [
  13293. "CSS Backgrounds and Borders"
  13294. ],
  13295. initial: "stretch",
  13296. appliesto: "allElementsExceptTableElementsWhenCollapse",
  13297. computed: "asSpecified",
  13298. order: "uniqueOrder",
  13299. alsoAppliesTo: [
  13300. "::first-letter"
  13301. ],
  13302. status: "standard",
  13303. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-repeat"
  13304. },
  13305. "border-image-slice": {
  13306. syntax: "<number-percentage>{1,4} && fill?",
  13307. media: "visual",
  13308. inherited: false,
  13309. animationType: "byComputedValueType",
  13310. percentages: "referToSizeOfBorderImage",
  13311. groups: [
  13312. "CSS Backgrounds and Borders"
  13313. ],
  13314. initial: "100%",
  13315. appliesto: "allElementsExceptTableElementsWhenCollapse",
  13316. computed: "oneToFourPercentagesOrAbsoluteLengthsPlusFill",
  13317. order: "percentagesOrLengthsFollowedByFill",
  13318. alsoAppliesTo: [
  13319. "::first-letter"
  13320. ],
  13321. status: "standard",
  13322. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-slice"
  13323. },
  13324. "border-image-source": {
  13325. syntax: "none | <image>",
  13326. media: "visual",
  13327. inherited: false,
  13328. animationType: "discrete",
  13329. percentages: "no",
  13330. groups: [
  13331. "CSS Backgrounds and Borders"
  13332. ],
  13333. initial: "none",
  13334. appliesto: "allElementsExceptTableElementsWhenCollapse",
  13335. computed: "noneOrImageWithAbsoluteURI",
  13336. order: "uniqueOrder",
  13337. alsoAppliesTo: [
  13338. "::first-letter"
  13339. ],
  13340. status: "standard",
  13341. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-source"
  13342. },
  13343. "border-image-width": {
  13344. syntax: "[ <length-percentage> | <number> | auto ]{1,4}",
  13345. media: "visual",
  13346. inherited: false,
  13347. animationType: "byComputedValueType",
  13348. percentages: "referToWidthOrHeightOfBorderImageArea",
  13349. groups: [
  13350. "CSS Backgrounds and Borders"
  13351. ],
  13352. initial: "1",
  13353. appliesto: "allElementsExceptTableElementsWhenCollapse",
  13354. computed: "asSpecifiedRelativeToAbsoluteLengths",
  13355. order: "uniqueOrder",
  13356. alsoAppliesTo: [
  13357. "::first-letter"
  13358. ],
  13359. status: "standard",
  13360. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-width"
  13361. },
  13362. "border-inline": {
  13363. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13364. media: "visual",
  13365. inherited: false,
  13366. animationType: "discrete",
  13367. percentages: "no",
  13368. groups: [
  13369. "CSS Logical Properties"
  13370. ],
  13371. initial: [
  13372. "border-top-width",
  13373. "border-top-style",
  13374. "border-top-color"
  13375. ],
  13376. appliesto: "allElements",
  13377. computed: [
  13378. "border-top-width",
  13379. "border-top-style",
  13380. "border-top-color"
  13381. ],
  13382. order: "uniqueOrder",
  13383. status: "standard",
  13384. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline"
  13385. },
  13386. "border-inline-end": {
  13387. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13388. media: "visual",
  13389. inherited: false,
  13390. animationType: "discrete",
  13391. percentages: "no",
  13392. groups: [
  13393. "CSS Logical Properties"
  13394. ],
  13395. initial: [
  13396. "border-width",
  13397. "border-style",
  13398. "color"
  13399. ],
  13400. appliesto: "allElements",
  13401. computed: [
  13402. "border-width",
  13403. "border-style",
  13404. "border-inline-end-color"
  13405. ],
  13406. order: "uniqueOrder",
  13407. status: "standard",
  13408. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end"
  13409. },
  13410. "border-inline-color": {
  13411. syntax: "<'border-top-color'>{1,2}",
  13412. media: "visual",
  13413. inherited: false,
  13414. animationType: "discrete",
  13415. percentages: "no",
  13416. groups: [
  13417. "CSS Logical Properties"
  13418. ],
  13419. initial: "currentcolor",
  13420. appliesto: "allElements",
  13421. computed: "computedColor",
  13422. order: "uniqueOrder",
  13423. status: "standard",
  13424. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-color"
  13425. },
  13426. "border-inline-style": {
  13427. syntax: "<'border-top-style'>",
  13428. media: "visual",
  13429. inherited: false,
  13430. animationType: "discrete",
  13431. percentages: "no",
  13432. groups: [
  13433. "CSS Logical Properties"
  13434. ],
  13435. initial: "none",
  13436. appliesto: "allElements",
  13437. computed: "asSpecified",
  13438. order: "uniqueOrder",
  13439. status: "standard",
  13440. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-style"
  13441. },
  13442. "border-inline-width": {
  13443. syntax: "<'border-top-width'>",
  13444. media: "visual",
  13445. inherited: false,
  13446. animationType: "discrete",
  13447. percentages: "logicalWidthOfContainingBlock",
  13448. groups: [
  13449. "CSS Logical Properties"
  13450. ],
  13451. initial: "medium",
  13452. appliesto: "allElements",
  13453. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13454. order: "uniqueOrder",
  13455. status: "standard",
  13456. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-width"
  13457. },
  13458. "border-inline-end-color": {
  13459. syntax: "<'border-top-color'>",
  13460. media: "visual",
  13461. inherited: false,
  13462. animationType: "discrete",
  13463. percentages: "no",
  13464. groups: [
  13465. "CSS Logical Properties"
  13466. ],
  13467. initial: "currentcolor",
  13468. appliesto: "allElements",
  13469. computed: "computedColor",
  13470. order: "uniqueOrder",
  13471. status: "standard",
  13472. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-color"
  13473. },
  13474. "border-inline-end-style": {
  13475. syntax: "<'border-top-style'>",
  13476. media: "visual",
  13477. inherited: false,
  13478. animationType: "discrete",
  13479. percentages: "no",
  13480. groups: [
  13481. "CSS Logical Properties"
  13482. ],
  13483. initial: "none",
  13484. appliesto: "allElements",
  13485. computed: "asSpecified",
  13486. order: "uniqueOrder",
  13487. status: "standard",
  13488. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-style"
  13489. },
  13490. "border-inline-end-width": {
  13491. syntax: "<'border-top-width'>",
  13492. media: "visual",
  13493. inherited: false,
  13494. animationType: "discrete",
  13495. percentages: "logicalWidthOfContainingBlock",
  13496. groups: [
  13497. "CSS Logical Properties"
  13498. ],
  13499. initial: "medium",
  13500. appliesto: "allElements",
  13501. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13502. order: "uniqueOrder",
  13503. status: "standard",
  13504. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-width"
  13505. },
  13506. "border-inline-start": {
  13507. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13508. media: "visual",
  13509. inherited: false,
  13510. animationType: "discrete",
  13511. percentages: "no",
  13512. groups: [
  13513. "CSS Logical Properties"
  13514. ],
  13515. initial: [
  13516. "border-width",
  13517. "border-style",
  13518. "color"
  13519. ],
  13520. appliesto: "allElements",
  13521. computed: [
  13522. "border-width",
  13523. "border-style",
  13524. "border-inline-start-color"
  13525. ],
  13526. order: "uniqueOrder",
  13527. status: "standard",
  13528. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start"
  13529. },
  13530. "border-inline-start-color": {
  13531. syntax: "<'border-top-color'>",
  13532. media: "visual",
  13533. inherited: false,
  13534. animationType: "discrete",
  13535. percentages: "no",
  13536. groups: [
  13537. "CSS Logical Properties"
  13538. ],
  13539. initial: "currentcolor",
  13540. appliesto: "allElements",
  13541. computed: "computedColor",
  13542. order: "uniqueOrder",
  13543. status: "standard",
  13544. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-color"
  13545. },
  13546. "border-inline-start-style": {
  13547. syntax: "<'border-top-style'>",
  13548. media: "visual",
  13549. inherited: false,
  13550. animationType: "discrete",
  13551. percentages: "no",
  13552. groups: [
  13553. "CSS Logical Properties"
  13554. ],
  13555. initial: "none",
  13556. appliesto: "allElements",
  13557. computed: "asSpecified",
  13558. order: "uniqueOrder",
  13559. status: "standard",
  13560. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-style"
  13561. },
  13562. "border-inline-start-width": {
  13563. syntax: "<'border-top-width'>",
  13564. media: "visual",
  13565. inherited: false,
  13566. animationType: "discrete",
  13567. percentages: "logicalWidthOfContainingBlock",
  13568. groups: [
  13569. "CSS Logical Properties"
  13570. ],
  13571. initial: "medium",
  13572. appliesto: "allElements",
  13573. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13574. order: "uniqueOrder",
  13575. status: "standard",
  13576. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-width"
  13577. },
  13578. "border-left": {
  13579. syntax: "<line-width> || <line-style> || <color>",
  13580. media: "visual",
  13581. inherited: false,
  13582. animationType: [
  13583. "border-left-color",
  13584. "border-left-style",
  13585. "border-left-width"
  13586. ],
  13587. percentages: "no",
  13588. groups: [
  13589. "CSS Backgrounds and Borders"
  13590. ],
  13591. initial: [
  13592. "border-left-width",
  13593. "border-left-style",
  13594. "border-left-color"
  13595. ],
  13596. appliesto: "allElements",
  13597. computed: [
  13598. "border-left-width",
  13599. "border-left-style",
  13600. "border-left-color"
  13601. ],
  13602. order: "orderOfAppearance",
  13603. alsoAppliesTo: [
  13604. "::first-letter"
  13605. ],
  13606. status: "standard",
  13607. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left"
  13608. },
  13609. "border-left-color": {
  13610. syntax: "<color>",
  13611. media: "visual",
  13612. inherited: false,
  13613. animationType: "color",
  13614. percentages: "no",
  13615. groups: [
  13616. "CSS Backgrounds and Borders"
  13617. ],
  13618. initial: "currentcolor",
  13619. appliesto: "allElements",
  13620. computed: "computedColor",
  13621. order: "uniqueOrder",
  13622. alsoAppliesTo: [
  13623. "::first-letter"
  13624. ],
  13625. status: "standard",
  13626. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-color"
  13627. },
  13628. "border-left-style": {
  13629. syntax: "<line-style>",
  13630. media: "visual",
  13631. inherited: false,
  13632. animationType: "discrete",
  13633. percentages: "no",
  13634. groups: [
  13635. "CSS Backgrounds and Borders"
  13636. ],
  13637. initial: "none",
  13638. appliesto: "allElements",
  13639. computed: "asSpecified",
  13640. order: "uniqueOrder",
  13641. alsoAppliesTo: [
  13642. "::first-letter"
  13643. ],
  13644. status: "standard",
  13645. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-style"
  13646. },
  13647. "border-left-width": {
  13648. syntax: "<line-width>",
  13649. media: "visual",
  13650. inherited: false,
  13651. animationType: "length",
  13652. percentages: "no",
  13653. groups: [
  13654. "CSS Backgrounds and Borders"
  13655. ],
  13656. initial: "medium",
  13657. appliesto: "allElements",
  13658. computed: "absoluteLengthOr0IfBorderLeftStyleNoneOrHidden",
  13659. order: "uniqueOrder",
  13660. alsoAppliesTo: [
  13661. "::first-letter"
  13662. ],
  13663. status: "standard",
  13664. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-width"
  13665. },
  13666. "border-radius": {
  13667. syntax: "<length-percentage>{1,4} [ / <length-percentage>{1,4} ]?",
  13668. media: "visual",
  13669. inherited: false,
  13670. animationType: [
  13671. "border-top-left-radius",
  13672. "border-top-right-radius",
  13673. "border-bottom-right-radius",
  13674. "border-bottom-left-radius"
  13675. ],
  13676. percentages: "referToDimensionOfBorderBox",
  13677. groups: [
  13678. "CSS Backgrounds and Borders"
  13679. ],
  13680. initial: [
  13681. "border-top-left-radius",
  13682. "border-top-right-radius",
  13683. "border-bottom-right-radius",
  13684. "border-bottom-left-radius"
  13685. ],
  13686. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13687. computed: [
  13688. "border-bottom-left-radius",
  13689. "border-bottom-right-radius",
  13690. "border-top-left-radius",
  13691. "border-top-right-radius"
  13692. ],
  13693. order: "uniqueOrder",
  13694. alsoAppliesTo: [
  13695. "::first-letter"
  13696. ],
  13697. status: "standard",
  13698. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-radius"
  13699. },
  13700. "border-right": {
  13701. syntax: "<line-width> || <line-style> || <color>",
  13702. media: "visual",
  13703. inherited: false,
  13704. animationType: [
  13705. "border-right-color",
  13706. "border-right-style",
  13707. "border-right-width"
  13708. ],
  13709. percentages: "no",
  13710. groups: [
  13711. "CSS Backgrounds and Borders"
  13712. ],
  13713. initial: [
  13714. "border-right-width",
  13715. "border-right-style",
  13716. "border-right-color"
  13717. ],
  13718. appliesto: "allElements",
  13719. computed: [
  13720. "border-right-width",
  13721. "border-right-style",
  13722. "border-right-color"
  13723. ],
  13724. order: "orderOfAppearance",
  13725. alsoAppliesTo: [
  13726. "::first-letter"
  13727. ],
  13728. status: "standard",
  13729. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right"
  13730. },
  13731. "border-right-color": {
  13732. syntax: "<color>",
  13733. media: "visual",
  13734. inherited: false,
  13735. animationType: "color",
  13736. percentages: "no",
  13737. groups: [
  13738. "CSS Backgrounds and Borders"
  13739. ],
  13740. initial: "currentcolor",
  13741. appliesto: "allElements",
  13742. computed: "computedColor",
  13743. order: "uniqueOrder",
  13744. alsoAppliesTo: [
  13745. "::first-letter"
  13746. ],
  13747. status: "standard",
  13748. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-color"
  13749. },
  13750. "border-right-style": {
  13751. syntax: "<line-style>",
  13752. media: "visual",
  13753. inherited: false,
  13754. animationType: "discrete",
  13755. percentages: "no",
  13756. groups: [
  13757. "CSS Backgrounds and Borders"
  13758. ],
  13759. initial: "none",
  13760. appliesto: "allElements",
  13761. computed: "asSpecified",
  13762. order: "uniqueOrder",
  13763. alsoAppliesTo: [
  13764. "::first-letter"
  13765. ],
  13766. status: "standard",
  13767. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-style"
  13768. },
  13769. "border-right-width": {
  13770. syntax: "<line-width>",
  13771. media: "visual",
  13772. inherited: false,
  13773. animationType: "length",
  13774. percentages: "no",
  13775. groups: [
  13776. "CSS Backgrounds and Borders"
  13777. ],
  13778. initial: "medium",
  13779. appliesto: "allElements",
  13780. computed: "absoluteLengthOr0IfBorderRightStyleNoneOrHidden",
  13781. order: "uniqueOrder",
  13782. alsoAppliesTo: [
  13783. "::first-letter"
  13784. ],
  13785. status: "standard",
  13786. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-width"
  13787. },
  13788. "border-spacing": {
  13789. syntax: "<length> <length>?",
  13790. media: "visual",
  13791. inherited: true,
  13792. animationType: "discrete",
  13793. percentages: "no",
  13794. groups: [
  13795. "CSS Table"
  13796. ],
  13797. initial: "0",
  13798. appliesto: "tableElements",
  13799. computed: "twoAbsoluteLengths",
  13800. order: "uniqueOrder",
  13801. status: "standard",
  13802. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-spacing"
  13803. },
  13804. "border-start-end-radius": {
  13805. syntax: "<length-percentage>{1,2}",
  13806. media: "visual",
  13807. inherited: false,
  13808. animationType: "lpc",
  13809. percentages: "referToDimensionOfBorderBox",
  13810. groups: [
  13811. "CSS Logical Properties"
  13812. ],
  13813. initial: "0",
  13814. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13815. computed: "twoAbsoluteLengthOrPercentages",
  13816. order: "uniqueOrder",
  13817. alsoAppliesTo: [
  13818. "::first-letter"
  13819. ],
  13820. status: "standard",
  13821. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-start-end-radius"
  13822. },
  13823. "border-start-start-radius": {
  13824. syntax: "<length-percentage>{1,2}",
  13825. media: "visual",
  13826. inherited: false,
  13827. animationType: "lpc",
  13828. percentages: "referToDimensionOfBorderBox",
  13829. groups: [
  13830. "CSS Logical Properties"
  13831. ],
  13832. initial: "0",
  13833. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13834. computed: "twoAbsoluteLengthOrPercentages",
  13835. order: "uniqueOrder",
  13836. alsoAppliesTo: [
  13837. "::first-letter"
  13838. ],
  13839. status: "standard",
  13840. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-start-start-radius"
  13841. },
  13842. "border-style": {
  13843. syntax: "<line-style>{1,4}",
  13844. media: "visual",
  13845. inherited: false,
  13846. animationType: "discrete",
  13847. percentages: "no",
  13848. groups: [
  13849. "CSS Backgrounds and Borders"
  13850. ],
  13851. initial: [
  13852. "border-top-style",
  13853. "border-right-style",
  13854. "border-bottom-style",
  13855. "border-left-style"
  13856. ],
  13857. appliesto: "allElements",
  13858. computed: [
  13859. "border-bottom-style",
  13860. "border-left-style",
  13861. "border-right-style",
  13862. "border-top-style"
  13863. ],
  13864. order: "uniqueOrder",
  13865. alsoAppliesTo: [
  13866. "::first-letter"
  13867. ],
  13868. status: "standard",
  13869. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-style"
  13870. },
  13871. "border-top": {
  13872. syntax: "<line-width> || <line-style> || <color>",
  13873. media: "visual",
  13874. inherited: false,
  13875. animationType: [
  13876. "border-top-color",
  13877. "border-top-style",
  13878. "border-top-width"
  13879. ],
  13880. percentages: "no",
  13881. groups: [
  13882. "CSS Backgrounds and Borders"
  13883. ],
  13884. initial: [
  13885. "border-top-width",
  13886. "border-top-style",
  13887. "border-top-color"
  13888. ],
  13889. appliesto: "allElements",
  13890. computed: [
  13891. "border-top-width",
  13892. "border-top-style",
  13893. "border-top-color"
  13894. ],
  13895. order: "orderOfAppearance",
  13896. alsoAppliesTo: [
  13897. "::first-letter"
  13898. ],
  13899. status: "standard",
  13900. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top"
  13901. },
  13902. "border-top-color": {
  13903. syntax: "<color>",
  13904. media: "visual",
  13905. inherited: false,
  13906. animationType: "color",
  13907. percentages: "no",
  13908. groups: [
  13909. "CSS Backgrounds and Borders"
  13910. ],
  13911. initial: "currentcolor",
  13912. appliesto: "allElements",
  13913. computed: "computedColor",
  13914. order: "uniqueOrder",
  13915. alsoAppliesTo: [
  13916. "::first-letter"
  13917. ],
  13918. status: "standard",
  13919. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-color"
  13920. },
  13921. "border-top-left-radius": {
  13922. syntax: "<length-percentage>{1,2}",
  13923. media: "visual",
  13924. inherited: false,
  13925. animationType: "lpc",
  13926. percentages: "referToDimensionOfBorderBox",
  13927. groups: [
  13928. "CSS Backgrounds and Borders"
  13929. ],
  13930. initial: "0",
  13931. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13932. computed: "twoAbsoluteLengthOrPercentages",
  13933. order: "uniqueOrder",
  13934. alsoAppliesTo: [
  13935. "::first-letter"
  13936. ],
  13937. status: "standard",
  13938. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-left-radius"
  13939. },
  13940. "border-top-right-radius": {
  13941. syntax: "<length-percentage>{1,2}",
  13942. media: "visual",
  13943. inherited: false,
  13944. animationType: "lpc",
  13945. percentages: "referToDimensionOfBorderBox",
  13946. groups: [
  13947. "CSS Backgrounds and Borders"
  13948. ],
  13949. initial: "0",
  13950. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13951. computed: "twoAbsoluteLengthOrPercentages",
  13952. order: "uniqueOrder",
  13953. alsoAppliesTo: [
  13954. "::first-letter"
  13955. ],
  13956. status: "standard",
  13957. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-right-radius"
  13958. },
  13959. "border-top-style": {
  13960. syntax: "<line-style>",
  13961. media: "visual",
  13962. inherited: false,
  13963. animationType: "discrete",
  13964. percentages: "no",
  13965. groups: [
  13966. "CSS Backgrounds and Borders"
  13967. ],
  13968. initial: "none",
  13969. appliesto: "allElements",
  13970. computed: "asSpecified",
  13971. order: "uniqueOrder",
  13972. alsoAppliesTo: [
  13973. "::first-letter"
  13974. ],
  13975. status: "standard",
  13976. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-style"
  13977. },
  13978. "border-top-width": {
  13979. syntax: "<line-width>",
  13980. media: "visual",
  13981. inherited: false,
  13982. animationType: "length",
  13983. percentages: "no",
  13984. groups: [
  13985. "CSS Backgrounds and Borders"
  13986. ],
  13987. initial: "medium",
  13988. appliesto: "allElements",
  13989. computed: "absoluteLengthOr0IfBorderTopStyleNoneOrHidden",
  13990. order: "uniqueOrder",
  13991. alsoAppliesTo: [
  13992. "::first-letter"
  13993. ],
  13994. status: "standard",
  13995. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-width"
  13996. },
  13997. "border-width": {
  13998. syntax: "<line-width>{1,4}",
  13999. media: "visual",
  14000. inherited: false,
  14001. animationType: [
  14002. "border-bottom-width",
  14003. "border-left-width",
  14004. "border-right-width",
  14005. "border-top-width"
  14006. ],
  14007. percentages: "no",
  14008. groups: [
  14009. "CSS Backgrounds and Borders"
  14010. ],
  14011. initial: [
  14012. "border-top-width",
  14013. "border-right-width",
  14014. "border-bottom-width",
  14015. "border-left-width"
  14016. ],
  14017. appliesto: "allElements",
  14018. computed: [
  14019. "border-bottom-width",
  14020. "border-left-width",
  14021. "border-right-width",
  14022. "border-top-width"
  14023. ],
  14024. order: "uniqueOrder",
  14025. alsoAppliesTo: [
  14026. "::first-letter"
  14027. ],
  14028. status: "standard",
  14029. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-width"
  14030. },
  14031. bottom: bottom,
  14032. "box-align": {
  14033. syntax: "start | center | end | baseline | stretch",
  14034. media: "visual",
  14035. inherited: false,
  14036. animationType: "discrete",
  14037. percentages: "no",
  14038. groups: [
  14039. "Mozilla Extensions",
  14040. "WebKit Extensions"
  14041. ],
  14042. initial: "stretch",
  14043. appliesto: "elementsWithDisplayBoxOrInlineBox",
  14044. computed: "asSpecified",
  14045. order: "uniqueOrder",
  14046. status: "nonstandard",
  14047. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-align"
  14048. },
  14049. "box-decoration-break": {
  14050. syntax: "slice | clone",
  14051. media: "visual",
  14052. inherited: false,
  14053. animationType: "discrete",
  14054. percentages: "no",
  14055. groups: [
  14056. "CSS Fragmentation"
  14057. ],
  14058. initial: "slice",
  14059. appliesto: "allElements",
  14060. computed: "asSpecified",
  14061. order: "uniqueOrder",
  14062. status: "standard",
  14063. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-decoration-break"
  14064. },
  14065. "box-direction": {
  14066. syntax: "normal | reverse | inherit",
  14067. media: "visual",
  14068. inherited: false,
  14069. animationType: "discrete",
  14070. percentages: "no",
  14071. groups: [
  14072. "Mozilla Extensions",
  14073. "WebKit Extensions"
  14074. ],
  14075. initial: "normal",
  14076. appliesto: "elementsWithDisplayBoxOrInlineBox",
  14077. computed: "asSpecified",
  14078. order: "uniqueOrder",
  14079. status: "nonstandard",
  14080. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-direction"
  14081. },
  14082. "box-flex": {
  14083. syntax: "<number>",
  14084. media: "visual",
  14085. inherited: false,
  14086. animationType: "discrete",
  14087. percentages: "no",
  14088. groups: [
  14089. "Mozilla Extensions",
  14090. "WebKit Extensions"
  14091. ],
  14092. initial: "0",
  14093. appliesto: "directChildrenOfElementsWithDisplayMozBoxMozInlineBox",
  14094. computed: "asSpecified",
  14095. order: "uniqueOrder",
  14096. status: "nonstandard",
  14097. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-flex"
  14098. },
  14099. "box-flex-group": {
  14100. syntax: "<integer>",
  14101. media: "visual",
  14102. inherited: false,
  14103. animationType: "discrete",
  14104. percentages: "no",
  14105. groups: [
  14106. "Mozilla Extensions",
  14107. "WebKit Extensions"
  14108. ],
  14109. initial: "1",
  14110. appliesto: "inFlowChildrenOfBoxElements",
  14111. computed: "asSpecified",
  14112. order: "uniqueOrder",
  14113. status: "nonstandard",
  14114. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-flex-group"
  14115. },
  14116. "box-lines": {
  14117. syntax: "single | multiple",
  14118. media: "visual",
  14119. inherited: false,
  14120. animationType: "discrete",
  14121. percentages: "no",
  14122. groups: [
  14123. "Mozilla Extensions",
  14124. "WebKit Extensions"
  14125. ],
  14126. initial: "single",
  14127. appliesto: "boxElements",
  14128. computed: "asSpecified",
  14129. order: "uniqueOrder",
  14130. status: "nonstandard",
  14131. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-lines"
  14132. },
  14133. "box-ordinal-group": {
  14134. syntax: "<integer>",
  14135. media: "visual",
  14136. inherited: false,
  14137. animationType: "discrete",
  14138. percentages: "no",
  14139. groups: [
  14140. "Mozilla Extensions",
  14141. "WebKit Extensions"
  14142. ],
  14143. initial: "1",
  14144. appliesto: "childrenOfBoxElements",
  14145. computed: "asSpecified",
  14146. order: "uniqueOrder",
  14147. status: "nonstandard",
  14148. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-ordinal-group"
  14149. },
  14150. "box-orient": {
  14151. syntax: "horizontal | vertical | inline-axis | block-axis | inherit",
  14152. media: "visual",
  14153. inherited: false,
  14154. animationType: "discrete",
  14155. percentages: "no",
  14156. groups: [
  14157. "Mozilla Extensions",
  14158. "WebKit Extensions"
  14159. ],
  14160. initial: "inlineAxisHorizontalInXUL",
  14161. appliesto: "elementsWithDisplayBoxOrInlineBox",
  14162. computed: "asSpecified",
  14163. order: "uniqueOrder",
  14164. status: "nonstandard",
  14165. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-orient"
  14166. },
  14167. "box-pack": {
  14168. syntax: "start | center | end | justify",
  14169. media: "visual",
  14170. inherited: false,
  14171. animationType: "discrete",
  14172. percentages: "no",
  14173. groups: [
  14174. "Mozilla Extensions",
  14175. "WebKit Extensions"
  14176. ],
  14177. initial: "start",
  14178. appliesto: "elementsWithDisplayMozBoxMozInlineBox",
  14179. computed: "asSpecified",
  14180. order: "uniqueOrder",
  14181. status: "nonstandard",
  14182. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-pack"
  14183. },
  14184. "box-shadow": {
  14185. syntax: "none | <shadow>#",
  14186. media: "visual",
  14187. inherited: false,
  14188. animationType: "shadowList",
  14189. percentages: "no",
  14190. groups: [
  14191. "CSS Backgrounds and Borders"
  14192. ],
  14193. initial: "none",
  14194. appliesto: "allElements",
  14195. computed: "absoluteLengthsSpecifiedColorAsSpecified",
  14196. order: "uniqueOrder",
  14197. alsoAppliesTo: [
  14198. "::first-letter"
  14199. ],
  14200. status: "standard",
  14201. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-shadow"
  14202. },
  14203. "box-sizing": {
  14204. syntax: "content-box | border-box",
  14205. media: "visual",
  14206. inherited: false,
  14207. animationType: "discrete",
  14208. percentages: "no",
  14209. groups: [
  14210. "CSS Basic User Interface"
  14211. ],
  14212. initial: "content-box",
  14213. appliesto: "allElementsAcceptingWidthOrHeight",
  14214. computed: "asSpecified",
  14215. order: "uniqueOrder",
  14216. status: "standard",
  14217. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-sizing"
  14218. },
  14219. "break-after": {
  14220. syntax: "auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region",
  14221. media: "visual",
  14222. inherited: false,
  14223. animationType: "discrete",
  14224. percentages: "no",
  14225. groups: [
  14226. "CSS Fragmentation"
  14227. ],
  14228. initial: "auto",
  14229. appliesto: "blockLevelElements",
  14230. computed: "asSpecified",
  14231. order: "uniqueOrder",
  14232. status: "standard",
  14233. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-after"
  14234. },
  14235. "break-before": {
  14236. syntax: "auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region",
  14237. media: "visual",
  14238. inherited: false,
  14239. animationType: "discrete",
  14240. percentages: "no",
  14241. groups: [
  14242. "CSS Fragmentation"
  14243. ],
  14244. initial: "auto",
  14245. appliesto: "blockLevelElements",
  14246. computed: "asSpecified",
  14247. order: "uniqueOrder",
  14248. status: "standard",
  14249. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-before"
  14250. },
  14251. "break-inside": {
  14252. syntax: "auto | avoid | avoid-page | avoid-column | avoid-region",
  14253. media: "visual",
  14254. inherited: false,
  14255. animationType: "discrete",
  14256. percentages: "no",
  14257. groups: [
  14258. "CSS Fragmentation"
  14259. ],
  14260. initial: "auto",
  14261. appliesto: "blockLevelElements",
  14262. computed: "asSpecified",
  14263. order: "uniqueOrder",
  14264. status: "standard",
  14265. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-inside"
  14266. },
  14267. "caption-side": {
  14268. syntax: "top | bottom | block-start | block-end | inline-start | inline-end",
  14269. media: "visual",
  14270. inherited: true,
  14271. animationType: "discrete",
  14272. percentages: "no",
  14273. groups: [
  14274. "CSS Table"
  14275. ],
  14276. initial: "top",
  14277. appliesto: "tableCaptionElements",
  14278. computed: "asSpecified",
  14279. order: "uniqueOrder",
  14280. status: "standard",
  14281. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/caption-side"
  14282. },
  14283. "caret-color": {
  14284. syntax: "auto | <color>",
  14285. media: "interactive",
  14286. inherited: true,
  14287. animationType: "color",
  14288. percentages: "no",
  14289. groups: [
  14290. "CSS Basic User Interface"
  14291. ],
  14292. initial: "auto",
  14293. appliesto: "allElements",
  14294. computed: "asAutoOrColor",
  14295. order: "perGrammar",
  14296. status: "standard",
  14297. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/caret-color"
  14298. },
  14299. clear: clear,
  14300. clip: clip,
  14301. "clip-path": {
  14302. syntax: "<clip-source> | [ <basic-shape> || <geometry-box> ] | none",
  14303. media: "visual",
  14304. inherited: false,
  14305. animationType: "basicShapeOtherwiseNo",
  14306. percentages: "referToReferenceBoxWhenSpecifiedOtherwiseBorderBox",
  14307. groups: [
  14308. "CSS Masking"
  14309. ],
  14310. initial: "none",
  14311. appliesto: "allElementsSVGContainerElements",
  14312. computed: "asSpecifiedURLsAbsolute",
  14313. order: "uniqueOrder",
  14314. status: "standard",
  14315. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clip-path"
  14316. },
  14317. color: color,
  14318. "color-adjust": {
  14319. syntax: "economy | exact",
  14320. media: "visual",
  14321. inherited: true,
  14322. animationType: "discrete",
  14323. percentages: "no",
  14324. groups: [
  14325. "CSS Color"
  14326. ],
  14327. initial: "economy",
  14328. appliesto: "allElements",
  14329. computed: "asSpecified",
  14330. order: "perGrammar",
  14331. status: "standard",
  14332. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/color-adjust"
  14333. },
  14334. "column-count": {
  14335. syntax: "<integer> | auto",
  14336. media: "visual",
  14337. inherited: false,
  14338. animationType: "integer",
  14339. percentages: "no",
  14340. groups: [
  14341. "CSS Columns"
  14342. ],
  14343. initial: "auto",
  14344. appliesto: "blockContainersExceptTableWrappers",
  14345. computed: "asSpecified",
  14346. order: "perGrammar",
  14347. status: "standard",
  14348. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-count"
  14349. },
  14350. "column-fill": {
  14351. syntax: "auto | balance | balance-all",
  14352. media: "visualInContinuousMediaNoEffectInOverflowColumns",
  14353. inherited: false,
  14354. animationType: "discrete",
  14355. percentages: "no",
  14356. groups: [
  14357. "CSS Columns"
  14358. ],
  14359. initial: "balance",
  14360. appliesto: "multicolElements",
  14361. computed: "asSpecified",
  14362. order: "perGrammar",
  14363. status: "standard",
  14364. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-fill"
  14365. },
  14366. "column-gap": {
  14367. syntax: "normal | <length-percentage>",
  14368. media: "visual",
  14369. inherited: false,
  14370. animationType: "lpc",
  14371. percentages: "referToDimensionOfContentArea",
  14372. groups: [
  14373. "CSS Box Alignment"
  14374. ],
  14375. initial: "normal",
  14376. appliesto: "multiColumnElementsFlexContainersGridContainers",
  14377. computed: "asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
  14378. order: "perGrammar",
  14379. status: "standard",
  14380. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-gap"
  14381. },
  14382. "column-rule": {
  14383. syntax: "<'column-rule-width'> || <'column-rule-style'> || <'column-rule-color'>",
  14384. media: "visual",
  14385. inherited: false,
  14386. animationType: [
  14387. "column-rule-color",
  14388. "column-rule-style",
  14389. "column-rule-width"
  14390. ],
  14391. percentages: "no",
  14392. groups: [
  14393. "CSS Columns"
  14394. ],
  14395. initial: [
  14396. "column-rule-width",
  14397. "column-rule-style",
  14398. "column-rule-color"
  14399. ],
  14400. appliesto: "multicolElements",
  14401. computed: [
  14402. "column-rule-color",
  14403. "column-rule-style",
  14404. "column-rule-width"
  14405. ],
  14406. order: "perGrammar",
  14407. status: "standard",
  14408. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule"
  14409. },
  14410. "column-rule-color": {
  14411. syntax: "<color>",
  14412. media: "visual",
  14413. inherited: false,
  14414. animationType: "color",
  14415. percentages: "no",
  14416. groups: [
  14417. "CSS Columns"
  14418. ],
  14419. initial: "currentcolor",
  14420. appliesto: "multicolElements",
  14421. computed: "computedColor",
  14422. order: "perGrammar",
  14423. status: "standard",
  14424. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-color"
  14425. },
  14426. "column-rule-style": {
  14427. syntax: "<'border-style'>",
  14428. media: "visual",
  14429. inherited: false,
  14430. animationType: "discrete",
  14431. percentages: "no",
  14432. groups: [
  14433. "CSS Columns"
  14434. ],
  14435. initial: "none",
  14436. appliesto: "multicolElements",
  14437. computed: "asSpecified",
  14438. order: "perGrammar",
  14439. status: "standard",
  14440. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-style"
  14441. },
  14442. "column-rule-width": {
  14443. syntax: "<'border-width'>",
  14444. media: "visual",
  14445. inherited: false,
  14446. animationType: "length",
  14447. percentages: "no",
  14448. groups: [
  14449. "CSS Columns"
  14450. ],
  14451. initial: "medium",
  14452. appliesto: "multicolElements",
  14453. computed: "absoluteLength0IfColumnRuleStyleNoneOrHidden",
  14454. order: "perGrammar",
  14455. status: "standard",
  14456. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-width"
  14457. },
  14458. "column-span": {
  14459. syntax: "none | all",
  14460. media: "visual",
  14461. inherited: false,
  14462. animationType: "discrete",
  14463. percentages: "no",
  14464. groups: [
  14465. "CSS Columns"
  14466. ],
  14467. initial: "none",
  14468. appliesto: "inFlowBlockLevelElements",
  14469. computed: "asSpecified",
  14470. order: "perGrammar",
  14471. status: "standard",
  14472. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-span"
  14473. },
  14474. "column-width": {
  14475. syntax: "<length> | auto",
  14476. media: "visual",
  14477. inherited: false,
  14478. animationType: "length",
  14479. percentages: "no",
  14480. groups: [
  14481. "CSS Columns"
  14482. ],
  14483. initial: "auto",
  14484. appliesto: "blockContainersExceptTableWrappers",
  14485. computed: "absoluteLengthZeroOrLarger",
  14486. order: "perGrammar",
  14487. status: "standard",
  14488. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-width"
  14489. },
  14490. columns: columns,
  14491. contain: contain,
  14492. content: content,
  14493. "counter-increment": {
  14494. syntax: "[ <custom-ident> <integer>? ]+ | none",
  14495. media: "all",
  14496. inherited: false,
  14497. animationType: "discrete",
  14498. percentages: "no",
  14499. groups: [
  14500. "CSS Counter Styles"
  14501. ],
  14502. initial: "none",
  14503. appliesto: "allElements",
  14504. computed: "asSpecified",
  14505. order: "uniqueOrder",
  14506. status: "standard",
  14507. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-increment"
  14508. },
  14509. "counter-reset": {
  14510. syntax: "[ <custom-ident> <integer>? ]+ | none",
  14511. media: "all",
  14512. inherited: false,
  14513. animationType: "discrete",
  14514. percentages: "no",
  14515. groups: [
  14516. "CSS Counter Styles"
  14517. ],
  14518. initial: "none",
  14519. appliesto: "allElements",
  14520. computed: "asSpecified",
  14521. order: "uniqueOrder",
  14522. status: "standard",
  14523. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-reset"
  14524. },
  14525. "counter-set": {
  14526. syntax: "[ <custom-ident> <integer>? ]+ | none",
  14527. media: "all",
  14528. inherited: false,
  14529. animationType: "discrete",
  14530. percentages: "no",
  14531. groups: [
  14532. "CSS Counter Styles"
  14533. ],
  14534. initial: "none",
  14535. appliesto: "allElements",
  14536. computed: "asSpecified",
  14537. order: "uniqueOrder",
  14538. status: "standard",
  14539. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-set"
  14540. },
  14541. cursor: cursor,
  14542. direction: direction,
  14543. display: display,
  14544. "empty-cells": {
  14545. syntax: "show | hide",
  14546. media: "visual",
  14547. inherited: true,
  14548. animationType: "discrete",
  14549. percentages: "no",
  14550. groups: [
  14551. "CSS Table"
  14552. ],
  14553. initial: "show",
  14554. appliesto: "tableCellElements",
  14555. computed: "asSpecified",
  14556. order: "uniqueOrder",
  14557. status: "standard",
  14558. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/empty-cells"
  14559. },
  14560. filter: filter,
  14561. flex: flex,
  14562. "flex-basis": {
  14563. syntax: "content | <'width'>",
  14564. media: "visual",
  14565. inherited: false,
  14566. animationType: "lpc",
  14567. percentages: "referToFlexContainersInnerMainSize",
  14568. groups: [
  14569. "CSS Flexible Box Layout"
  14570. ],
  14571. initial: "auto",
  14572. appliesto: "flexItemsAndInFlowPseudos",
  14573. computed: "asSpecifiedRelativeToAbsoluteLengths",
  14574. order: "lengthOrPercentageBeforeKeywordIfBothPresent",
  14575. status: "standard",
  14576. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-basis"
  14577. },
  14578. "flex-direction": {
  14579. syntax: "row | row-reverse | column | column-reverse",
  14580. media: "visual",
  14581. inherited: false,
  14582. animationType: "discrete",
  14583. percentages: "no",
  14584. groups: [
  14585. "CSS Flexible Box Layout"
  14586. ],
  14587. initial: "row",
  14588. appliesto: "flexContainers",
  14589. computed: "asSpecified",
  14590. order: "uniqueOrder",
  14591. status: "standard",
  14592. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-direction"
  14593. },
  14594. "flex-flow": {
  14595. syntax: "<'flex-direction'> || <'flex-wrap'>",
  14596. media: "visual",
  14597. inherited: false,
  14598. animationType: "discrete",
  14599. percentages: "no",
  14600. groups: [
  14601. "CSS Flexible Box Layout"
  14602. ],
  14603. initial: [
  14604. "flex-direction",
  14605. "flex-wrap"
  14606. ],
  14607. appliesto: "flexContainers",
  14608. computed: [
  14609. "flex-direction",
  14610. "flex-wrap"
  14611. ],
  14612. order: "orderOfAppearance",
  14613. status: "standard",
  14614. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-flow"
  14615. },
  14616. "flex-grow": {
  14617. syntax: "<number>",
  14618. media: "visual",
  14619. inherited: false,
  14620. animationType: "number",
  14621. percentages: "no",
  14622. groups: [
  14623. "CSS Flexible Box Layout"
  14624. ],
  14625. initial: "0",
  14626. appliesto: "flexItemsAndInFlowPseudos",
  14627. computed: "asSpecified",
  14628. order: "uniqueOrder",
  14629. status: "standard",
  14630. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-grow"
  14631. },
  14632. "flex-shrink": {
  14633. syntax: "<number>",
  14634. media: "visual",
  14635. inherited: false,
  14636. animationType: "number",
  14637. percentages: "no",
  14638. groups: [
  14639. "CSS Flexible Box Layout"
  14640. ],
  14641. initial: "1",
  14642. appliesto: "flexItemsAndInFlowPseudos",
  14643. computed: "asSpecified",
  14644. order: "uniqueOrder",
  14645. status: "standard",
  14646. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-shrink"
  14647. },
  14648. "flex-wrap": {
  14649. syntax: "nowrap | wrap | wrap-reverse",
  14650. media: "visual",
  14651. inherited: false,
  14652. animationType: "discrete",
  14653. percentages: "no",
  14654. groups: [
  14655. "CSS Flexible Box Layout"
  14656. ],
  14657. initial: "nowrap",
  14658. appliesto: "flexContainers",
  14659. computed: "asSpecified",
  14660. order: "uniqueOrder",
  14661. status: "standard",
  14662. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-wrap"
  14663. },
  14664. float: float,
  14665. font: font,
  14666. "font-family": {
  14667. syntax: "[ <family-name> | <generic-family> ]#",
  14668. media: "visual",
  14669. inherited: true,
  14670. animationType: "discrete",
  14671. percentages: "no",
  14672. groups: [
  14673. "CSS Fonts"
  14674. ],
  14675. initial: "dependsOnUserAgent",
  14676. appliesto: "allElements",
  14677. computed: "asSpecified",
  14678. order: "uniqueOrder",
  14679. alsoAppliesTo: [
  14680. "::first-letter",
  14681. "::first-line",
  14682. "::placeholder"
  14683. ],
  14684. status: "standard",
  14685. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-family"
  14686. },
  14687. "font-feature-settings": {
  14688. syntax: "normal | <feature-tag-value>#",
  14689. media: "visual",
  14690. inherited: true,
  14691. animationType: "discrete",
  14692. percentages: "no",
  14693. groups: [
  14694. "CSS Fonts"
  14695. ],
  14696. initial: "normal",
  14697. appliesto: "allElements",
  14698. computed: "asSpecified",
  14699. order: "uniqueOrder",
  14700. alsoAppliesTo: [
  14701. "::first-letter",
  14702. "::first-line",
  14703. "::placeholder"
  14704. ],
  14705. status: "standard",
  14706. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-feature-settings"
  14707. },
  14708. "font-kerning": {
  14709. syntax: "auto | normal | none",
  14710. media: "visual",
  14711. inherited: true,
  14712. animationType: "discrete",
  14713. percentages: "no",
  14714. groups: [
  14715. "CSS Fonts"
  14716. ],
  14717. initial: "auto",
  14718. appliesto: "allElements",
  14719. computed: "asSpecified",
  14720. order: "uniqueOrder",
  14721. alsoAppliesTo: [
  14722. "::first-letter",
  14723. "::first-line",
  14724. "::placeholder"
  14725. ],
  14726. status: "standard",
  14727. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-kerning"
  14728. },
  14729. "font-language-override": {
  14730. syntax: "normal | <string>",
  14731. media: "visual",
  14732. inherited: true,
  14733. animationType: "discrete",
  14734. percentages: "no",
  14735. groups: [
  14736. "CSS Fonts"
  14737. ],
  14738. initial: "normal",
  14739. appliesto: "allElements",
  14740. computed: "asSpecified",
  14741. order: "uniqueOrder",
  14742. alsoAppliesTo: [
  14743. "::first-letter",
  14744. "::first-line",
  14745. "::placeholder"
  14746. ],
  14747. status: "standard",
  14748. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-language-override"
  14749. },
  14750. "font-optical-sizing": {
  14751. syntax: "auto | none",
  14752. media: "visual",
  14753. inherited: true,
  14754. animationType: "discrete",
  14755. percentages: "no",
  14756. groups: [
  14757. "CSS Fonts"
  14758. ],
  14759. initial: "auto",
  14760. appliesto: "allElements",
  14761. computed: "asSpecified",
  14762. order: "perGrammar",
  14763. alsoAppliesTo: [
  14764. "::first-letter",
  14765. "::first-line",
  14766. "::placeholder"
  14767. ],
  14768. status: "standard",
  14769. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-optical-sizing"
  14770. },
  14771. "font-variation-settings": {
  14772. syntax: "normal | [ <string> <number> ]#",
  14773. media: "visual",
  14774. inherited: true,
  14775. animationType: "transform",
  14776. percentages: "no",
  14777. groups: [
  14778. "CSS Fonts"
  14779. ],
  14780. initial: "normal",
  14781. appliesto: "allElements",
  14782. computed: "asSpecified",
  14783. order: "perGrammar",
  14784. alsoAppliesTo: [
  14785. "::first-letter",
  14786. "::first-line",
  14787. "::placeholder"
  14788. ],
  14789. status: "experimental",
  14790. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variation-settings"
  14791. },
  14792. "font-size": {
  14793. syntax: "<absolute-size> | <relative-size> | <length-percentage>",
  14794. media: "visual",
  14795. inherited: true,
  14796. animationType: "length",
  14797. percentages: "referToParentElementsFontSize",
  14798. groups: [
  14799. "CSS Fonts"
  14800. ],
  14801. initial: "medium",
  14802. appliesto: "allElements",
  14803. computed: "asSpecifiedRelativeToAbsoluteLengths",
  14804. order: "uniqueOrder",
  14805. alsoAppliesTo: [
  14806. "::first-letter",
  14807. "::first-line",
  14808. "::placeholder"
  14809. ],
  14810. status: "standard",
  14811. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-size"
  14812. },
  14813. "font-size-adjust": {
  14814. syntax: "none | <number>",
  14815. media: "visual",
  14816. inherited: true,
  14817. animationType: "number",
  14818. percentages: "no",
  14819. groups: [
  14820. "CSS Fonts"
  14821. ],
  14822. initial: "none",
  14823. appliesto: "allElements",
  14824. computed: "asSpecified",
  14825. order: "uniqueOrder",
  14826. alsoAppliesTo: [
  14827. "::first-letter",
  14828. "::first-line",
  14829. "::placeholder"
  14830. ],
  14831. status: "standard",
  14832. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-size-adjust"
  14833. },
  14834. "font-stretch": {
  14835. syntax: "<font-stretch-absolute>",
  14836. media: "visual",
  14837. inherited: true,
  14838. animationType: "fontStretch",
  14839. percentages: "no",
  14840. groups: [
  14841. "CSS Fonts"
  14842. ],
  14843. initial: "normal",
  14844. appliesto: "allElements",
  14845. computed: "asSpecified",
  14846. order: "uniqueOrder",
  14847. alsoAppliesTo: [
  14848. "::first-letter",
  14849. "::first-line",
  14850. "::placeholder"
  14851. ],
  14852. status: "standard",
  14853. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-stretch"
  14854. },
  14855. "font-style": {
  14856. syntax: "normal | italic | oblique <angle>?",
  14857. media: "visual",
  14858. inherited: true,
  14859. animationType: "discrete",
  14860. percentages: "no",
  14861. groups: [
  14862. "CSS Fonts"
  14863. ],
  14864. initial: "normal",
  14865. appliesto: "allElements",
  14866. computed: "asSpecified",
  14867. order: "uniqueOrder",
  14868. alsoAppliesTo: [
  14869. "::first-letter",
  14870. "::first-line",
  14871. "::placeholder"
  14872. ],
  14873. status: "standard",
  14874. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-style"
  14875. },
  14876. "font-synthesis": {
  14877. syntax: "none | [ weight || style ]",
  14878. media: "visual",
  14879. inherited: true,
  14880. animationType: "discrete",
  14881. percentages: "no",
  14882. groups: [
  14883. "CSS Fonts"
  14884. ],
  14885. initial: "weight style",
  14886. appliesto: "allElements",
  14887. computed: "asSpecified",
  14888. order: "orderOfAppearance",
  14889. alsoAppliesTo: [
  14890. "::first-letter",
  14891. "::first-line",
  14892. "::placeholder"
  14893. ],
  14894. status: "standard",
  14895. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-synthesis"
  14896. },
  14897. "font-variant": {
  14898. 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 ]",
  14899. media: "visual",
  14900. inherited: true,
  14901. animationType: "discrete",
  14902. percentages: "no",
  14903. groups: [
  14904. "CSS Fonts"
  14905. ],
  14906. initial: "normal",
  14907. appliesto: "allElements",
  14908. computed: "asSpecified",
  14909. order: "uniqueOrder",
  14910. alsoAppliesTo: [
  14911. "::first-letter",
  14912. "::first-line",
  14913. "::placeholder"
  14914. ],
  14915. status: "standard",
  14916. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant"
  14917. },
  14918. "font-variant-alternates": {
  14919. 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> ) ]",
  14920. media: "visual",
  14921. inherited: true,
  14922. animationType: "discrete",
  14923. percentages: "no",
  14924. groups: [
  14925. "CSS Fonts"
  14926. ],
  14927. initial: "normal",
  14928. appliesto: "allElements",
  14929. computed: "asSpecified",
  14930. order: "orderOfAppearance",
  14931. alsoAppliesTo: [
  14932. "::first-letter",
  14933. "::first-line",
  14934. "::placeholder"
  14935. ],
  14936. status: "standard",
  14937. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-alternates"
  14938. },
  14939. "font-variant-caps": {
  14940. syntax: "normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps",
  14941. media: "visual",
  14942. inherited: true,
  14943. animationType: "discrete",
  14944. percentages: "no",
  14945. groups: [
  14946. "CSS Fonts"
  14947. ],
  14948. initial: "normal",
  14949. appliesto: "allElements",
  14950. computed: "asSpecified",
  14951. order: "uniqueOrder",
  14952. alsoAppliesTo: [
  14953. "::first-letter",
  14954. "::first-line",
  14955. "::placeholder"
  14956. ],
  14957. status: "standard",
  14958. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-caps"
  14959. },
  14960. "font-variant-east-asian": {
  14961. syntax: "normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
  14962. media: "visual",
  14963. inherited: true,
  14964. animationType: "discrete",
  14965. percentages: "no",
  14966. groups: [
  14967. "CSS Fonts"
  14968. ],
  14969. initial: "normal",
  14970. appliesto: "allElements",
  14971. computed: "asSpecified",
  14972. order: "orderOfAppearance",
  14973. alsoAppliesTo: [
  14974. "::first-letter",
  14975. "::first-line",
  14976. "::placeholder"
  14977. ],
  14978. status: "standard",
  14979. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-east-asian"
  14980. },
  14981. "font-variant-ligatures": {
  14982. syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]",
  14983. media: "visual",
  14984. inherited: true,
  14985. animationType: "discrete",
  14986. percentages: "no",
  14987. groups: [
  14988. "CSS Fonts"
  14989. ],
  14990. initial: "normal",
  14991. appliesto: "allElements",
  14992. computed: "asSpecified",
  14993. order: "orderOfAppearance",
  14994. alsoAppliesTo: [
  14995. "::first-letter",
  14996. "::first-line",
  14997. "::placeholder"
  14998. ],
  14999. status: "standard",
  15000. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-ligatures"
  15001. },
  15002. "font-variant-numeric": {
  15003. syntax: "normal | [ <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero ]",
  15004. media: "visual",
  15005. inherited: true,
  15006. animationType: "discrete",
  15007. percentages: "no",
  15008. groups: [
  15009. "CSS Fonts"
  15010. ],
  15011. initial: "normal",
  15012. appliesto: "allElements",
  15013. computed: "asSpecified",
  15014. order: "orderOfAppearance",
  15015. alsoAppliesTo: [
  15016. "::first-letter",
  15017. "::first-line",
  15018. "::placeholder"
  15019. ],
  15020. status: "standard",
  15021. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-numeric"
  15022. },
  15023. "font-variant-position": {
  15024. syntax: "normal | sub | super",
  15025. media: "visual",
  15026. inherited: true,
  15027. animationType: "discrete",
  15028. percentages: "no",
  15029. groups: [
  15030. "CSS Fonts"
  15031. ],
  15032. initial: "normal",
  15033. appliesto: "allElements",
  15034. computed: "asSpecified",
  15035. order: "uniqueOrder",
  15036. alsoAppliesTo: [
  15037. "::first-letter",
  15038. "::first-line",
  15039. "::placeholder"
  15040. ],
  15041. status: "standard",
  15042. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-position"
  15043. },
  15044. "font-weight": {
  15045. syntax: "<font-weight-absolute> | bolder | lighter",
  15046. media: "visual",
  15047. inherited: true,
  15048. animationType: "fontWeight",
  15049. percentages: "no",
  15050. groups: [
  15051. "CSS Fonts"
  15052. ],
  15053. initial: "normal",
  15054. appliesto: "allElements",
  15055. computed: "keywordOrNumericalValueBolderLighterTransformedToRealValue",
  15056. order: "uniqueOrder",
  15057. alsoAppliesTo: [
  15058. "::first-letter",
  15059. "::first-line",
  15060. "::placeholder"
  15061. ],
  15062. status: "standard",
  15063. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-weight"
  15064. },
  15065. gap: gap,
  15066. grid: grid,
  15067. "grid-area": {
  15068. syntax: "<grid-line> [ / <grid-line> ]{0,3}",
  15069. media: "visual",
  15070. inherited: false,
  15071. animationType: "discrete",
  15072. percentages: "no",
  15073. groups: [
  15074. "CSS Grid Layout"
  15075. ],
  15076. initial: [
  15077. "grid-row-start",
  15078. "grid-column-start",
  15079. "grid-row-end",
  15080. "grid-column-end"
  15081. ],
  15082. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15083. computed: [
  15084. "grid-row-start",
  15085. "grid-column-start",
  15086. "grid-row-end",
  15087. "grid-column-end"
  15088. ],
  15089. order: "uniqueOrder",
  15090. status: "standard",
  15091. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-area"
  15092. },
  15093. "grid-auto-columns": {
  15094. syntax: "<track-size>+",
  15095. media: "visual",
  15096. inherited: false,
  15097. animationType: "discrete",
  15098. percentages: "referToDimensionOfContentArea",
  15099. groups: [
  15100. "CSS Grid Layout"
  15101. ],
  15102. initial: "auto",
  15103. appliesto: "gridContainers",
  15104. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15105. order: "uniqueOrder",
  15106. status: "standard",
  15107. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-columns"
  15108. },
  15109. "grid-auto-flow": {
  15110. syntax: "[ row | column ] || dense",
  15111. media: "visual",
  15112. inherited: false,
  15113. animationType: "discrete",
  15114. percentages: "no",
  15115. groups: [
  15116. "CSS Grid Layout"
  15117. ],
  15118. initial: "row",
  15119. appliesto: "gridContainers",
  15120. computed: "asSpecified",
  15121. order: "uniqueOrder",
  15122. status: "standard",
  15123. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-flow"
  15124. },
  15125. "grid-auto-rows": {
  15126. syntax: "<track-size>+",
  15127. media: "visual",
  15128. inherited: false,
  15129. animationType: "discrete",
  15130. percentages: "referToDimensionOfContentArea",
  15131. groups: [
  15132. "CSS Grid Layout"
  15133. ],
  15134. initial: "auto",
  15135. appliesto: "gridContainers",
  15136. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15137. order: "uniqueOrder",
  15138. status: "standard",
  15139. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-rows"
  15140. },
  15141. "grid-column": {
  15142. syntax: "<grid-line> [ / <grid-line> ]?",
  15143. media: "visual",
  15144. inherited: false,
  15145. animationType: "discrete",
  15146. percentages: "no",
  15147. groups: [
  15148. "CSS Grid Layout"
  15149. ],
  15150. initial: [
  15151. "grid-column-start",
  15152. "grid-column-end"
  15153. ],
  15154. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15155. computed: [
  15156. "grid-column-start",
  15157. "grid-column-end"
  15158. ],
  15159. order: "uniqueOrder",
  15160. status: "standard",
  15161. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column"
  15162. },
  15163. "grid-column-end": {
  15164. syntax: "<grid-line>",
  15165. media: "visual",
  15166. inherited: false,
  15167. animationType: "discrete",
  15168. percentages: "no",
  15169. groups: [
  15170. "CSS Grid Layout"
  15171. ],
  15172. initial: "auto",
  15173. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15174. computed: "asSpecified",
  15175. order: "uniqueOrder",
  15176. status: "standard",
  15177. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column-end"
  15178. },
  15179. "grid-column-gap": {
  15180. syntax: "<length-percentage>",
  15181. media: "visual",
  15182. inherited: false,
  15183. animationType: "length",
  15184. percentages: "referToDimensionOfContentArea",
  15185. groups: [
  15186. "CSS Grid Layout"
  15187. ],
  15188. initial: "0",
  15189. appliesto: "gridContainers",
  15190. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15191. order: "uniqueOrder",
  15192. status: "obsolete",
  15193. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-gap"
  15194. },
  15195. "grid-column-start": {
  15196. syntax: "<grid-line>",
  15197. media: "visual",
  15198. inherited: false,
  15199. animationType: "discrete",
  15200. percentages: "no",
  15201. groups: [
  15202. "CSS Grid Layout"
  15203. ],
  15204. initial: "auto",
  15205. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15206. computed: "asSpecified",
  15207. order: "uniqueOrder",
  15208. status: "standard",
  15209. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column-start"
  15210. },
  15211. "grid-gap": {
  15212. syntax: "<'grid-row-gap'> <'grid-column-gap'>?",
  15213. media: "visual",
  15214. inherited: false,
  15215. animationType: [
  15216. "grid-row-gap",
  15217. "grid-column-gap"
  15218. ],
  15219. percentages: "no",
  15220. groups: [
  15221. "CSS Grid Layout"
  15222. ],
  15223. initial: [
  15224. "grid-row-gap",
  15225. "grid-column-gap"
  15226. ],
  15227. appliesto: "gridContainers",
  15228. computed: [
  15229. "grid-row-gap",
  15230. "grid-column-gap"
  15231. ],
  15232. order: "uniqueOrder",
  15233. status: "obsolete",
  15234. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/gap"
  15235. },
  15236. "grid-row": {
  15237. syntax: "<grid-line> [ / <grid-line> ]?",
  15238. media: "visual",
  15239. inherited: false,
  15240. animationType: "discrete",
  15241. percentages: "no",
  15242. groups: [
  15243. "CSS Grid Layout"
  15244. ],
  15245. initial: [
  15246. "grid-row-start",
  15247. "grid-row-end"
  15248. ],
  15249. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15250. computed: [
  15251. "grid-row-start",
  15252. "grid-row-end"
  15253. ],
  15254. order: "uniqueOrder",
  15255. status: "standard",
  15256. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row"
  15257. },
  15258. "grid-row-end": {
  15259. syntax: "<grid-line>",
  15260. media: "visual",
  15261. inherited: false,
  15262. animationType: "discrete",
  15263. percentages: "no",
  15264. groups: [
  15265. "CSS Grid Layout"
  15266. ],
  15267. initial: "auto",
  15268. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15269. computed: "asSpecified",
  15270. order: "uniqueOrder",
  15271. status: "standard",
  15272. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row-end"
  15273. },
  15274. "grid-row-gap": {
  15275. syntax: "<length-percentage>",
  15276. media: "visual",
  15277. inherited: false,
  15278. animationType: "length",
  15279. percentages: "referToDimensionOfContentArea",
  15280. groups: [
  15281. "CSS Grid Layout"
  15282. ],
  15283. initial: "0",
  15284. appliesto: "gridContainers",
  15285. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15286. order: "uniqueOrder",
  15287. status: "obsolete",
  15288. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/row-gap"
  15289. },
  15290. "grid-row-start": {
  15291. syntax: "<grid-line>",
  15292. media: "visual",
  15293. inherited: false,
  15294. animationType: "discrete",
  15295. percentages: "no",
  15296. groups: [
  15297. "CSS Grid Layout"
  15298. ],
  15299. initial: "auto",
  15300. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15301. computed: "asSpecified",
  15302. order: "uniqueOrder",
  15303. status: "standard",
  15304. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row-start"
  15305. },
  15306. "grid-template": {
  15307. syntax: "none | [ <'grid-template-rows'> / <'grid-template-columns'> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?",
  15308. media: "visual",
  15309. inherited: false,
  15310. animationType: "discrete",
  15311. percentages: [
  15312. "grid-template-columns",
  15313. "grid-template-rows"
  15314. ],
  15315. groups: [
  15316. "CSS Grid Layout"
  15317. ],
  15318. initial: [
  15319. "grid-template-columns",
  15320. "grid-template-rows",
  15321. "grid-template-areas"
  15322. ],
  15323. appliesto: "gridContainers",
  15324. computed: [
  15325. "grid-template-columns",
  15326. "grid-template-rows",
  15327. "grid-template-areas"
  15328. ],
  15329. order: "uniqueOrder",
  15330. status: "standard",
  15331. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template"
  15332. },
  15333. "grid-template-areas": {
  15334. syntax: "none | <string>+",
  15335. media: "visual",
  15336. inherited: false,
  15337. animationType: "discrete",
  15338. percentages: "no",
  15339. groups: [
  15340. "CSS Grid Layout"
  15341. ],
  15342. initial: "none",
  15343. appliesto: "gridContainers",
  15344. computed: "asSpecified",
  15345. order: "uniqueOrder",
  15346. status: "standard",
  15347. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-areas"
  15348. },
  15349. "grid-template-columns": {
  15350. syntax: "none | <track-list> | <auto-track-list> | subgrid <line-name-list>?",
  15351. media: "visual",
  15352. inherited: false,
  15353. animationType: "simpleListOfLpcDifferenceLpc",
  15354. percentages: "referToDimensionOfContentArea",
  15355. groups: [
  15356. "CSS Grid Layout"
  15357. ],
  15358. initial: "none",
  15359. appliesto: "gridContainers",
  15360. computed: "asSpecifiedRelativeToAbsoluteLengths",
  15361. order: "uniqueOrder",
  15362. status: "standard",
  15363. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-columns"
  15364. },
  15365. "grid-template-rows": {
  15366. syntax: "none | <track-list> | <auto-track-list> | subgrid <line-name-list>?",
  15367. media: "visual",
  15368. inherited: false,
  15369. animationType: "simpleListOfLpcDifferenceLpc",
  15370. percentages: "referToDimensionOfContentArea",
  15371. groups: [
  15372. "CSS Grid Layout"
  15373. ],
  15374. initial: "none",
  15375. appliesto: "gridContainers",
  15376. computed: "asSpecifiedRelativeToAbsoluteLengths",
  15377. order: "uniqueOrder",
  15378. status: "standard",
  15379. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-rows"
  15380. },
  15381. "hanging-punctuation": {
  15382. syntax: "none | [ first || [ force-end | allow-end ] || last ]",
  15383. media: "visual",
  15384. inherited: true,
  15385. animationType: "discrete",
  15386. percentages: "no",
  15387. groups: [
  15388. "CSS Text"
  15389. ],
  15390. initial: "none",
  15391. appliesto: "allElements",
  15392. computed: "asSpecified",
  15393. order: "uniqueOrder",
  15394. status: "standard",
  15395. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/hanging-punctuation"
  15396. },
  15397. height: height,
  15398. hyphens: hyphens,
  15399. "image-orientation": {
  15400. syntax: "from-image | <angle> | [ <angle>? flip ]",
  15401. media: "visual",
  15402. inherited: true,
  15403. animationType: "discrete",
  15404. percentages: "no",
  15405. groups: [
  15406. "CSS Images"
  15407. ],
  15408. initial: "0deg",
  15409. appliesto: "allElements",
  15410. computed: "angleRoundedToNextQuarter",
  15411. order: "uniqueOrder",
  15412. status: "standard",
  15413. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/image-orientation"
  15414. },
  15415. "image-rendering": {
  15416. syntax: "auto | crisp-edges | pixelated",
  15417. media: "visual",
  15418. inherited: true,
  15419. animationType: "discrete",
  15420. percentages: "no",
  15421. groups: [
  15422. "CSS Images"
  15423. ],
  15424. initial: "auto",
  15425. appliesto: "allElements",
  15426. computed: "asSpecified",
  15427. order: "uniqueOrder",
  15428. status: "standard",
  15429. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/image-rendering"
  15430. },
  15431. "image-resolution": {
  15432. syntax: "[ from-image || <resolution> ] && snap?",
  15433. media: "visual",
  15434. inherited: true,
  15435. animationType: "discrete",
  15436. percentages: "no",
  15437. groups: [
  15438. "CSS Images"
  15439. ],
  15440. initial: "1dppx",
  15441. appliesto: "allElements",
  15442. computed: "asSpecifiedWithExceptionOfResolution",
  15443. order: "uniqueOrder",
  15444. status: "experimental"
  15445. },
  15446. "ime-mode": {
  15447. syntax: "auto | normal | active | inactive | disabled",
  15448. media: "interactive",
  15449. inherited: false,
  15450. animationType: "discrete",
  15451. percentages: "no",
  15452. groups: [
  15453. "CSS Basic User Interface"
  15454. ],
  15455. initial: "auto",
  15456. appliesto: "textFields",
  15457. computed: "asSpecified",
  15458. order: "uniqueOrder",
  15459. status: "obsolete",
  15460. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ime-mode"
  15461. },
  15462. "initial-letter": {
  15463. syntax: "normal | [ <number> <integer>? ]",
  15464. media: "visual",
  15465. inherited: false,
  15466. animationType: "discrete",
  15467. percentages: "no",
  15468. groups: [
  15469. "CSS Inline"
  15470. ],
  15471. initial: "normal",
  15472. appliesto: "firstLetterPseudoElementsAndInlineLevelFirstChildren",
  15473. computed: "asSpecified",
  15474. order: "uniqueOrder",
  15475. status: "experimental",
  15476. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/initial-letter"
  15477. },
  15478. "initial-letter-align": {
  15479. syntax: "[ auto | alphabetic | hanging | ideographic ]",
  15480. media: "visual",
  15481. inherited: false,
  15482. animationType: "discrete",
  15483. percentages: "no",
  15484. groups: [
  15485. "CSS Inline"
  15486. ],
  15487. initial: "auto",
  15488. appliesto: "firstLetterPseudoElementsAndInlineLevelFirstChildren",
  15489. computed: "asSpecified",
  15490. order: "uniqueOrder",
  15491. status: "experimental",
  15492. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/initial-letter-align"
  15493. },
  15494. "inline-size": {
  15495. syntax: "<'width'>",
  15496. media: "visual",
  15497. inherited: false,
  15498. animationType: "discrete",
  15499. percentages: "inlineSizeOfContainingBlock",
  15500. groups: [
  15501. "CSS Logical Properties"
  15502. ],
  15503. initial: "auto",
  15504. appliesto: "sameAsWidthAndHeight",
  15505. computed: "sameAsWidthAndHeight",
  15506. order: "uniqueOrder",
  15507. status: "standard",
  15508. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inline-size"
  15509. },
  15510. inset: inset,
  15511. "inset-block": {
  15512. syntax: "<'top'>{1,2}",
  15513. media: "visual",
  15514. inherited: false,
  15515. animationType: "lpc",
  15516. percentages: "logicalHeightOfContainingBlock",
  15517. groups: [
  15518. "CSS Logical Properties"
  15519. ],
  15520. initial: "auto",
  15521. appliesto: "positionedElements",
  15522. computed: "sameAsBoxOffsets",
  15523. order: "uniqueOrder",
  15524. status: "standard",
  15525. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block"
  15526. },
  15527. "inset-block-end": {
  15528. syntax: "<'top'>",
  15529. media: "visual",
  15530. inherited: false,
  15531. animationType: "lpc",
  15532. percentages: "logicalHeightOfContainingBlock",
  15533. groups: [
  15534. "CSS Logical Properties"
  15535. ],
  15536. initial: "auto",
  15537. appliesto: "positionedElements",
  15538. computed: "sameAsBoxOffsets",
  15539. order: "uniqueOrder",
  15540. status: "standard",
  15541. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block-end"
  15542. },
  15543. "inset-block-start": {
  15544. syntax: "<'top'>",
  15545. media: "visual",
  15546. inherited: false,
  15547. animationType: "lpc",
  15548. percentages: "logicalHeightOfContainingBlock",
  15549. groups: [
  15550. "CSS Logical Properties"
  15551. ],
  15552. initial: "auto",
  15553. appliesto: "positionedElements",
  15554. computed: "sameAsBoxOffsets",
  15555. order: "uniqueOrder",
  15556. status: "standard",
  15557. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block-start"
  15558. },
  15559. "inset-inline": {
  15560. syntax: "<'top'>{1,2}",
  15561. media: "visual",
  15562. inherited: false,
  15563. animationType: "lpc",
  15564. percentages: "logicalWidthOfContainingBlock",
  15565. groups: [
  15566. "CSS Logical Properties"
  15567. ],
  15568. initial: "auto",
  15569. appliesto: "positionedElements",
  15570. computed: "sameAsBoxOffsets",
  15571. order: "uniqueOrder",
  15572. status: "standard",
  15573. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline"
  15574. },
  15575. "inset-inline-end": {
  15576. syntax: "<'top'>",
  15577. media: "visual",
  15578. inherited: false,
  15579. animationType: "lpc",
  15580. percentages: "logicalWidthOfContainingBlock",
  15581. groups: [
  15582. "CSS Logical Properties"
  15583. ],
  15584. initial: "auto",
  15585. appliesto: "positionedElements",
  15586. computed: "sameAsBoxOffsets",
  15587. order: "uniqueOrder",
  15588. status: "standard",
  15589. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline-end"
  15590. },
  15591. "inset-inline-start": {
  15592. syntax: "<'top'>",
  15593. media: "visual",
  15594. inherited: false,
  15595. animationType: "lpc",
  15596. percentages: "logicalWidthOfContainingBlock",
  15597. groups: [
  15598. "CSS Logical Properties"
  15599. ],
  15600. initial: "auto",
  15601. appliesto: "positionedElements",
  15602. computed: "sameAsBoxOffsets",
  15603. order: "uniqueOrder",
  15604. status: "standard",
  15605. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline-start"
  15606. },
  15607. isolation: isolation,
  15608. "justify-content": {
  15609. syntax: "normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ]",
  15610. media: "visual",
  15611. inherited: false,
  15612. animationType: "discrete",
  15613. percentages: "no",
  15614. groups: [
  15615. "CSS Box Alignment"
  15616. ],
  15617. initial: "normal",
  15618. appliesto: "flexContainers",
  15619. computed: "asSpecified",
  15620. order: "uniqueOrder",
  15621. status: "standard",
  15622. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-content"
  15623. },
  15624. "justify-items": {
  15625. syntax: "normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ] | legacy | legacy && [ left | right | center ]",
  15626. media: "visual",
  15627. inherited: false,
  15628. animationType: "discrete",
  15629. percentages: "no",
  15630. groups: [
  15631. "CSS Box Alignment"
  15632. ],
  15633. initial: "legacy",
  15634. appliesto: "allElements",
  15635. computed: "asSpecified",
  15636. order: "perGrammar",
  15637. status: "standard",
  15638. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-items"
  15639. },
  15640. "justify-self": {
  15641. syntax: "auto | normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ]",
  15642. media: "visual",
  15643. inherited: false,
  15644. animationType: "discrete",
  15645. percentages: "no",
  15646. groups: [
  15647. "CSS Box Alignment"
  15648. ],
  15649. initial: "auto",
  15650. appliesto: "blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems",
  15651. computed: "asSpecified",
  15652. order: "uniqueOrder",
  15653. status: "standard",
  15654. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-self"
  15655. },
  15656. left: left,
  15657. "letter-spacing": {
  15658. syntax: "normal | <length>",
  15659. media: "visual",
  15660. inherited: true,
  15661. animationType: "length",
  15662. percentages: "no",
  15663. groups: [
  15664. "CSS Text"
  15665. ],
  15666. initial: "normal",
  15667. appliesto: "allElements",
  15668. computed: "optimumValueOfAbsoluteLengthOrNormal",
  15669. order: "uniqueOrder",
  15670. alsoAppliesTo: [
  15671. "::first-letter",
  15672. "::first-line"
  15673. ],
  15674. status: "standard",
  15675. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/letter-spacing"
  15676. },
  15677. "line-break": {
  15678. syntax: "auto | loose | normal | strict | anywhere",
  15679. media: "visual",
  15680. inherited: false,
  15681. animationType: "discrete",
  15682. percentages: "no",
  15683. groups: [
  15684. "CSS Text"
  15685. ],
  15686. initial: "auto",
  15687. appliesto: "allElements",
  15688. computed: "asSpecified",
  15689. order: "uniqueOrder",
  15690. status: "standard",
  15691. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-break"
  15692. },
  15693. "line-clamp": {
  15694. syntax: "none | <integer>",
  15695. media: "visual",
  15696. inherited: false,
  15697. animationType: "integer",
  15698. percentages: "no",
  15699. groups: [
  15700. "CSS Overflow"
  15701. ],
  15702. initial: "none",
  15703. appliesto: "blockContainersExceptMultiColumnContainers",
  15704. computed: "asSpecified",
  15705. order: "perGrammar",
  15706. status: "experimental"
  15707. },
  15708. "line-height": {
  15709. syntax: "normal | <number> | <length> | <percentage>",
  15710. media: "visual",
  15711. inherited: true,
  15712. animationType: "numberOrLength",
  15713. percentages: "referToElementFontSize",
  15714. groups: [
  15715. "CSS Fonts"
  15716. ],
  15717. initial: "normal",
  15718. appliesto: "allElements",
  15719. computed: "absoluteLengthOrAsSpecified",
  15720. order: "uniqueOrder",
  15721. alsoAppliesTo: [
  15722. "::first-letter",
  15723. "::first-line",
  15724. "::placeholder"
  15725. ],
  15726. status: "standard",
  15727. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-height"
  15728. },
  15729. "line-height-step": {
  15730. syntax: "<length>",
  15731. media: "visual",
  15732. inherited: true,
  15733. animationType: "discrete",
  15734. percentages: "no",
  15735. groups: [
  15736. "CSS Fonts"
  15737. ],
  15738. initial: "0",
  15739. appliesto: "blockContainers",
  15740. computed: "absoluteLength",
  15741. order: "perGrammar",
  15742. status: "experimental",
  15743. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-height-step"
  15744. },
  15745. "list-style": {
  15746. syntax: "<'list-style-type'> || <'list-style-position'> || <'list-style-image'>",
  15747. media: "visual",
  15748. inherited: true,
  15749. animationType: "discrete",
  15750. percentages: "no",
  15751. groups: [
  15752. "CSS Lists and Counters"
  15753. ],
  15754. initial: [
  15755. "list-style-type",
  15756. "list-style-position",
  15757. "list-style-image"
  15758. ],
  15759. appliesto: "listItems",
  15760. computed: [
  15761. "list-style-image",
  15762. "list-style-position",
  15763. "list-style-type"
  15764. ],
  15765. order: "orderOfAppearance",
  15766. status: "standard",
  15767. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style"
  15768. },
  15769. "list-style-image": {
  15770. syntax: "<url> | none",
  15771. media: "visual",
  15772. inherited: true,
  15773. animationType: "discrete",
  15774. percentages: "no",
  15775. groups: [
  15776. "CSS Lists and Counters"
  15777. ],
  15778. initial: "none",
  15779. appliesto: "listItems",
  15780. computed: "noneOrImageWithAbsoluteURI",
  15781. order: "uniqueOrder",
  15782. status: "standard",
  15783. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-image"
  15784. },
  15785. "list-style-position": {
  15786. syntax: "inside | outside",
  15787. media: "visual",
  15788. inherited: true,
  15789. animationType: "discrete",
  15790. percentages: "no",
  15791. groups: [
  15792. "CSS Lists and Counters"
  15793. ],
  15794. initial: "outside",
  15795. appliesto: "listItems",
  15796. computed: "asSpecified",
  15797. order: "uniqueOrder",
  15798. status: "standard",
  15799. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-position"
  15800. },
  15801. "list-style-type": {
  15802. syntax: "<counter-style> | <string> | none",
  15803. media: "visual",
  15804. inherited: true,
  15805. animationType: "discrete",
  15806. percentages: "no",
  15807. groups: [
  15808. "CSS Lists and Counters"
  15809. ],
  15810. initial: "disc",
  15811. appliesto: "listItems",
  15812. computed: "asSpecified",
  15813. order: "uniqueOrder",
  15814. status: "standard",
  15815. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-type"
  15816. },
  15817. margin: margin,
  15818. "margin-block": {
  15819. syntax: "<'margin-left'>{1,2}",
  15820. media: "visual",
  15821. inherited: false,
  15822. animationType: "discrete",
  15823. percentages: "dependsOnLayoutModel",
  15824. groups: [
  15825. "CSS Logical Properties"
  15826. ],
  15827. initial: "0",
  15828. appliesto: "sameAsMargin",
  15829. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  15830. order: "uniqueOrder",
  15831. status: "standard",
  15832. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block"
  15833. },
  15834. "margin-block-end": {
  15835. syntax: "<'margin-left'>",
  15836. media: "visual",
  15837. inherited: false,
  15838. animationType: "discrete",
  15839. percentages: "dependsOnLayoutModel",
  15840. groups: [
  15841. "CSS Logical Properties"
  15842. ],
  15843. initial: "0",
  15844. appliesto: "sameAsMargin",
  15845. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  15846. order: "uniqueOrder",
  15847. status: "standard",
  15848. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block-end"
  15849. },
  15850. "margin-block-start": {
  15851. syntax: "<'margin-left'>",
  15852. media: "visual",
  15853. inherited: false,
  15854. animationType: "discrete",
  15855. percentages: "dependsOnLayoutModel",
  15856. groups: [
  15857. "CSS Logical Properties"
  15858. ],
  15859. initial: "0",
  15860. appliesto: "sameAsMargin",
  15861. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  15862. order: "uniqueOrder",
  15863. status: "standard",
  15864. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block-start"
  15865. },
  15866. "margin-bottom": {
  15867. syntax: "<length> | <percentage> | auto",
  15868. media: "visual",
  15869. inherited: false,
  15870. animationType: "length",
  15871. percentages: "referToWidthOfContainingBlock",
  15872. groups: [
  15873. "CSS Box Model"
  15874. ],
  15875. initial: "0",
  15876. appliesto: "allElementsExceptTableDisplayTypes",
  15877. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15878. order: "uniqueOrder",
  15879. alsoAppliesTo: [
  15880. "::first-letter"
  15881. ],
  15882. status: "standard",
  15883. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-bottom"
  15884. },
  15885. "margin-inline": {
  15886. syntax: "<'margin-left'>{1,2}",
  15887. media: "visual",
  15888. inherited: false,
  15889. animationType: "discrete",
  15890. percentages: "dependsOnLayoutModel",
  15891. groups: [
  15892. "CSS Logical Properties"
  15893. ],
  15894. initial: "0",
  15895. appliesto: "sameAsMargin",
  15896. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  15897. order: "uniqueOrder",
  15898. status: "standard",
  15899. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline"
  15900. },
  15901. "margin-inline-end": {
  15902. syntax: "<'margin-left'>",
  15903. media: "visual",
  15904. inherited: false,
  15905. animationType: "discrete",
  15906. percentages: "dependsOnLayoutModel",
  15907. groups: [
  15908. "CSS Logical Properties"
  15909. ],
  15910. initial: "0",
  15911. appliesto: "sameAsMargin",
  15912. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  15913. order: "uniqueOrder",
  15914. status: "standard",
  15915. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline-end"
  15916. },
  15917. "margin-inline-start": {
  15918. syntax: "<'margin-left'>",
  15919. media: "visual",
  15920. inherited: false,
  15921. animationType: "discrete",
  15922. percentages: "dependsOnLayoutModel",
  15923. groups: [
  15924. "CSS Logical Properties"
  15925. ],
  15926. initial: "0",
  15927. appliesto: "sameAsMargin",
  15928. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  15929. order: "uniqueOrder",
  15930. status: "standard",
  15931. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline-start"
  15932. },
  15933. "margin-left": {
  15934. syntax: "<length> | <percentage> | auto",
  15935. media: "visual",
  15936. inherited: false,
  15937. animationType: "length",
  15938. percentages: "referToWidthOfContainingBlock",
  15939. groups: [
  15940. "CSS Box Model"
  15941. ],
  15942. initial: "0",
  15943. appliesto: "allElementsExceptTableDisplayTypes",
  15944. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15945. order: "uniqueOrder",
  15946. alsoAppliesTo: [
  15947. "::first-letter"
  15948. ],
  15949. status: "standard",
  15950. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-left"
  15951. },
  15952. "margin-right": {
  15953. syntax: "<length> | <percentage> | auto",
  15954. media: "visual",
  15955. inherited: false,
  15956. animationType: "length",
  15957. percentages: "referToWidthOfContainingBlock",
  15958. groups: [
  15959. "CSS Box Model"
  15960. ],
  15961. initial: "0",
  15962. appliesto: "allElementsExceptTableDisplayTypes",
  15963. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15964. order: "uniqueOrder",
  15965. alsoAppliesTo: [
  15966. "::first-letter"
  15967. ],
  15968. status: "standard",
  15969. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-right"
  15970. },
  15971. "margin-top": {
  15972. syntax: "<length> | <percentage> | auto",
  15973. media: "visual",
  15974. inherited: false,
  15975. animationType: "length",
  15976. percentages: "referToWidthOfContainingBlock",
  15977. groups: [
  15978. "CSS Box Model"
  15979. ],
  15980. initial: "0",
  15981. appliesto: "allElementsExceptTableDisplayTypes",
  15982. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15983. order: "uniqueOrder",
  15984. alsoAppliesTo: [
  15985. "::first-letter"
  15986. ],
  15987. status: "standard",
  15988. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-top"
  15989. },
  15990. mask: mask,
  15991. "mask-border": {
  15992. syntax: "<'mask-border-source'> || <'mask-border-slice'> [ / <'mask-border-width'>? [ / <'mask-border-outset'> ]? ]? || <'mask-border-repeat'> || <'mask-border-mode'>",
  15993. media: "visual",
  15994. inherited: false,
  15995. animationType: [
  15996. "mask-border-mode",
  15997. "mask-border-outset",
  15998. "mask-border-repeat",
  15999. "mask-border-slice",
  16000. "mask-border-source",
  16001. "mask-border-width"
  16002. ],
  16003. percentages: [
  16004. "mask-border-slice",
  16005. "mask-border-width"
  16006. ],
  16007. groups: [
  16008. "CSS Masking"
  16009. ],
  16010. initial: [
  16011. "mask-border-mode",
  16012. "mask-border-outset",
  16013. "mask-border-repeat",
  16014. "mask-border-slice",
  16015. "mask-border-source",
  16016. "mask-border-width"
  16017. ],
  16018. appliesto: "allElementsSVGContainerElements",
  16019. computed: [
  16020. "mask-border-mode",
  16021. "mask-border-outset",
  16022. "mask-border-repeat",
  16023. "mask-border-slice",
  16024. "mask-border-source",
  16025. "mask-border-width"
  16026. ],
  16027. order: "perGrammar",
  16028. stacking: true,
  16029. status: "experimental",
  16030. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border"
  16031. },
  16032. "mask-border-mode": {
  16033. syntax: "luminance | alpha",
  16034. media: "visual",
  16035. inherited: false,
  16036. animationType: "discrete",
  16037. percentages: "no",
  16038. groups: [
  16039. "CSS Masking"
  16040. ],
  16041. initial: "alpha",
  16042. appliesto: "allElementsSVGContainerElements",
  16043. computed: "asSpecified",
  16044. order: "perGrammar",
  16045. status: "experimental",
  16046. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-mode"
  16047. },
  16048. "mask-border-outset": {
  16049. syntax: "[ <length> | <number> ]{1,4}",
  16050. media: "visual",
  16051. inherited: false,
  16052. animationType: "discrete",
  16053. percentages: "no",
  16054. groups: [
  16055. "CSS Masking"
  16056. ],
  16057. initial: "0",
  16058. appliesto: "allElementsSVGContainerElements",
  16059. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16060. order: "perGrammar",
  16061. status: "experimental",
  16062. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-outset"
  16063. },
  16064. "mask-border-repeat": {
  16065. syntax: "[ stretch | repeat | round | space ]{1,2}",
  16066. media: "visual",
  16067. inherited: false,
  16068. animationType: "discrete",
  16069. percentages: "no",
  16070. groups: [
  16071. "CSS Masking"
  16072. ],
  16073. initial: "stretch",
  16074. appliesto: "allElementsSVGContainerElements",
  16075. computed: "asSpecified",
  16076. order: "perGrammar",
  16077. status: "experimental",
  16078. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-repeat"
  16079. },
  16080. "mask-border-slice": {
  16081. syntax: "<number-percentage>{1,4} fill?",
  16082. media: "visual",
  16083. inherited: false,
  16084. animationType: "discrete",
  16085. percentages: "referToSizeOfMaskBorderImage",
  16086. groups: [
  16087. "CSS Masking"
  16088. ],
  16089. initial: "0",
  16090. appliesto: "allElementsSVGContainerElements",
  16091. computed: "asSpecified",
  16092. order: "perGrammar",
  16093. status: "experimental",
  16094. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-slice"
  16095. },
  16096. "mask-border-source": {
  16097. syntax: "none | <image>",
  16098. media: "visual",
  16099. inherited: false,
  16100. animationType: "discrete",
  16101. percentages: "no",
  16102. groups: [
  16103. "CSS Masking"
  16104. ],
  16105. initial: "none",
  16106. appliesto: "allElementsSVGContainerElements",
  16107. computed: "asSpecifiedURLsAbsolute",
  16108. order: "perGrammar",
  16109. status: "experimental",
  16110. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-source"
  16111. },
  16112. "mask-border-width": {
  16113. syntax: "[ <length-percentage> | <number> | auto ]{1,4}",
  16114. media: "visual",
  16115. inherited: false,
  16116. animationType: "discrete",
  16117. percentages: "relativeToMaskBorderImageArea",
  16118. groups: [
  16119. "CSS Masking"
  16120. ],
  16121. initial: "auto",
  16122. appliesto: "allElementsSVGContainerElements",
  16123. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16124. order: "perGrammar",
  16125. status: "experimental",
  16126. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-width"
  16127. },
  16128. "mask-clip": {
  16129. syntax: "[ <geometry-box> | no-clip ]#",
  16130. media: "visual",
  16131. inherited: false,
  16132. animationType: "discrete",
  16133. percentages: "no",
  16134. groups: [
  16135. "CSS Masking"
  16136. ],
  16137. initial: "border-box",
  16138. appliesto: "allElementsSVGContainerElements",
  16139. computed: "asSpecified",
  16140. order: "perGrammar",
  16141. status: "standard",
  16142. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-clip"
  16143. },
  16144. "mask-composite": {
  16145. syntax: "<compositing-operator>#",
  16146. media: "visual",
  16147. inherited: false,
  16148. animationType: "discrete",
  16149. percentages: "no",
  16150. groups: [
  16151. "CSS Masking"
  16152. ],
  16153. initial: "add",
  16154. appliesto: "allElementsSVGContainerElements",
  16155. computed: "asSpecified",
  16156. order: "perGrammar",
  16157. status: "standard",
  16158. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-composite"
  16159. },
  16160. "mask-image": {
  16161. syntax: "<mask-reference>#",
  16162. media: "visual",
  16163. inherited: false,
  16164. animationType: "discrete",
  16165. percentages: "no",
  16166. groups: [
  16167. "CSS Masking"
  16168. ],
  16169. initial: "none",
  16170. appliesto: "allElementsSVGContainerElements",
  16171. computed: "asSpecifiedURLsAbsolute",
  16172. order: "perGrammar",
  16173. status: "standard",
  16174. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-image"
  16175. },
  16176. "mask-mode": {
  16177. syntax: "<masking-mode>#",
  16178. media: "visual",
  16179. inherited: false,
  16180. animationType: "discrete",
  16181. percentages: "no",
  16182. groups: [
  16183. "CSS Masking"
  16184. ],
  16185. initial: "match-source",
  16186. appliesto: "allElementsSVGContainerElements",
  16187. computed: "asSpecified",
  16188. order: "perGrammar",
  16189. status: "standard",
  16190. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-mode"
  16191. },
  16192. "mask-origin": {
  16193. syntax: "<geometry-box>#",
  16194. media: "visual",
  16195. inherited: false,
  16196. animationType: "discrete",
  16197. percentages: "no",
  16198. groups: [
  16199. "CSS Masking"
  16200. ],
  16201. initial: "border-box",
  16202. appliesto: "allElementsSVGContainerElements",
  16203. computed: "asSpecified",
  16204. order: "perGrammar",
  16205. status: "standard",
  16206. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-origin"
  16207. },
  16208. "mask-position": {
  16209. syntax: "<position>#",
  16210. media: "visual",
  16211. inherited: false,
  16212. animationType: "repeatableListOfSimpleListOfLpc",
  16213. percentages: "referToSizeOfMaskPaintingArea",
  16214. groups: [
  16215. "CSS Masking"
  16216. ],
  16217. initial: "center",
  16218. appliesto: "allElementsSVGContainerElements",
  16219. computed: "consistsOfTwoKeywordsForOriginAndOffsets",
  16220. order: "perGrammar",
  16221. status: "standard",
  16222. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-position"
  16223. },
  16224. "mask-repeat": {
  16225. syntax: "<repeat-style>#",
  16226. media: "visual",
  16227. inherited: false,
  16228. animationType: "discrete",
  16229. percentages: "no",
  16230. groups: [
  16231. "CSS Masking"
  16232. ],
  16233. initial: "no-repeat",
  16234. appliesto: "allElementsSVGContainerElements",
  16235. computed: "consistsOfTwoDimensionKeywords",
  16236. order: "perGrammar",
  16237. status: "standard",
  16238. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-repeat"
  16239. },
  16240. "mask-size": {
  16241. syntax: "<bg-size>#",
  16242. media: "visual",
  16243. inherited: false,
  16244. animationType: "repeatableListOfSimpleListOfLpc",
  16245. percentages: "no",
  16246. groups: [
  16247. "CSS Masking"
  16248. ],
  16249. initial: "auto",
  16250. appliesto: "allElementsSVGContainerElements",
  16251. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16252. order: "perGrammar",
  16253. status: "standard",
  16254. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-size"
  16255. },
  16256. "mask-type": {
  16257. syntax: "luminance | alpha",
  16258. media: "visual",
  16259. inherited: false,
  16260. animationType: "discrete",
  16261. percentages: "no",
  16262. groups: [
  16263. "CSS Masking"
  16264. ],
  16265. initial: "luminance",
  16266. appliesto: "maskElements",
  16267. computed: "asSpecified",
  16268. order: "perGrammar",
  16269. status: "standard",
  16270. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-type"
  16271. },
  16272. "max-block-size": {
  16273. syntax: "<'max-width'>",
  16274. media: "visual",
  16275. inherited: false,
  16276. animationType: "discrete",
  16277. percentages: "blockSizeOfContainingBlock",
  16278. groups: [
  16279. "CSS Logical Properties"
  16280. ],
  16281. initial: "0",
  16282. appliesto: "sameAsWidthAndHeight",
  16283. computed: "sameAsMaxWidthAndMaxHeight",
  16284. order: "uniqueOrder",
  16285. status: "experimental",
  16286. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-block-size"
  16287. },
  16288. "max-height": {
  16289. syntax: "<length> | <percentage> | none | max-content | min-content | fit-content | fill-available",
  16290. media: "visual",
  16291. inherited: false,
  16292. animationType: "lpc",
  16293. percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentagesNone",
  16294. groups: [
  16295. "CSS Box Model"
  16296. ],
  16297. initial: "none",
  16298. appliesto: "allElementsButNonReplacedAndTableColumns",
  16299. computed: "percentageAsSpecifiedAbsoluteLengthOrNone",
  16300. order: "uniqueOrder",
  16301. status: "standard",
  16302. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-height"
  16303. },
  16304. "max-inline-size": {
  16305. syntax: "<'max-width'>",
  16306. media: "visual",
  16307. inherited: false,
  16308. animationType: "discrete",
  16309. percentages: "inlineSizeOfContainingBlock",
  16310. groups: [
  16311. "CSS Logical Properties"
  16312. ],
  16313. initial: "0",
  16314. appliesto: "sameAsWidthAndHeight",
  16315. computed: "sameAsMaxWidthAndMaxHeight",
  16316. order: "uniqueOrder",
  16317. status: "experimental",
  16318. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-inline-size"
  16319. },
  16320. "max-lines": {
  16321. syntax: "none | <integer>",
  16322. media: "visual",
  16323. inherited: false,
  16324. animationType: "integer",
  16325. percentages: "no",
  16326. groups: [
  16327. "CSS Overflow"
  16328. ],
  16329. initial: "none",
  16330. appliesto: "blockContainersExceptMultiColumnContainers",
  16331. computed: "asSpecified",
  16332. order: "perGrammar",
  16333. status: "experimental"
  16334. },
  16335. "max-width": {
  16336. syntax: "<length> | <percentage> | none | max-content | min-content | fit-content | fill-available",
  16337. media: "visual",
  16338. inherited: false,
  16339. animationType: "lpc",
  16340. percentages: "referToWidthOfContainingBlock",
  16341. groups: [
  16342. "CSS Box Model"
  16343. ],
  16344. initial: "none",
  16345. appliesto: "allElementsButNonReplacedAndTableRows",
  16346. computed: "percentageAsSpecifiedAbsoluteLengthOrNone",
  16347. order: "uniqueOrder",
  16348. status: "standard",
  16349. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-width"
  16350. },
  16351. "min-block-size": {
  16352. syntax: "<'min-width'>",
  16353. media: "visual",
  16354. inherited: false,
  16355. animationType: "discrete",
  16356. percentages: "blockSizeOfContainingBlock",
  16357. groups: [
  16358. "CSS Logical Properties"
  16359. ],
  16360. initial: "0",
  16361. appliesto: "sameAsWidthAndHeight",
  16362. computed: "sameAsMinWidthAndMinHeight",
  16363. order: "uniqueOrder",
  16364. status: "standard",
  16365. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-block-size"
  16366. },
  16367. "min-height": {
  16368. syntax: "<length> | <percentage> | auto | max-content | min-content | fit-content | fill-available",
  16369. media: "visual",
  16370. inherited: false,
  16371. animationType: "lpc",
  16372. percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentages0",
  16373. groups: [
  16374. "CSS Box Model"
  16375. ],
  16376. initial: "auto",
  16377. appliesto: "allElementsButNonReplacedAndTableColumns",
  16378. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16379. order: "uniqueOrder",
  16380. status: "standard",
  16381. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-height"
  16382. },
  16383. "min-inline-size": {
  16384. syntax: "<'min-width'>",
  16385. media: "visual",
  16386. inherited: false,
  16387. animationType: "discrete",
  16388. percentages: "inlineSizeOfContainingBlock",
  16389. groups: [
  16390. "CSS Logical Properties"
  16391. ],
  16392. initial: "0",
  16393. appliesto: "sameAsWidthAndHeight",
  16394. computed: "sameAsMinWidthAndMinHeight",
  16395. order: "uniqueOrder",
  16396. status: "standard",
  16397. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-inline-size"
  16398. },
  16399. "min-width": {
  16400. syntax: "<length> | <percentage> | auto | max-content | min-content | fit-content | fill-available",
  16401. media: "visual",
  16402. inherited: false,
  16403. animationType: "lpc",
  16404. percentages: "referToWidthOfContainingBlock",
  16405. groups: [
  16406. "CSS Box Model"
  16407. ],
  16408. initial: "auto",
  16409. appliesto: "allElementsButNonReplacedAndTableRows",
  16410. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16411. order: "uniqueOrder",
  16412. status: "standard",
  16413. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-width"
  16414. },
  16415. "mix-blend-mode": {
  16416. syntax: "<blend-mode>",
  16417. media: "visual",
  16418. inherited: false,
  16419. animationType: "discrete",
  16420. percentages: "no",
  16421. groups: [
  16422. "Compositing and Blending"
  16423. ],
  16424. initial: "normal",
  16425. appliesto: "allElements",
  16426. computed: "asSpecified",
  16427. order: "uniqueOrder",
  16428. stacking: true,
  16429. status: "standard",
  16430. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mix-blend-mode"
  16431. },
  16432. "object-fit": {
  16433. syntax: "fill | contain | cover | none | scale-down",
  16434. media: "visual",
  16435. inherited: false,
  16436. animationType: "discrete",
  16437. percentages: "no",
  16438. groups: [
  16439. "CSS Images"
  16440. ],
  16441. initial: "fill",
  16442. appliesto: "replacedElements",
  16443. computed: "asSpecified",
  16444. order: "uniqueOrder",
  16445. status: "standard",
  16446. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/object-fit"
  16447. },
  16448. "object-position": {
  16449. syntax: "<position>",
  16450. media: "visual",
  16451. inherited: true,
  16452. animationType: "repeatableListOfSimpleListOfLpc",
  16453. percentages: "referToWidthAndHeightOfElement",
  16454. groups: [
  16455. "CSS Images"
  16456. ],
  16457. initial: "50% 50%",
  16458. appliesto: "replacedElements",
  16459. computed: "asSpecified",
  16460. order: "uniqueOrder",
  16461. status: "standard",
  16462. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/object-position"
  16463. },
  16464. offset: offset,
  16465. "offset-anchor": {
  16466. syntax: "auto | <position>",
  16467. media: "visual",
  16468. inherited: false,
  16469. animationType: "position",
  16470. percentages: "relativeToWidthAndHeight",
  16471. groups: [
  16472. "CSS Motion Path"
  16473. ],
  16474. initial: "auto",
  16475. appliesto: "transformableElements",
  16476. computed: "forLengthAbsoluteValueOtherwisePercentage",
  16477. order: "perGrammar",
  16478. status: "experimental"
  16479. },
  16480. "offset-distance": {
  16481. syntax: "<length-percentage>",
  16482. media: "visual",
  16483. inherited: false,
  16484. animationType: "lpc",
  16485. percentages: "referToTotalPathLength",
  16486. groups: [
  16487. "CSS Motion Path"
  16488. ],
  16489. initial: "0",
  16490. appliesto: "transformableElements",
  16491. computed: "forLengthAbsoluteValueOtherwisePercentage",
  16492. order: "perGrammar",
  16493. status: "experimental",
  16494. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-distance"
  16495. },
  16496. "offset-path": {
  16497. syntax: "none | ray( [ <angle> && <size>? && contain? ] ) | <path()> | <url> | [ <basic-shape> || <geometry-box> ]",
  16498. media: "visual",
  16499. inherited: false,
  16500. animationType: "angleOrBasicShapeOrPath",
  16501. percentages: "no",
  16502. groups: [
  16503. "CSS Motion Path"
  16504. ],
  16505. initial: "none",
  16506. appliesto: "transformableElements",
  16507. computed: "asSpecified",
  16508. order: "perGrammar",
  16509. stacking: true,
  16510. status: "experimental",
  16511. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-path"
  16512. },
  16513. "offset-position": {
  16514. syntax: "auto | <position>",
  16515. media: "visual",
  16516. inherited: false,
  16517. animationType: "position",
  16518. percentages: "referToSizeOfContainingBlock",
  16519. groups: [
  16520. "CSS Motion Path"
  16521. ],
  16522. initial: "auto",
  16523. appliesto: "transformableElements",
  16524. computed: "forLengthAbsoluteValueOtherwisePercentage",
  16525. order: "perGrammar",
  16526. status: "experimental"
  16527. },
  16528. "offset-rotate": {
  16529. syntax: "[ auto | reverse ] || <angle>",
  16530. media: "visual",
  16531. inherited: false,
  16532. animationType: "angleOrBasicShapeOrPath",
  16533. percentages: "no",
  16534. groups: [
  16535. "CSS Motion Path"
  16536. ],
  16537. initial: "auto",
  16538. appliesto: "transformableElements",
  16539. computed: "asSpecified",
  16540. order: "perGrammar",
  16541. status: "experimental",
  16542. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-rotate"
  16543. },
  16544. opacity: opacity,
  16545. order: order,
  16546. orphans: orphans,
  16547. outline: outline,
  16548. "outline-color": {
  16549. syntax: "<color> | invert",
  16550. media: [
  16551. "visual",
  16552. "interactive"
  16553. ],
  16554. inherited: false,
  16555. animationType: "color",
  16556. percentages: "no",
  16557. groups: [
  16558. "CSS Basic User Interface"
  16559. ],
  16560. initial: "invertOrCurrentColor",
  16561. appliesto: "allElements",
  16562. computed: "invertForTranslucentColorRGBAOtherwiseRGB",
  16563. order: "uniqueOrder",
  16564. status: "standard",
  16565. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-color"
  16566. },
  16567. "outline-offset": {
  16568. syntax: "<length>",
  16569. media: [
  16570. "visual",
  16571. "interactive"
  16572. ],
  16573. inherited: false,
  16574. animationType: "length",
  16575. percentages: "no",
  16576. groups: [
  16577. "CSS Basic User Interface"
  16578. ],
  16579. initial: "0",
  16580. appliesto: "allElements",
  16581. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16582. order: "uniqueOrder",
  16583. status: "standard",
  16584. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-offset"
  16585. },
  16586. "outline-style": {
  16587. syntax: "auto | <'border-style'>",
  16588. media: [
  16589. "visual",
  16590. "interactive"
  16591. ],
  16592. inherited: false,
  16593. animationType: "discrete",
  16594. percentages: "no",
  16595. groups: [
  16596. "CSS Basic User Interface"
  16597. ],
  16598. initial: "none",
  16599. appliesto: "allElements",
  16600. computed: "asSpecified",
  16601. order: "uniqueOrder",
  16602. status: "standard",
  16603. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-style"
  16604. },
  16605. "outline-width": {
  16606. syntax: "<line-width>",
  16607. media: [
  16608. "visual",
  16609. "interactive"
  16610. ],
  16611. inherited: false,
  16612. animationType: "length",
  16613. percentages: "no",
  16614. groups: [
  16615. "CSS Basic User Interface"
  16616. ],
  16617. initial: "medium",
  16618. appliesto: "allElements",
  16619. computed: "absoluteLength0ForNone",
  16620. order: "uniqueOrder",
  16621. status: "standard",
  16622. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-width"
  16623. },
  16624. overflow: overflow,
  16625. "overflow-anchor": {
  16626. syntax: "auto | none",
  16627. media: "visual",
  16628. inherited: false,
  16629. animationType: "discrete",
  16630. percentages: "no",
  16631. groups: [
  16632. "CSS Scroll Anchoring"
  16633. ],
  16634. initial: "auto",
  16635. appliesto: "allElements",
  16636. computed: "asSpecified",
  16637. order: "perGrammar",
  16638. status: "experimental"
  16639. },
  16640. "overflow-block": {
  16641. syntax: "visible | hidden | clip | scroll | auto",
  16642. media: "visual",
  16643. inherited: false,
  16644. animationType: "discrete",
  16645. percentages: "no",
  16646. groups: [
  16647. "CSS Overflow"
  16648. ],
  16649. initial: "auto",
  16650. appliesto: "blockContainersFlexContainersGridContainers",
  16651. computed: "asSpecified",
  16652. order: "perGrammar",
  16653. status: "experimental"
  16654. },
  16655. "overflow-clip-box": {
  16656. syntax: "padding-box | content-box",
  16657. media: "visual",
  16658. inherited: false,
  16659. animationType: "discrete",
  16660. percentages: "no",
  16661. groups: [
  16662. "Mozilla Extensions"
  16663. ],
  16664. initial: "padding-box",
  16665. appliesto: "allElements",
  16666. computed: "asSpecified",
  16667. order: "uniqueOrder",
  16668. status: "nonstandard",
  16669. mdn_url: "https://developer.mozilla.org/docs/Mozilla/CSS/overflow-clip-box"
  16670. },
  16671. "overflow-inline": {
  16672. syntax: "visible | hidden | clip | scroll | auto",
  16673. media: "visual",
  16674. inherited: false,
  16675. animationType: "discrete",
  16676. percentages: "no",
  16677. groups: [
  16678. "CSS Overflow"
  16679. ],
  16680. initial: "auto",
  16681. appliesto: "blockContainersFlexContainersGridContainers",
  16682. computed: "asSpecified",
  16683. order: "perGrammar",
  16684. status: "experimental"
  16685. },
  16686. "overflow-wrap": {
  16687. syntax: "normal | break-word | anywhere",
  16688. media: "visual",
  16689. inherited: true,
  16690. animationType: "discrete",
  16691. percentages: "no",
  16692. groups: [
  16693. "CSS Text"
  16694. ],
  16695. initial: "normal",
  16696. appliesto: "nonReplacedInlineElements",
  16697. computed: "asSpecified",
  16698. order: "uniqueOrder",
  16699. status: "standard",
  16700. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-wrap"
  16701. },
  16702. "overflow-x": {
  16703. syntax: "visible | hidden | clip | scroll | auto",
  16704. media: "visual",
  16705. inherited: false,
  16706. animationType: "discrete",
  16707. percentages: "no",
  16708. groups: [
  16709. "CSS Overflow"
  16710. ],
  16711. initial: "visible",
  16712. appliesto: "blockContainersFlexContainersGridContainers",
  16713. computed: "asSpecified",
  16714. order: "uniqueOrder",
  16715. status: "standard",
  16716. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-x"
  16717. },
  16718. "overflow-y": {
  16719. syntax: "visible | hidden | clip | scroll | auto",
  16720. media: "visual",
  16721. inherited: false,
  16722. animationType: "discrete",
  16723. percentages: "no",
  16724. groups: [
  16725. "CSS Overflow"
  16726. ],
  16727. initial: "visible",
  16728. appliesto: "blockContainersFlexContainersGridContainers",
  16729. computed: "asSpecified",
  16730. order: "uniqueOrder",
  16731. status: "standard",
  16732. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-y"
  16733. },
  16734. "overscroll-behavior": {
  16735. syntax: "[ contain | none | auto ]{1,2}",
  16736. media: "visual",
  16737. inherited: false,
  16738. animationType: "discrete",
  16739. percentages: "no",
  16740. groups: [
  16741. "CSS Box Model"
  16742. ],
  16743. initial: "auto",
  16744. appliesto: "nonReplacedBlockAndInlineBlockElements",
  16745. computed: "asSpecified",
  16746. order: "uniqueOrder",
  16747. status: "nonstandard",
  16748. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior"
  16749. },
  16750. "overscroll-behavior-x": {
  16751. syntax: "contain | none | auto",
  16752. media: "visual",
  16753. inherited: false,
  16754. animationType: "discrete",
  16755. percentages: "no",
  16756. groups: [
  16757. "CSS Box Model"
  16758. ],
  16759. initial: "auto",
  16760. appliesto: "nonReplacedBlockAndInlineBlockElements",
  16761. computed: "asSpecified",
  16762. order: "uniqueOrder",
  16763. status: "nonstandard",
  16764. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-x"
  16765. },
  16766. "overscroll-behavior-y": {
  16767. syntax: "contain | none | auto",
  16768. media: "visual",
  16769. inherited: false,
  16770. animationType: "discrete",
  16771. percentages: "no",
  16772. groups: [
  16773. "CSS Box Model"
  16774. ],
  16775. initial: "auto",
  16776. appliesto: "nonReplacedBlockAndInlineBlockElements",
  16777. computed: "asSpecified",
  16778. order: "uniqueOrder",
  16779. status: "nonstandard",
  16780. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-y"
  16781. },
  16782. padding: padding,
  16783. "padding-block": {
  16784. syntax: "<'padding-left'>{1,2}",
  16785. media: "visual",
  16786. inherited: false,
  16787. animationType: "discrete",
  16788. percentages: "logicalWidthOfContainingBlock",
  16789. groups: [
  16790. "CSS Logical Properties"
  16791. ],
  16792. initial: "0",
  16793. appliesto: "allElements",
  16794. computed: "asLength",
  16795. order: "uniqueOrder",
  16796. status: "standard",
  16797. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block"
  16798. },
  16799. "padding-block-end": {
  16800. syntax: "<'padding-left'>",
  16801. media: "visual",
  16802. inherited: false,
  16803. animationType: "discrete",
  16804. percentages: "logicalWidthOfContainingBlock",
  16805. groups: [
  16806. "CSS Logical Properties"
  16807. ],
  16808. initial: "0",
  16809. appliesto: "allElements",
  16810. computed: "asLength",
  16811. order: "uniqueOrder",
  16812. status: "standard",
  16813. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block-end"
  16814. },
  16815. "padding-block-start": {
  16816. syntax: "<'padding-left'>",
  16817. media: "visual",
  16818. inherited: false,
  16819. animationType: "discrete",
  16820. percentages: "logicalWidthOfContainingBlock",
  16821. groups: [
  16822. "CSS Logical Properties"
  16823. ],
  16824. initial: "0",
  16825. appliesto: "allElements",
  16826. computed: "asLength",
  16827. order: "uniqueOrder",
  16828. status: "standard",
  16829. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block-start"
  16830. },
  16831. "padding-bottom": {
  16832. syntax: "<length> | <percentage>",
  16833. media: "visual",
  16834. inherited: false,
  16835. animationType: "length",
  16836. percentages: "referToWidthOfContainingBlock",
  16837. groups: [
  16838. "CSS Box Model"
  16839. ],
  16840. initial: "0",
  16841. appliesto: "allElementsExceptInternalTableDisplayTypes",
  16842. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16843. order: "uniqueOrder",
  16844. alsoAppliesTo: [
  16845. "::first-letter"
  16846. ],
  16847. status: "standard",
  16848. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-bottom"
  16849. },
  16850. "padding-inline": {
  16851. syntax: "<'padding-left'>{1,2}",
  16852. media: "visual",
  16853. inherited: false,
  16854. animationType: "discrete",
  16855. percentages: "logicalWidthOfContainingBlock",
  16856. groups: [
  16857. "CSS Logical Properties"
  16858. ],
  16859. initial: "0",
  16860. appliesto: "allElements",
  16861. computed: "asLength",
  16862. order: "uniqueOrder",
  16863. status: "standard",
  16864. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline"
  16865. },
  16866. "padding-inline-end": {
  16867. syntax: "<'padding-left'>",
  16868. media: "visual",
  16869. inherited: false,
  16870. animationType: "discrete",
  16871. percentages: "logicalWidthOfContainingBlock",
  16872. groups: [
  16873. "CSS Logical Properties"
  16874. ],
  16875. initial: "0",
  16876. appliesto: "allElements",
  16877. computed: "asLength",
  16878. order: "uniqueOrder",
  16879. status: "standard",
  16880. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline-end"
  16881. },
  16882. "padding-inline-start": {
  16883. syntax: "<'padding-left'>",
  16884. media: "visual",
  16885. inherited: false,
  16886. animationType: "discrete",
  16887. percentages: "logicalWidthOfContainingBlock",
  16888. groups: [
  16889. "CSS Logical Properties"
  16890. ],
  16891. initial: "0",
  16892. appliesto: "allElements",
  16893. computed: "asLength",
  16894. order: "uniqueOrder",
  16895. status: "standard",
  16896. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline-start"
  16897. },
  16898. "padding-left": {
  16899. syntax: "<length> | <percentage>",
  16900. media: "visual",
  16901. inherited: false,
  16902. animationType: "length",
  16903. percentages: "referToWidthOfContainingBlock",
  16904. groups: [
  16905. "CSS Box Model"
  16906. ],
  16907. initial: "0",
  16908. appliesto: "allElementsExceptInternalTableDisplayTypes",
  16909. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16910. order: "uniqueOrder",
  16911. alsoAppliesTo: [
  16912. "::first-letter"
  16913. ],
  16914. status: "standard",
  16915. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-left"
  16916. },
  16917. "padding-right": {
  16918. syntax: "<length> | <percentage>",
  16919. media: "visual",
  16920. inherited: false,
  16921. animationType: "length",
  16922. percentages: "referToWidthOfContainingBlock",
  16923. groups: [
  16924. "CSS Box Model"
  16925. ],
  16926. initial: "0",
  16927. appliesto: "allElementsExceptInternalTableDisplayTypes",
  16928. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16929. order: "uniqueOrder",
  16930. alsoAppliesTo: [
  16931. "::first-letter"
  16932. ],
  16933. status: "standard",
  16934. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-right"
  16935. },
  16936. "padding-top": {
  16937. syntax: "<length> | <percentage>",
  16938. media: "visual",
  16939. inherited: false,
  16940. animationType: "length",
  16941. percentages: "referToWidthOfContainingBlock",
  16942. groups: [
  16943. "CSS Box Model"
  16944. ],
  16945. initial: "0",
  16946. appliesto: "allElementsExceptInternalTableDisplayTypes",
  16947. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16948. order: "uniqueOrder",
  16949. alsoAppliesTo: [
  16950. "::first-letter"
  16951. ],
  16952. status: "standard",
  16953. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-top"
  16954. },
  16955. "page-break-after": {
  16956. syntax: "auto | always | avoid | left | right | recto | verso",
  16957. media: [
  16958. "visual",
  16959. "paged"
  16960. ],
  16961. inherited: false,
  16962. animationType: "discrete",
  16963. percentages: "no",
  16964. groups: [
  16965. "CSS Pages"
  16966. ],
  16967. initial: "auto",
  16968. appliesto: "blockElementsInNormalFlow",
  16969. computed: "asSpecified",
  16970. order: "uniqueOrder",
  16971. status: "standard",
  16972. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-after"
  16973. },
  16974. "page-break-before": {
  16975. syntax: "auto | always | avoid | left | right | recto | verso",
  16976. media: [
  16977. "visual",
  16978. "paged"
  16979. ],
  16980. inherited: false,
  16981. animationType: "discrete",
  16982. percentages: "no",
  16983. groups: [
  16984. "CSS Pages"
  16985. ],
  16986. initial: "auto",
  16987. appliesto: "blockElementsInNormalFlow",
  16988. computed: "asSpecified",
  16989. order: "uniqueOrder",
  16990. status: "standard",
  16991. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-before"
  16992. },
  16993. "page-break-inside": {
  16994. syntax: "auto | avoid",
  16995. media: [
  16996. "visual",
  16997. "paged"
  16998. ],
  16999. inherited: false,
  17000. animationType: "discrete",
  17001. percentages: "no",
  17002. groups: [
  17003. "CSS Pages"
  17004. ],
  17005. initial: "auto",
  17006. appliesto: "blockElementsInNormalFlow",
  17007. computed: "asSpecified",
  17008. order: "uniqueOrder",
  17009. status: "standard",
  17010. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-inside"
  17011. },
  17012. "paint-order": {
  17013. syntax: "normal | [ fill || stroke || markers ]",
  17014. media: "visual",
  17015. inherited: true,
  17016. animationType: "discrete",
  17017. percentages: "no",
  17018. groups: [
  17019. "CSS Text"
  17020. ],
  17021. initial: "normal",
  17022. appliesto: "textElements",
  17023. computed: "asSpecified",
  17024. order: "uniqueOrder",
  17025. status: "experimental",
  17026. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/paint-order"
  17027. },
  17028. perspective: perspective,
  17029. "perspective-origin": {
  17030. syntax: "<position>",
  17031. media: "visual",
  17032. inherited: false,
  17033. animationType: "simpleListOfLpc",
  17034. percentages: "referToSizeOfBoundingBox",
  17035. groups: [
  17036. "CSS Transforms"
  17037. ],
  17038. initial: "50% 50%",
  17039. appliesto: "transformableElements",
  17040. computed: "forLengthAbsoluteValueOtherwisePercentage",
  17041. order: "oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
  17042. status: "standard",
  17043. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/perspective-origin"
  17044. },
  17045. "place-content": {
  17046. syntax: "<'align-content'> <'justify-content'>?",
  17047. media: "visual",
  17048. inherited: false,
  17049. animationType: "discrete",
  17050. percentages: "no",
  17051. groups: [
  17052. "CSS Box Alignment"
  17053. ],
  17054. initial: "normal",
  17055. appliesto: "multilineFlexContainers",
  17056. computed: "asSpecified",
  17057. order: "uniqueOrder",
  17058. status: "standard",
  17059. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-content"
  17060. },
  17061. "place-items": {
  17062. syntax: "<'align-items'> <'justify-items'>?",
  17063. media: "visual",
  17064. inherited: false,
  17065. animationType: "discrete",
  17066. percentages: "no",
  17067. groups: [
  17068. "CSS Box Alignment"
  17069. ],
  17070. initial: [
  17071. "align-items",
  17072. "justify-items"
  17073. ],
  17074. appliesto: "allElements",
  17075. computed: [
  17076. "align-items",
  17077. "justify-items"
  17078. ],
  17079. order: "uniqueOrder",
  17080. status: "standard",
  17081. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-items"
  17082. },
  17083. "place-self": {
  17084. syntax: "<'align-self'> <'justify-self'>?",
  17085. media: "visual",
  17086. inherited: false,
  17087. animationType: "discrete",
  17088. percentages: "no",
  17089. groups: [
  17090. "CSS Box Alignment"
  17091. ],
  17092. initial: [
  17093. "align-self",
  17094. "justify-self"
  17095. ],
  17096. appliesto: "blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems",
  17097. computed: [
  17098. "align-self",
  17099. "justify-self"
  17100. ],
  17101. order: "uniqueOrder",
  17102. status: "standard",
  17103. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-self"
  17104. },
  17105. "pointer-events": {
  17106. syntax: "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit",
  17107. media: "visual",
  17108. inherited: true,
  17109. animationType: "discrete",
  17110. percentages: "no",
  17111. groups: [
  17112. "Pointer Events"
  17113. ],
  17114. initial: "auto",
  17115. appliesto: "allElements",
  17116. computed: "asSpecified",
  17117. order: "uniqueOrder",
  17118. status: "standard",
  17119. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/pointer-events"
  17120. },
  17121. position: position,
  17122. quotes: quotes,
  17123. resize: resize,
  17124. right: right,
  17125. rotate: rotate,
  17126. "row-gap": {
  17127. syntax: "normal | <length-percentage>",
  17128. media: "visual",
  17129. inherited: false,
  17130. animationType: "lpc",
  17131. percentages: "referToDimensionOfContentArea",
  17132. groups: [
  17133. "CSS Box Alignment"
  17134. ],
  17135. initial: "normal",
  17136. appliesto: "multiColumnElementsFlexContainersGridContainers",
  17137. computed: "asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
  17138. order: "perGrammar",
  17139. status: "standard",
  17140. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/row-gap"
  17141. },
  17142. "ruby-align": {
  17143. syntax: "start | center | space-between | space-around",
  17144. media: "visual",
  17145. inherited: true,
  17146. animationType: "discrete",
  17147. percentages: "no",
  17148. groups: [
  17149. "CSS Ruby"
  17150. ],
  17151. initial: "space-around",
  17152. appliesto: "rubyBasesAnnotationsBaseAnnotationContainers",
  17153. computed: "asSpecified",
  17154. order: "uniqueOrder",
  17155. status: "experimental",
  17156. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ruby-align"
  17157. },
  17158. "ruby-merge": {
  17159. syntax: "separate | collapse | auto",
  17160. media: "visual",
  17161. inherited: true,
  17162. animationType: "discrete",
  17163. percentages: "no",
  17164. groups: [
  17165. "CSS Ruby"
  17166. ],
  17167. initial: "separate",
  17168. appliesto: "rubyAnnotationsContainers",
  17169. computed: "asSpecified",
  17170. order: "uniqueOrder",
  17171. status: "experimental"
  17172. },
  17173. "ruby-position": {
  17174. syntax: "over | under | inter-character",
  17175. media: "visual",
  17176. inherited: true,
  17177. animationType: "discrete",
  17178. percentages: "no",
  17179. groups: [
  17180. "CSS Ruby"
  17181. ],
  17182. initial: "over",
  17183. appliesto: "rubyAnnotationsContainers",
  17184. computed: "asSpecified",
  17185. order: "uniqueOrder",
  17186. status: "experimental",
  17187. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ruby-position"
  17188. },
  17189. scale: scale,
  17190. "scrollbar-color": {
  17191. syntax: "auto | dark | light | <color>{2}",
  17192. media: "visual",
  17193. inherited: true,
  17194. animationType: "color",
  17195. percentages: "no",
  17196. groups: [
  17197. "CSS Scrollbars"
  17198. ],
  17199. initial: "auto",
  17200. appliesto: "scrollingBoxes",
  17201. computed: "asSpecified",
  17202. order: "perGrammar",
  17203. status: "standard",
  17204. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-color"
  17205. },
  17206. "scrollbar-width": {
  17207. syntax: "auto | thin | none",
  17208. media: "visual",
  17209. inherited: false,
  17210. animationType: "discrete",
  17211. percentages: "no",
  17212. groups: [
  17213. "CSS Scrollbars"
  17214. ],
  17215. initial: "auto",
  17216. appliesto: "scrollingBoxes",
  17217. computed: "asSpecified",
  17218. order: "perGrammar",
  17219. status: "standard",
  17220. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-width"
  17221. },
  17222. "scroll-behavior": {
  17223. syntax: "auto | smooth",
  17224. media: "visual",
  17225. inherited: false,
  17226. animationType: "discrete",
  17227. percentages: "no",
  17228. groups: [
  17229. "CSSOM View"
  17230. ],
  17231. initial: "auto",
  17232. appliesto: "scrollingBoxes",
  17233. computed: "asSpecified",
  17234. order: "uniqueOrder",
  17235. status: "standard",
  17236. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-behavior"
  17237. },
  17238. "scroll-margin": {
  17239. syntax: "<length>{1,4}",
  17240. media: "visual",
  17241. inherited: false,
  17242. animationType: "byComputedValueType",
  17243. percentages: "no",
  17244. groups: [
  17245. "CSS Scroll Snap"
  17246. ],
  17247. initial: "0",
  17248. appliesto: "allElements",
  17249. computed: "asSpecified",
  17250. order: "perGrammar",
  17251. status: "standard",
  17252. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin"
  17253. },
  17254. "scroll-margin-block": {
  17255. syntax: "<length>{1,2}",
  17256. media: "visual",
  17257. inherited: false,
  17258. animationType: "byComputedValueType",
  17259. percentages: "no",
  17260. groups: [
  17261. "CSS Scroll Snap"
  17262. ],
  17263. initial: "0",
  17264. appliesto: "allElements",
  17265. computed: "asSpecified",
  17266. order: "perGrammar",
  17267. status: "standard",
  17268. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block"
  17269. },
  17270. "scroll-margin-block-start": {
  17271. syntax: "<length>",
  17272. media: "visual",
  17273. inherited: false,
  17274. animationType: "byComputedValueType",
  17275. percentages: "no",
  17276. groups: [
  17277. "CSS Scroll Snap"
  17278. ],
  17279. initial: "0",
  17280. appliesto: "allElements",
  17281. computed: "asSpecified",
  17282. order: "perGrammar",
  17283. status: "standard",
  17284. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-start"
  17285. },
  17286. "scroll-margin-block-end": {
  17287. syntax: "<length>",
  17288. media: "visual",
  17289. inherited: false,
  17290. animationType: "byComputedValueType",
  17291. percentages: "no",
  17292. groups: [
  17293. "CSS Scroll Snap"
  17294. ],
  17295. initial: "0",
  17296. appliesto: "allElements",
  17297. computed: "asSpecified",
  17298. order: "perGrammar",
  17299. status: "standard",
  17300. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-end"
  17301. },
  17302. "scroll-margin-bottom": {
  17303. syntax: "<length>",
  17304. media: "visual",
  17305. inherited: false,
  17306. animationType: "byComputedValueType",
  17307. percentages: "no",
  17308. groups: [
  17309. "CSS Scroll Snap"
  17310. ],
  17311. initial: "0",
  17312. appliesto: "allElements",
  17313. computed: "asSpecified",
  17314. order: "perGrammar",
  17315. status: "standard",
  17316. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-bottom"
  17317. },
  17318. "scroll-margin-inline": {
  17319. syntax: "<length>{1,2}",
  17320. media: "visual",
  17321. inherited: false,
  17322. animationType: "byComputedValueType",
  17323. percentages: "no",
  17324. groups: [
  17325. "CSS Scroll Snap"
  17326. ],
  17327. initial: "0",
  17328. appliesto: "allElements",
  17329. computed: "asSpecified",
  17330. order: "perGrammar",
  17331. status: "standard",
  17332. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline"
  17333. },
  17334. "scroll-margin-inline-start": {
  17335. syntax: "<length>",
  17336. media: "visual",
  17337. inherited: false,
  17338. animationType: "byComputedValueType",
  17339. percentages: "no",
  17340. groups: [
  17341. "CSS Scroll Snap"
  17342. ],
  17343. initial: "0",
  17344. appliesto: "allElements",
  17345. computed: "asSpecified",
  17346. order: "perGrammar",
  17347. status: "standard",
  17348. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-start"
  17349. },
  17350. "scroll-margin-inline-end": {
  17351. syntax: "<length>",
  17352. media: "visual",
  17353. inherited: false,
  17354. animationType: "byComputedValueType",
  17355. percentages: "no",
  17356. groups: [
  17357. "CSS Scroll Snap"
  17358. ],
  17359. initial: "0",
  17360. appliesto: "allElements",
  17361. computed: "asSpecified",
  17362. order: "perGrammar",
  17363. status: "standard",
  17364. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-end"
  17365. },
  17366. "scroll-margin-left": {
  17367. syntax: "<length>",
  17368. media: "visual",
  17369. inherited: false,
  17370. animationType: "byComputedValueType",
  17371. percentages: "no",
  17372. groups: [
  17373. "CSS Scroll Snap"
  17374. ],
  17375. initial: "0",
  17376. appliesto: "allElements",
  17377. computed: "asSpecified",
  17378. order: "perGrammar",
  17379. status: "standard",
  17380. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-left"
  17381. },
  17382. "scroll-margin-right": {
  17383. syntax: "<length>",
  17384. media: "visual",
  17385. inherited: false,
  17386. animationType: "byComputedValueType",
  17387. percentages: "no",
  17388. groups: [
  17389. "CSS Scroll Snap"
  17390. ],
  17391. initial: "0",
  17392. appliesto: "allElements",
  17393. computed: "asSpecified",
  17394. order: "perGrammar",
  17395. status: "standard",
  17396. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-right"
  17397. },
  17398. "scroll-margin-top": {
  17399. syntax: "<length>",
  17400. media: "visual",
  17401. inherited: false,
  17402. animationType: "byComputedValueType",
  17403. percentages: "no",
  17404. groups: [
  17405. "CSS Scroll Snap"
  17406. ],
  17407. initial: "0",
  17408. appliesto: "allElements",
  17409. computed: "asSpecified",
  17410. order: "perGrammar",
  17411. status: "standard",
  17412. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-top"
  17413. },
  17414. "scroll-padding": {
  17415. syntax: "[ auto | <length-percentage> ]{1,4}",
  17416. media: "visual",
  17417. inherited: false,
  17418. animationType: "byComputedValueType",
  17419. percentages: "relativeToTheScrollContainersScrollport",
  17420. groups: [
  17421. "CSS Scroll Snap"
  17422. ],
  17423. initial: "auto",
  17424. appliesto: "scrollContainers",
  17425. computed: "asSpecified",
  17426. order: "perGrammar",
  17427. status: "standard",
  17428. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding"
  17429. },
  17430. "scroll-padding-block": {
  17431. syntax: "[ auto | <length-percentage> ]{1,2}",
  17432. media: "visual",
  17433. inherited: false,
  17434. animationType: "byComputedValueType",
  17435. percentages: "relativeToTheScrollContainersScrollport",
  17436. groups: [
  17437. "CSS Scroll Snap"
  17438. ],
  17439. initial: "auto",
  17440. appliesto: "scrollContainers",
  17441. computed: "asSpecified",
  17442. order: "perGrammar",
  17443. status: "standard",
  17444. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block"
  17445. },
  17446. "scroll-padding-block-start": {
  17447. syntax: "auto | <length-percentage>",
  17448. media: "visual",
  17449. inherited: false,
  17450. animationType: "byComputedValueType",
  17451. percentages: "relativeToTheScrollContainersScrollport",
  17452. groups: [
  17453. "CSS Scroll Snap"
  17454. ],
  17455. initial: "auto",
  17456. appliesto: "scrollContainers",
  17457. computed: "asSpecified",
  17458. order: "perGrammar",
  17459. status: "standard",
  17460. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-start"
  17461. },
  17462. "scroll-padding-block-end": {
  17463. syntax: "auto | <length-percentage>",
  17464. media: "visual",
  17465. inherited: false,
  17466. animationType: "byComputedValueType",
  17467. percentages: "relativeToTheScrollContainersScrollport",
  17468. groups: [
  17469. "CSS Scroll Snap"
  17470. ],
  17471. initial: "auto",
  17472. appliesto: "scrollContainers",
  17473. computed: "asSpecified",
  17474. order: "perGrammar",
  17475. status: "standard",
  17476. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-end"
  17477. },
  17478. "scroll-padding-bottom": {
  17479. syntax: "auto | <length-percentage>",
  17480. media: "visual",
  17481. inherited: false,
  17482. animationType: "byComputedValueType",
  17483. percentages: "relativeToTheScrollContainersScrollport",
  17484. groups: [
  17485. "CSS Scroll Snap"
  17486. ],
  17487. initial: "auto",
  17488. appliesto: "scrollContainers",
  17489. computed: "asSpecified",
  17490. order: "perGrammar",
  17491. status: "standard",
  17492. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-bottom"
  17493. },
  17494. "scroll-padding-inline": {
  17495. syntax: "[ auto | <length-percentage> ]{1,2}",
  17496. media: "visual",
  17497. inherited: false,
  17498. animationType: "byComputedValueType",
  17499. percentages: "relativeToTheScrollContainersScrollport",
  17500. groups: [
  17501. "CSS Scroll Snap"
  17502. ],
  17503. initial: "auto",
  17504. appliesto: "scrollContainers",
  17505. computed: "asSpecified",
  17506. order: "perGrammar",
  17507. status: "standard",
  17508. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline"
  17509. },
  17510. "scroll-padding-inline-start": {
  17511. syntax: "auto | <length-percentage>",
  17512. media: "visual",
  17513. inherited: false,
  17514. animationType: "byComputedValueType",
  17515. percentages: "relativeToTheScrollContainersScrollport",
  17516. groups: [
  17517. "CSS Scroll Snap"
  17518. ],
  17519. initial: "auto",
  17520. appliesto: "scrollContainers",
  17521. computed: "asSpecified",
  17522. order: "perGrammar",
  17523. status: "standard",
  17524. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-start"
  17525. },
  17526. "scroll-padding-inline-end": {
  17527. syntax: "auto | <length-percentage>",
  17528. media: "visual",
  17529. inherited: false,
  17530. animationType: "byComputedValueType",
  17531. percentages: "relativeToTheScrollContainersScrollport",
  17532. groups: [
  17533. "CSS Scroll Snap"
  17534. ],
  17535. initial: "auto",
  17536. appliesto: "scrollContainers",
  17537. computed: "asSpecified",
  17538. order: "perGrammar",
  17539. status: "standard",
  17540. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-end"
  17541. },
  17542. "scroll-padding-left": {
  17543. syntax: "auto | <length-percentage>",
  17544. media: "visual",
  17545. inherited: false,
  17546. animationType: "byComputedValueType",
  17547. percentages: "relativeToTheScrollContainersScrollport",
  17548. groups: [
  17549. "CSS Scroll Snap"
  17550. ],
  17551. initial: "auto",
  17552. appliesto: "scrollContainers",
  17553. computed: "asSpecified",
  17554. order: "perGrammar",
  17555. status: "standard",
  17556. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-left"
  17557. },
  17558. "scroll-padding-right": {
  17559. syntax: "auto | <length-percentage>",
  17560. media: "visual",
  17561. inherited: false,
  17562. animationType: "byComputedValueType",
  17563. percentages: "relativeToTheScrollContainersScrollport",
  17564. groups: [
  17565. "CSS Scroll Snap"
  17566. ],
  17567. initial: "auto",
  17568. appliesto: "scrollContainers",
  17569. computed: "asSpecified",
  17570. order: "perGrammar",
  17571. status: "standard",
  17572. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-right"
  17573. },
  17574. "scroll-padding-top": {
  17575. syntax: "auto | <length-percentage>",
  17576. media: "visual",
  17577. inherited: false,
  17578. animationType: "byComputedValueType",
  17579. percentages: "relativeToTheScrollContainersScrollport",
  17580. groups: [
  17581. "CSS Scroll Snap"
  17582. ],
  17583. initial: "auto",
  17584. appliesto: "scrollContainers",
  17585. computed: "asSpecified",
  17586. order: "perGrammar",
  17587. status: "standard",
  17588. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-top"
  17589. },
  17590. "scroll-snap-align": {
  17591. syntax: "[ none | start | end | center ]{1,2}",
  17592. media: "visual",
  17593. inherited: false,
  17594. animationType: "discrete",
  17595. percentages: "no",
  17596. groups: [
  17597. "CSS Scroll Snap"
  17598. ],
  17599. initial: "none",
  17600. appliesto: "allElements",
  17601. computed: "asSpecified",
  17602. order: "perGrammar",
  17603. status: "standard",
  17604. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-align"
  17605. },
  17606. "scroll-snap-coordinate": {
  17607. syntax: "none | <position>#",
  17608. media: "interactive",
  17609. inherited: false,
  17610. animationType: "position",
  17611. percentages: "referToBorderBox",
  17612. groups: [
  17613. "CSS Scroll Snap"
  17614. ],
  17615. initial: "none",
  17616. appliesto: "allElements",
  17617. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17618. order: "uniqueOrder",
  17619. status: "obsolete",
  17620. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-coordinate"
  17621. },
  17622. "scroll-snap-destination": {
  17623. syntax: "<position>",
  17624. media: "interactive",
  17625. inherited: false,
  17626. animationType: "position",
  17627. percentages: "relativeToScrollContainerPaddingBoxAxis",
  17628. groups: [
  17629. "CSS Scroll Snap"
  17630. ],
  17631. initial: "0px 0px",
  17632. appliesto: "scrollContainers",
  17633. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17634. order: "uniqueOrder",
  17635. status: "obsolete",
  17636. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-destination"
  17637. },
  17638. "scroll-snap-points-x": {
  17639. syntax: "none | repeat( <length-percentage> )",
  17640. media: "interactive",
  17641. inherited: false,
  17642. animationType: "discrete",
  17643. percentages: "relativeToScrollContainerPaddingBoxAxis",
  17644. groups: [
  17645. "CSS Scroll Snap"
  17646. ],
  17647. initial: "none",
  17648. appliesto: "scrollContainers",
  17649. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17650. order: "uniqueOrder",
  17651. status: "obsolete",
  17652. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-x"
  17653. },
  17654. "scroll-snap-points-y": {
  17655. syntax: "none | repeat( <length-percentage> )",
  17656. media: "interactive",
  17657. inherited: false,
  17658. animationType: "discrete",
  17659. percentages: "relativeToScrollContainerPaddingBoxAxis",
  17660. groups: [
  17661. "CSS Scroll Snap"
  17662. ],
  17663. initial: "none",
  17664. appliesto: "scrollContainers",
  17665. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17666. order: "uniqueOrder",
  17667. status: "obsolete",
  17668. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-y"
  17669. },
  17670. "scroll-snap-stop": {
  17671. syntax: "normal | always",
  17672. media: "visual",
  17673. inherited: false,
  17674. animationType: "discrete",
  17675. percentages: "no",
  17676. groups: [
  17677. "CSS Scroll Snap"
  17678. ],
  17679. initial: "normal",
  17680. appliesto: "allElements",
  17681. computed: "asSpecified",
  17682. order: "perGrammar",
  17683. status: "standard",
  17684. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-stop"
  17685. },
  17686. "scroll-snap-type": {
  17687. syntax: "none | [ x | y | block | inline | both ] [ mandatory | proximity ]?",
  17688. media: "interactive",
  17689. inherited: false,
  17690. animationType: "discrete",
  17691. percentages: "no",
  17692. groups: [
  17693. "CSS Scroll Snap"
  17694. ],
  17695. initial: "none",
  17696. appliesto: "allElements",
  17697. computed: "asSpecified",
  17698. order: "uniqueOrder",
  17699. status: "standard",
  17700. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type"
  17701. },
  17702. "scroll-snap-type-x": {
  17703. syntax: "none | mandatory | proximity",
  17704. media: "interactive",
  17705. inherited: false,
  17706. animationType: "discrete",
  17707. percentages: "no",
  17708. groups: [
  17709. "CSS Scroll Snap"
  17710. ],
  17711. initial: "none",
  17712. appliesto: "scrollContainers",
  17713. computed: "asSpecified",
  17714. order: "uniqueOrder",
  17715. status: "obsolete",
  17716. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-x"
  17717. },
  17718. "scroll-snap-type-y": {
  17719. syntax: "none | mandatory | proximity",
  17720. media: "interactive",
  17721. inherited: false,
  17722. animationType: "discrete",
  17723. percentages: "no",
  17724. groups: [
  17725. "CSS Scroll Snap"
  17726. ],
  17727. initial: "none",
  17728. appliesto: "scrollContainers",
  17729. computed: "asSpecified",
  17730. order: "uniqueOrder",
  17731. status: "obsolete",
  17732. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-y"
  17733. },
  17734. "shape-image-threshold": {
  17735. syntax: "<alpha-value>",
  17736. media: "visual",
  17737. inherited: false,
  17738. animationType: "number",
  17739. percentages: "no",
  17740. groups: [
  17741. "CSS Shapes"
  17742. ],
  17743. initial: "0.0",
  17744. appliesto: "floats",
  17745. computed: "specifiedValueNumberClipped0To1",
  17746. order: "uniqueOrder",
  17747. status: "standard",
  17748. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-image-threshold"
  17749. },
  17750. "shape-margin": {
  17751. syntax: "<length-percentage>",
  17752. media: "visual",
  17753. inherited: false,
  17754. animationType: "lpc",
  17755. percentages: "referToWidthOfContainingBlock",
  17756. groups: [
  17757. "CSS Shapes"
  17758. ],
  17759. initial: "0",
  17760. appliesto: "floats",
  17761. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17762. order: "uniqueOrder",
  17763. status: "standard",
  17764. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-margin"
  17765. },
  17766. "shape-outside": {
  17767. syntax: "none | <shape-box> || <basic-shape> | <image>",
  17768. media: "visual",
  17769. inherited: false,
  17770. animationType: "basicShapeOtherwiseNo",
  17771. percentages: "no",
  17772. groups: [
  17773. "CSS Shapes"
  17774. ],
  17775. initial: "none",
  17776. appliesto: "floats",
  17777. computed: "asDefinedForBasicShapeWithAbsoluteURIOtherwiseAsSpecified",
  17778. order: "uniqueOrder",
  17779. status: "standard",
  17780. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-outside"
  17781. },
  17782. "tab-size": {
  17783. syntax: "<integer> | <length>",
  17784. media: "visual",
  17785. inherited: true,
  17786. animationType: "length",
  17787. percentages: "no",
  17788. groups: [
  17789. "CSS Text"
  17790. ],
  17791. initial: "8",
  17792. appliesto: "blockContainers",
  17793. computed: "specifiedIntegerOrAbsoluteLength",
  17794. order: "uniqueOrder",
  17795. status: "standard",
  17796. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/tab-size"
  17797. },
  17798. "table-layout": {
  17799. syntax: "auto | fixed",
  17800. media: "visual",
  17801. inherited: false,
  17802. animationType: "discrete",
  17803. percentages: "no",
  17804. groups: [
  17805. "CSS Table"
  17806. ],
  17807. initial: "auto",
  17808. appliesto: "tableElements",
  17809. computed: "asSpecified",
  17810. order: "uniqueOrder",
  17811. status: "standard",
  17812. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/table-layout"
  17813. },
  17814. "text-align": {
  17815. syntax: "start | end | left | right | center | justify | match-parent",
  17816. media: "visual",
  17817. inherited: true,
  17818. animationType: "discrete",
  17819. percentages: "no",
  17820. groups: [
  17821. "CSS Text"
  17822. ],
  17823. initial: "startOrNamelessValueIfLTRRightIfRTL",
  17824. appliesto: "blockContainers",
  17825. computed: "asSpecifiedExceptMatchParent",
  17826. order: "orderOfAppearance",
  17827. alsoAppliesTo: [
  17828. "::placeholder"
  17829. ],
  17830. status: "standard",
  17831. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-align"
  17832. },
  17833. "text-align-last": {
  17834. syntax: "auto | start | end | left | right | center | justify",
  17835. media: "visual",
  17836. inherited: true,
  17837. animationType: "discrete",
  17838. percentages: "no",
  17839. groups: [
  17840. "CSS Text"
  17841. ],
  17842. initial: "auto",
  17843. appliesto: "blockContainers",
  17844. computed: "asSpecified",
  17845. order: "uniqueOrder",
  17846. status: "standard",
  17847. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-align-last"
  17848. },
  17849. "text-combine-upright": {
  17850. syntax: "none | all | [ digits <integer>? ]",
  17851. media: "visual",
  17852. inherited: true,
  17853. animationType: "discrete",
  17854. percentages: "no",
  17855. groups: [
  17856. "CSS Writing Modes"
  17857. ],
  17858. initial: "none",
  17859. appliesto: "nonReplacedInlineElements",
  17860. computed: "keywordPlusIntegerIfDigits",
  17861. order: "uniqueOrder",
  17862. status: "standard",
  17863. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-combine-upright"
  17864. },
  17865. "text-decoration": {
  17866. syntax: "<'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> || <'text-decoration-thickness'>",
  17867. media: "visual",
  17868. inherited: false,
  17869. animationType: [
  17870. "text-decoration-color",
  17871. "text-decoration-style",
  17872. "text-decoration-line",
  17873. "text-decoration-thickness"
  17874. ],
  17875. percentages: "no",
  17876. groups: [
  17877. "CSS Text Decoration"
  17878. ],
  17879. initial: [
  17880. "text-decoration-color",
  17881. "text-decoration-style",
  17882. "text-decoration-line"
  17883. ],
  17884. appliesto: "allElements",
  17885. computed: [
  17886. "text-decoration-line",
  17887. "text-decoration-style",
  17888. "text-decoration-color",
  17889. "text-decoration-thickness"
  17890. ],
  17891. order: "orderOfAppearance",
  17892. alsoAppliesTo: [
  17893. "::first-letter",
  17894. "::first-line",
  17895. "::placeholder"
  17896. ],
  17897. status: "standard",
  17898. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration"
  17899. },
  17900. "text-decoration-color": {
  17901. syntax: "<color>",
  17902. media: "visual",
  17903. inherited: false,
  17904. animationType: "color",
  17905. percentages: "no",
  17906. groups: [
  17907. "CSS Text Decoration"
  17908. ],
  17909. initial: "currentcolor",
  17910. appliesto: "allElements",
  17911. computed: "computedColor",
  17912. order: "uniqueOrder",
  17913. alsoAppliesTo: [
  17914. "::first-letter",
  17915. "::first-line",
  17916. "::placeholder"
  17917. ],
  17918. status: "standard",
  17919. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-color"
  17920. },
  17921. "text-decoration-line": {
  17922. syntax: "none | [ underline || overline || line-through || blink ] | spelling-error | grammar-error",
  17923. media: "visual",
  17924. inherited: false,
  17925. animationType: "discrete",
  17926. percentages: "no",
  17927. groups: [
  17928. "CSS Text Decoration"
  17929. ],
  17930. initial: "none",
  17931. appliesto: "allElements",
  17932. computed: "asSpecified",
  17933. order: "orderOfAppearance",
  17934. alsoAppliesTo: [
  17935. "::first-letter",
  17936. "::first-line",
  17937. "::placeholder"
  17938. ],
  17939. status: "standard",
  17940. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-line"
  17941. },
  17942. "text-decoration-skip": {
  17943. syntax: "none | [ objects || [ spaces | [ leading-spaces || trailing-spaces ] ] || edges || box-decoration ]",
  17944. media: "visual",
  17945. inherited: true,
  17946. animationType: "discrete",
  17947. percentages: "no",
  17948. groups: [
  17949. "CSS Text Decoration"
  17950. ],
  17951. initial: "objects",
  17952. appliesto: "allElements",
  17953. computed: "asSpecified",
  17954. order: "orderOfAppearance",
  17955. status: "experimental",
  17956. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip"
  17957. },
  17958. "text-decoration-skip-ink": {
  17959. syntax: "auto | none",
  17960. media: "visual",
  17961. inherited: true,
  17962. animationType: "discrete",
  17963. percentages: "no",
  17964. groups: [
  17965. "CSS Text Decoration"
  17966. ],
  17967. initial: "auto",
  17968. appliesto: "allElements",
  17969. computed: "asSpecified",
  17970. order: "orderOfAppearance",
  17971. status: "experimental",
  17972. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip-ink"
  17973. },
  17974. "text-decoration-style": {
  17975. syntax: "solid | double | dotted | dashed | wavy",
  17976. media: "visual",
  17977. inherited: false,
  17978. animationType: "discrete",
  17979. percentages: "no",
  17980. groups: [
  17981. "CSS Text Decoration"
  17982. ],
  17983. initial: "solid",
  17984. appliesto: "allElements",
  17985. computed: "asSpecified",
  17986. order: "uniqueOrder",
  17987. alsoAppliesTo: [
  17988. "::first-letter",
  17989. "::first-line",
  17990. "::placeholder"
  17991. ],
  17992. status: "standard",
  17993. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-style"
  17994. },
  17995. "text-decoration-thickness": {
  17996. syntax: "auto | from-font | <length>",
  17997. media: "visual",
  17998. inherited: false,
  17999. animationType: "byComputedValueType",
  18000. percentages: "no",
  18001. groups: [
  18002. "CSS Text Decoration"
  18003. ],
  18004. initial: "auto",
  18005. appliesto: "allElements",
  18006. computed: "asSpecified",
  18007. order: "uniqueOrder",
  18008. alsoAppliesTo: [
  18009. "::first-letter",
  18010. "::first-line",
  18011. "::placeholder"
  18012. ],
  18013. status: "standard",
  18014. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-thickness"
  18015. },
  18016. "text-emphasis": {
  18017. syntax: "<'text-emphasis-style'> || <'text-emphasis-color'>",
  18018. media: "visual",
  18019. inherited: false,
  18020. animationType: [
  18021. "text-emphasis-color",
  18022. "text-emphasis-style"
  18023. ],
  18024. percentages: "no",
  18025. groups: [
  18026. "CSS Text Decoration"
  18027. ],
  18028. initial: [
  18029. "text-emphasis-style",
  18030. "text-emphasis-color"
  18031. ],
  18032. appliesto: "allElements",
  18033. computed: [
  18034. "text-emphasis-style",
  18035. "text-emphasis-color"
  18036. ],
  18037. order: "orderOfAppearance",
  18038. status: "standard",
  18039. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis"
  18040. },
  18041. "text-emphasis-color": {
  18042. syntax: "<color>",
  18043. media: "visual",
  18044. inherited: false,
  18045. animationType: "color",
  18046. percentages: "no",
  18047. groups: [
  18048. "CSS Text Decoration"
  18049. ],
  18050. initial: "currentcolor",
  18051. appliesto: "allElements",
  18052. computed: "computedColor",
  18053. order: "uniqueOrder",
  18054. status: "standard",
  18055. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-color"
  18056. },
  18057. "text-emphasis-position": {
  18058. syntax: "[ over | under ] && [ right | left ]",
  18059. media: "visual",
  18060. inherited: false,
  18061. animationType: "discrete",
  18062. percentages: "no",
  18063. groups: [
  18064. "CSS Text Decoration"
  18065. ],
  18066. initial: "over right",
  18067. appliesto: "allElements",
  18068. computed: "asSpecified",
  18069. order: "uniqueOrder",
  18070. status: "standard",
  18071. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-position"
  18072. },
  18073. "text-emphasis-style": {
  18074. syntax: "none | [ [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] ] | <string>",
  18075. media: "visual",
  18076. inherited: false,
  18077. animationType: "discrete",
  18078. percentages: "no",
  18079. groups: [
  18080. "CSS Text Decoration"
  18081. ],
  18082. initial: "none",
  18083. appliesto: "allElements",
  18084. computed: "asSpecified",
  18085. order: "uniqueOrder",
  18086. status: "standard",
  18087. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-style"
  18088. },
  18089. "text-indent": {
  18090. syntax: "<length-percentage> && hanging? && each-line?",
  18091. media: "visual",
  18092. inherited: true,
  18093. animationType: "lpc",
  18094. percentages: "referToWidthOfContainingBlock",
  18095. groups: [
  18096. "CSS Text"
  18097. ],
  18098. initial: "0",
  18099. appliesto: "blockContainers",
  18100. computed: "percentageOrAbsoluteLengthPlusKeywords",
  18101. order: "lengthOrPercentageBeforeKeywords",
  18102. status: "standard",
  18103. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-indent"
  18104. },
  18105. "text-justify": {
  18106. syntax: "auto | inter-character | inter-word | none",
  18107. media: "visual",
  18108. inherited: true,
  18109. animationType: "discrete",
  18110. percentages: "no",
  18111. groups: [
  18112. "CSS Text"
  18113. ],
  18114. initial: "auto",
  18115. appliesto: "inlineLevelAndTableCellElements",
  18116. computed: "asSpecified",
  18117. order: "uniqueOrder",
  18118. status: "standard",
  18119. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-justify"
  18120. },
  18121. "text-orientation": {
  18122. syntax: "mixed | upright | sideways",
  18123. media: "visual",
  18124. inherited: true,
  18125. animationType: "discrete",
  18126. percentages: "no",
  18127. groups: [
  18128. "CSS Writing Modes"
  18129. ],
  18130. initial: "mixed",
  18131. appliesto: "allElementsExceptTableRowGroupsRowsColumnGroupsAndColumns",
  18132. computed: "asSpecified",
  18133. order: "uniqueOrder",
  18134. status: "standard",
  18135. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-orientation"
  18136. },
  18137. "text-overflow": {
  18138. syntax: "[ clip | ellipsis | <string> ]{1,2}",
  18139. media: "visual",
  18140. inherited: false,
  18141. animationType: "discrete",
  18142. percentages: "no",
  18143. groups: [
  18144. "CSS Basic User Interface"
  18145. ],
  18146. initial: "clip",
  18147. appliesto: "blockContainerElements",
  18148. computed: "asSpecified",
  18149. order: "uniqueOrder",
  18150. alsoAppliesTo: [
  18151. "::placeholder"
  18152. ],
  18153. status: "standard",
  18154. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-overflow"
  18155. },
  18156. "text-rendering": {
  18157. syntax: "auto | optimizeSpeed | optimizeLegibility | geometricPrecision",
  18158. media: "visual",
  18159. inherited: true,
  18160. animationType: "discrete",
  18161. percentages: "no",
  18162. groups: [
  18163. "CSS Miscellaneous"
  18164. ],
  18165. initial: "auto",
  18166. appliesto: "textElements",
  18167. computed: "asSpecified",
  18168. order: "uniqueOrder",
  18169. status: "standard",
  18170. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-rendering"
  18171. },
  18172. "text-shadow": {
  18173. syntax: "none | <shadow-t>#",
  18174. media: "visual",
  18175. inherited: true,
  18176. animationType: "shadowList",
  18177. percentages: "no",
  18178. groups: [
  18179. "CSS Text Decoration"
  18180. ],
  18181. initial: "none",
  18182. appliesto: "allElements",
  18183. computed: "colorPlusThreeAbsoluteLengths",
  18184. order: "uniqueOrder",
  18185. alsoAppliesTo: [
  18186. "::first-letter",
  18187. "::first-line",
  18188. "::placeholder"
  18189. ],
  18190. status: "standard",
  18191. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-shadow"
  18192. },
  18193. "text-size-adjust": {
  18194. syntax: "none | auto | <percentage>",
  18195. media: "visual",
  18196. inherited: true,
  18197. animationType: "discrete",
  18198. percentages: "referToSizeOfFont",
  18199. groups: [
  18200. "CSS Text"
  18201. ],
  18202. initial: "autoForSmartphoneBrowsersSupportingInflation",
  18203. appliesto: "allElements",
  18204. computed: "asSpecified",
  18205. order: "uniqueOrder",
  18206. status: "experimental",
  18207. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-size-adjust"
  18208. },
  18209. "text-transform": {
  18210. syntax: "none | capitalize | uppercase | lowercase | full-width | full-size-kana",
  18211. media: "visual",
  18212. inherited: true,
  18213. animationType: "discrete",
  18214. percentages: "no",
  18215. groups: [
  18216. "CSS Text"
  18217. ],
  18218. initial: "none",
  18219. appliesto: "allElements",
  18220. computed: "asSpecified",
  18221. order: "uniqueOrder",
  18222. alsoAppliesTo: [
  18223. "::first-letter",
  18224. "::first-line",
  18225. "::placeholder"
  18226. ],
  18227. status: "standard",
  18228. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-transform"
  18229. },
  18230. "text-underline-offset": {
  18231. syntax: "auto | from-font | <length>",
  18232. media: "visual",
  18233. inherited: true,
  18234. animationType: "byComputedValueType",
  18235. percentages: "no",
  18236. groups: [
  18237. "CSS Text Decoration"
  18238. ],
  18239. initial: "auto",
  18240. appliesto: "allElements",
  18241. computed: "asSpecified",
  18242. order: "uniqueOrder",
  18243. alsoAppliesTo: [
  18244. "::first-letter",
  18245. "::first-line",
  18246. "::placeholder"
  18247. ],
  18248. status: "standard",
  18249. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-underline-offset"
  18250. },
  18251. "text-underline-position": {
  18252. syntax: "auto | [ under || [ left | right ] ]",
  18253. media: "visual",
  18254. inherited: true,
  18255. animationType: "discrete",
  18256. percentages: "no",
  18257. groups: [
  18258. "CSS Text Decoration"
  18259. ],
  18260. initial: "auto",
  18261. appliesto: "allElements",
  18262. computed: "asSpecified",
  18263. order: "orderOfAppearance",
  18264. status: "standard",
  18265. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-underline-position"
  18266. },
  18267. top: top,
  18268. "touch-action": {
  18269. syntax: "auto | none | [ [ pan-x | pan-left | pan-right ] || [ pan-y | pan-up | pan-down ] || pinch-zoom ] | manipulation",
  18270. media: "visual",
  18271. inherited: false,
  18272. animationType: "discrete",
  18273. percentages: "no",
  18274. groups: [
  18275. "Pointer Events"
  18276. ],
  18277. initial: "auto",
  18278. appliesto: "allElementsExceptNonReplacedInlineElementsTableRowsColumnsRowColumnGroups",
  18279. computed: "asSpecified",
  18280. order: "uniqueOrder",
  18281. status: "standard",
  18282. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/touch-action"
  18283. },
  18284. transform: transform,
  18285. "transform-box": {
  18286. syntax: "border-box | fill-box | view-box",
  18287. media: "visual",
  18288. inherited: false,
  18289. animationType: "discrete",
  18290. percentages: "no",
  18291. groups: [
  18292. "CSS Transforms"
  18293. ],
  18294. initial: "border-box ",
  18295. appliesto: "transformableElements",
  18296. computed: "asSpecified",
  18297. order: "uniqueOrder",
  18298. status: "standard",
  18299. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-box"
  18300. },
  18301. "transform-origin": {
  18302. syntax: "[ <length-percentage> | left | center | right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>?",
  18303. media: "visual",
  18304. inherited: false,
  18305. animationType: "simpleListOfLpc",
  18306. percentages: "referToSizeOfBoundingBox",
  18307. groups: [
  18308. "CSS Transforms"
  18309. ],
  18310. initial: "50% 50% 0",
  18311. appliesto: "transformableElements",
  18312. computed: "forLengthAbsoluteValueOtherwisePercentage",
  18313. order: "oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
  18314. status: "standard",
  18315. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-origin"
  18316. },
  18317. "transform-style": {
  18318. syntax: "flat | preserve-3d",
  18319. media: "visual",
  18320. inherited: false,
  18321. animationType: "discrete",
  18322. percentages: "no",
  18323. groups: [
  18324. "CSS Transforms"
  18325. ],
  18326. initial: "flat",
  18327. appliesto: "transformableElements",
  18328. computed: "asSpecified",
  18329. order: "uniqueOrder",
  18330. stacking: true,
  18331. status: "standard",
  18332. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-style"
  18333. },
  18334. transition: transition,
  18335. "transition-delay": {
  18336. syntax: "<time>#",
  18337. media: "interactive",
  18338. inherited: false,
  18339. animationType: "discrete",
  18340. percentages: "no",
  18341. groups: [
  18342. "CSS Transitions"
  18343. ],
  18344. initial: "0s",
  18345. appliesto: "allElementsAndPseudos",
  18346. computed: "asSpecified",
  18347. order: "uniqueOrder",
  18348. status: "standard",
  18349. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-delay"
  18350. },
  18351. "transition-duration": {
  18352. syntax: "<time>#",
  18353. media: "interactive",
  18354. inherited: false,
  18355. animationType: "discrete",
  18356. percentages: "no",
  18357. groups: [
  18358. "CSS Transitions"
  18359. ],
  18360. initial: "0s",
  18361. appliesto: "allElementsAndPseudos",
  18362. computed: "asSpecified",
  18363. order: "uniqueOrder",
  18364. status: "standard",
  18365. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-duration"
  18366. },
  18367. "transition-property": {
  18368. syntax: "none | <single-transition-property>#",
  18369. media: "visual",
  18370. inherited: false,
  18371. animationType: "discrete",
  18372. percentages: "no",
  18373. groups: [
  18374. "CSS Transitions"
  18375. ],
  18376. initial: "all",
  18377. appliesto: "allElementsAndPseudos",
  18378. computed: "asSpecified",
  18379. order: "uniqueOrder",
  18380. status: "standard",
  18381. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-property"
  18382. },
  18383. "transition-timing-function": {
  18384. syntax: "<timing-function>#",
  18385. media: "interactive",
  18386. inherited: false,
  18387. animationType: "discrete",
  18388. percentages: "no",
  18389. groups: [
  18390. "CSS Transitions"
  18391. ],
  18392. initial: "ease",
  18393. appliesto: "allElementsAndPseudos",
  18394. computed: "asSpecified",
  18395. order: "uniqueOrder",
  18396. status: "standard",
  18397. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-timing-function"
  18398. },
  18399. translate: translate,
  18400. "unicode-bidi": {
  18401. syntax: "normal | embed | isolate | bidi-override | isolate-override | plaintext",
  18402. media: "visual",
  18403. inherited: false,
  18404. animationType: "discrete",
  18405. percentages: "no",
  18406. groups: [
  18407. "CSS Writing Modes"
  18408. ],
  18409. initial: "normal",
  18410. appliesto: "allElementsSomeValuesNoEffectOnNonInlineElements",
  18411. computed: "asSpecified",
  18412. order: "uniqueOrder",
  18413. status: "standard",
  18414. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/unicode-bidi"
  18415. },
  18416. "user-select": {
  18417. syntax: "auto | text | none | contain | all",
  18418. media: "visual",
  18419. inherited: false,
  18420. animationType: "discrete",
  18421. percentages: "no",
  18422. groups: [
  18423. "CSS Basic User Interface"
  18424. ],
  18425. initial: "auto",
  18426. appliesto: "allElements",
  18427. computed: "asSpecified",
  18428. order: "uniqueOrder",
  18429. status: "nonstandard",
  18430. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/user-select"
  18431. },
  18432. "vertical-align": {
  18433. syntax: "baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length>",
  18434. media: "visual",
  18435. inherited: false,
  18436. animationType: "length",
  18437. percentages: "referToLineHeight",
  18438. groups: [
  18439. "CSS Table"
  18440. ],
  18441. initial: "baseline",
  18442. appliesto: "inlineLevelAndTableCellElements",
  18443. computed: "absoluteLengthOrKeyword",
  18444. order: "uniqueOrder",
  18445. alsoAppliesTo: [
  18446. "::first-letter",
  18447. "::first-line",
  18448. "::placeholder"
  18449. ],
  18450. status: "standard",
  18451. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/vertical-align"
  18452. },
  18453. visibility: visibility,
  18454. "white-space": {
  18455. syntax: "normal | pre | nowrap | pre-wrap | pre-line | break-spaces",
  18456. media: "visual",
  18457. inherited: true,
  18458. animationType: "discrete",
  18459. percentages: "no",
  18460. groups: [
  18461. "CSS Text"
  18462. ],
  18463. initial: "normal",
  18464. appliesto: "allElements",
  18465. computed: "asSpecified",
  18466. order: "uniqueOrder",
  18467. status: "standard",
  18468. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/white-space"
  18469. },
  18470. widows: widows,
  18471. width: width,
  18472. "will-change": {
  18473. syntax: "auto | <animateable-feature>#",
  18474. media: "all",
  18475. inherited: false,
  18476. animationType: "discrete",
  18477. percentages: "no",
  18478. groups: [
  18479. "CSS Will Change"
  18480. ],
  18481. initial: "auto",
  18482. appliesto: "allElements",
  18483. computed: "asSpecified",
  18484. order: "uniqueOrder",
  18485. status: "standard",
  18486. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/will-change"
  18487. },
  18488. "word-break": {
  18489. syntax: "normal | break-all | keep-all | break-word",
  18490. media: "visual",
  18491. inherited: true,
  18492. animationType: "discrete",
  18493. percentages: "no",
  18494. groups: [
  18495. "CSS Text"
  18496. ],
  18497. initial: "normal",
  18498. appliesto: "allElements",
  18499. computed: "asSpecified",
  18500. order: "uniqueOrder",
  18501. status: "standard",
  18502. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/word-break"
  18503. },
  18504. "word-spacing": {
  18505. syntax: "normal | <length-percentage>",
  18506. media: "visual",
  18507. inherited: true,
  18508. animationType: "length",
  18509. percentages: "referToWidthOfAffectedGlyph",
  18510. groups: [
  18511. "CSS Text"
  18512. ],
  18513. initial: "normal",
  18514. appliesto: "allElements",
  18515. computed: "optimumMinAndMaxValueOfAbsoluteLengthPercentageOrNormal",
  18516. order: "uniqueOrder",
  18517. alsoAppliesTo: [
  18518. "::first-letter",
  18519. "::first-line",
  18520. "::placeholder"
  18521. ],
  18522. status: "standard",
  18523. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/word-spacing"
  18524. },
  18525. "word-wrap": {
  18526. syntax: "normal | break-word",
  18527. media: "visual",
  18528. inherited: true,
  18529. animationType: "discrete",
  18530. percentages: "no",
  18531. groups: [
  18532. "CSS Text"
  18533. ],
  18534. initial: "normal",
  18535. appliesto: "nonReplacedInlineElements",
  18536. computed: "asSpecified",
  18537. order: "uniqueOrder",
  18538. status: "standard",
  18539. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-wrap"
  18540. },
  18541. "writing-mode": {
  18542. syntax: "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr",
  18543. media: "visual",
  18544. inherited: true,
  18545. animationType: "discrete",
  18546. percentages: "no",
  18547. groups: [
  18548. "CSS Writing Modes"
  18549. ],
  18550. initial: "horizontal-tb",
  18551. appliesto: "allElementsExceptTableRowColumnGroupsTableRowsColumns",
  18552. computed: "asSpecified",
  18553. order: "uniqueOrder",
  18554. status: "standard",
  18555. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/writing-mode"
  18556. },
  18557. "z-index": {
  18558. syntax: "auto | <integer>",
  18559. media: "visual",
  18560. inherited: false,
  18561. animationType: "integer",
  18562. percentages: "no",
  18563. groups: [
  18564. "CSS Positioning"
  18565. ],
  18566. initial: "auto",
  18567. appliesto: "positionedElements",
  18568. computed: "asSpecified",
  18569. order: "uniqueOrder",
  18570. stacking: true,
  18571. status: "standard",
  18572. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/z-index"
  18573. },
  18574. zoom: zoom
  18575. };
  18576. var properties$2 = /*#__PURE__*/Object.freeze({
  18577. __proto__: null,
  18578. all: all,
  18579. animation: animation,
  18580. appearance: appearance,
  18581. azimuth: azimuth,
  18582. background: background,
  18583. border: border,
  18584. bottom: bottom,
  18585. clear: clear,
  18586. clip: clip,
  18587. color: color,
  18588. columns: columns,
  18589. contain: contain,
  18590. content: content,
  18591. cursor: cursor,
  18592. direction: direction,
  18593. display: display,
  18594. filter: filter,
  18595. flex: flex,
  18596. float: float,
  18597. font: font,
  18598. gap: gap,
  18599. grid: grid,
  18600. height: height,
  18601. hyphens: hyphens,
  18602. inset: inset,
  18603. isolation: isolation,
  18604. left: left,
  18605. margin: margin,
  18606. mask: mask,
  18607. offset: offset,
  18608. opacity: opacity,
  18609. order: order,
  18610. orphans: orphans,
  18611. outline: outline,
  18612. overflow: overflow,
  18613. padding: padding,
  18614. perspective: perspective,
  18615. position: position,
  18616. quotes: quotes,
  18617. resize: resize,
  18618. right: right,
  18619. rotate: rotate,
  18620. scale: scale,
  18621. top: top,
  18622. transform: transform,
  18623. transition: transition,
  18624. translate: translate,
  18625. visibility: visibility,
  18626. widows: widows,
  18627. width: width,
  18628. zoom: zoom,
  18629. 'default': properties$1
  18630. });
  18631. var attachment = {
  18632. syntax: "scroll | fixed | local"
  18633. };
  18634. var box = {
  18635. syntax: "border-box | padding-box | content-box"
  18636. };
  18637. var color$1 = {
  18638. syntax: "<rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>"
  18639. };
  18640. var combinator = {
  18641. syntax: "'>' | '+' | '~' | [ '||' ]"
  18642. };
  18643. var compat = {
  18644. syntax: "searchfield | textarea | push-button | button-bevel | slider-horizontal | checkbox | radio | square-button | menulist | menulist-button | listbox | meter | progress-bar"
  18645. };
  18646. var gradient = {
  18647. syntax: "<linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()>"
  18648. };
  18649. var hue = {
  18650. syntax: "<number> | <angle>"
  18651. };
  18652. var image = {
  18653. syntax: "<url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>"
  18654. };
  18655. var nth = {
  18656. syntax: "<an-plus-b> | even | odd"
  18657. };
  18658. var position$1 = {
  18659. 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> ] ]"
  18660. };
  18661. var quote = {
  18662. syntax: "open-quote | close-quote | no-open-quote | no-close-quote"
  18663. };
  18664. var shadow = {
  18665. syntax: "inset? && <length>{2,4} && <color>?"
  18666. };
  18667. var shape$1 = {
  18668. syntax: "rect(<top>, <right>, <bottom>, <left>)"
  18669. };
  18670. var size = {
  18671. syntax: "closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}"
  18672. };
  18673. var symbol = {
  18674. syntax: "<string> | <image> | <custom-ident>"
  18675. };
  18676. var target = {
  18677. syntax: "<target-counter()> | <target-counters()> | <target-text()>"
  18678. };
  18679. var syntaxes = {
  18680. "absolute-size": {
  18681. syntax: "xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large"
  18682. },
  18683. "alpha-value": {
  18684. syntax: "<number> | <percentage>"
  18685. },
  18686. "angle-percentage": {
  18687. syntax: "<angle> | <percentage>"
  18688. },
  18689. "angular-color-hint": {
  18690. syntax: "<angle-percentage>"
  18691. },
  18692. "angular-color-stop": {
  18693. syntax: "<color> && <color-stop-angle>?"
  18694. },
  18695. "angular-color-stop-list": {
  18696. syntax: "[ <angular-color-stop> [, <angular-color-hint>]? ]# , <angular-color-stop>"
  18697. },
  18698. "animateable-feature": {
  18699. syntax: "scroll-position | contents | <custom-ident>"
  18700. },
  18701. attachment: attachment,
  18702. "attr()": {
  18703. syntax: "attr( <attr-name> <type-or-unit>? [, <attr-fallback> ]? )"
  18704. },
  18705. "attr-matcher": {
  18706. syntax: "[ '~' | '|' | '^' | '$' | '*' ]? '='"
  18707. },
  18708. "attr-modifier": {
  18709. syntax: "i | s"
  18710. },
  18711. "attribute-selector": {
  18712. syntax: "'[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'"
  18713. },
  18714. "auto-repeat": {
  18715. syntax: "repeat( [ auto-fill | auto-fit ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
  18716. },
  18717. "auto-track-list": {
  18718. syntax: "[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>? <auto-repeat>\n[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?"
  18719. },
  18720. "baseline-position": {
  18721. syntax: "[ first | last ]? baseline"
  18722. },
  18723. "basic-shape": {
  18724. syntax: "<inset()> | <circle()> | <ellipse()> | <polygon()>"
  18725. },
  18726. "bg-image": {
  18727. syntax: "none | <image>"
  18728. },
  18729. "bg-layer": {
  18730. syntax: "<bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
  18731. },
  18732. "bg-position": {
  18733. 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>? ] ]"
  18734. },
  18735. "bg-size": {
  18736. syntax: "[ <length-percentage> | auto ]{1,2} | cover | contain"
  18737. },
  18738. "blur()": {
  18739. syntax: "blur( <length> )"
  18740. },
  18741. "blend-mode": {
  18742. syntax: "normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity"
  18743. },
  18744. box: box,
  18745. "brightness()": {
  18746. syntax: "brightness( <number-percentage> )"
  18747. },
  18748. "calc()": {
  18749. syntax: "calc( <calc-sum> )"
  18750. },
  18751. "calc-sum": {
  18752. syntax: "<calc-product> [ [ '+' | '-' ] <calc-product> ]*"
  18753. },
  18754. "calc-product": {
  18755. syntax: "<calc-value> [ '*' <calc-value> | '/' <number> ]*"
  18756. },
  18757. "calc-value": {
  18758. syntax: "<number> | <dimension> | <percentage> | ( <calc-sum> )"
  18759. },
  18760. "cf-final-image": {
  18761. syntax: "<image> | <color>"
  18762. },
  18763. "cf-mixing-image": {
  18764. syntax: "<percentage>? && <image>"
  18765. },
  18766. "circle()": {
  18767. syntax: "circle( [ <shape-radius> ]? [ at <position> ]? )"
  18768. },
  18769. "clamp()": {
  18770. syntax: "clamp( <calc-sum>#{3} )"
  18771. },
  18772. "class-selector": {
  18773. syntax: "'.' <ident-token>"
  18774. },
  18775. "clip-source": {
  18776. syntax: "<url>"
  18777. },
  18778. color: color$1,
  18779. "color-stop": {
  18780. syntax: "<color-stop-length> | <color-stop-angle>"
  18781. },
  18782. "color-stop-angle": {
  18783. syntax: "<angle-percentage>{1,2}"
  18784. },
  18785. "color-stop-length": {
  18786. syntax: "<length-percentage>{1,2}"
  18787. },
  18788. "color-stop-list": {
  18789. syntax: "[ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop>"
  18790. },
  18791. combinator: combinator,
  18792. "common-lig-values": {
  18793. syntax: "[ common-ligatures | no-common-ligatures ]"
  18794. },
  18795. compat: compat,
  18796. "composite-style": {
  18797. syntax: "clear | copy | source-over | source-in | source-out | source-atop | destination-over | destination-in | destination-out | destination-atop | xor"
  18798. },
  18799. "compositing-operator": {
  18800. syntax: "add | subtract | intersect | exclude"
  18801. },
  18802. "compound-selector": {
  18803. syntax: "[ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!"
  18804. },
  18805. "compound-selector-list": {
  18806. syntax: "<compound-selector>#"
  18807. },
  18808. "complex-selector": {
  18809. syntax: "<compound-selector> [ <combinator>? <compound-selector> ]*"
  18810. },
  18811. "complex-selector-list": {
  18812. syntax: "<complex-selector>#"
  18813. },
  18814. "conic-gradient()": {
  18815. syntax: "conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )"
  18816. },
  18817. "contextual-alt-values": {
  18818. syntax: "[ contextual | no-contextual ]"
  18819. },
  18820. "content-distribution": {
  18821. syntax: "space-between | space-around | space-evenly | stretch"
  18822. },
  18823. "content-list": {
  18824. syntax: "[ <string> | contents | <image> | <quote> | <target> | <leader()> ]+"
  18825. },
  18826. "content-position": {
  18827. syntax: "center | start | end | flex-start | flex-end"
  18828. },
  18829. "content-replacement": {
  18830. syntax: "<image>"
  18831. },
  18832. "contrast()": {
  18833. syntax: "contrast( [ <number-percentage> ] )"
  18834. },
  18835. "counter()": {
  18836. syntax: "counter( <custom-ident>, <counter-style>? )"
  18837. },
  18838. "counter-style": {
  18839. syntax: "<counter-style-name> | symbols()"
  18840. },
  18841. "counter-style-name": {
  18842. syntax: "<custom-ident>"
  18843. },
  18844. "counters()": {
  18845. syntax: "counters( <custom-ident>, <string>, <counter-style>? )"
  18846. },
  18847. "cross-fade()": {
  18848. syntax: "cross-fade( <cf-mixing-image> , <cf-final-image>? )"
  18849. },
  18850. "cubic-bezier-timing-function": {
  18851. syntax: "ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number>, <number>, <number>, <number>)"
  18852. },
  18853. "deprecated-system-color": {
  18854. 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"
  18855. },
  18856. "discretionary-lig-values": {
  18857. syntax: "[ discretionary-ligatures | no-discretionary-ligatures ]"
  18858. },
  18859. "display-box": {
  18860. syntax: "contents | none"
  18861. },
  18862. "display-inside": {
  18863. syntax: "flow | flow-root | table | flex | grid | ruby"
  18864. },
  18865. "display-internal": {
  18866. 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"
  18867. },
  18868. "display-legacy": {
  18869. syntax: "inline-block | inline-list-item | inline-table | inline-flex | inline-grid"
  18870. },
  18871. "display-listitem": {
  18872. syntax: "<display-outside>? && [ flow | flow-root ]? && list-item"
  18873. },
  18874. "display-outside": {
  18875. syntax: "block | inline | run-in"
  18876. },
  18877. "drop-shadow()": {
  18878. syntax: "drop-shadow( <length>{2,3} <color>? )"
  18879. },
  18880. "east-asian-variant-values": {
  18881. syntax: "[ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]"
  18882. },
  18883. "east-asian-width-values": {
  18884. syntax: "[ full-width | proportional-width ]"
  18885. },
  18886. "element()": {
  18887. syntax: "element( <id-selector> )"
  18888. },
  18889. "ellipse()": {
  18890. syntax: "ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )"
  18891. },
  18892. "ending-shape": {
  18893. syntax: "circle | ellipse"
  18894. },
  18895. "env()": {
  18896. syntax: "env( <custom-ident> , <declaration-value>? )"
  18897. },
  18898. "explicit-track-list": {
  18899. syntax: "[ <line-names>? <track-size> ]+ <line-names>?"
  18900. },
  18901. "family-name": {
  18902. syntax: "<string> | <custom-ident>+"
  18903. },
  18904. "feature-tag-value": {
  18905. syntax: "<string> [ <integer> | on | off ]?"
  18906. },
  18907. "feature-type": {
  18908. syntax: "@stylistic | @historical-forms | @styleset | @character-variant | @swash | @ornaments | @annotation"
  18909. },
  18910. "feature-value-block": {
  18911. syntax: "<feature-type> '{' <feature-value-declaration-list> '}'"
  18912. },
  18913. "feature-value-block-list": {
  18914. syntax: "<feature-value-block>+"
  18915. },
  18916. "feature-value-declaration": {
  18917. syntax: "<custom-ident>: <integer>+;"
  18918. },
  18919. "feature-value-declaration-list": {
  18920. syntax: "<feature-value-declaration>"
  18921. },
  18922. "feature-value-name": {
  18923. syntax: "<custom-ident>"
  18924. },
  18925. "fill-rule": {
  18926. syntax: "nonzero | evenodd"
  18927. },
  18928. "filter-function": {
  18929. syntax: "<blur()> | <brightness()> | <contrast()> | <drop-shadow()> | <grayscale()> | <hue-rotate()> | <invert()> | <opacity()> | <saturate()> | <sepia()>"
  18930. },
  18931. "filter-function-list": {
  18932. syntax: "[ <filter-function> | <url> ]+"
  18933. },
  18934. "final-bg-layer": {
  18935. syntax: "<'background-color'> || <bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
  18936. },
  18937. "fit-content()": {
  18938. syntax: "fit-content( [ <length> | <percentage> ] )"
  18939. },
  18940. "fixed-breadth": {
  18941. syntax: "<length-percentage>"
  18942. },
  18943. "fixed-repeat": {
  18944. syntax: "repeat( [ <positive-integer> ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
  18945. },
  18946. "fixed-size": {
  18947. syntax: "<fixed-breadth> | minmax( <fixed-breadth> , <track-breadth> ) | minmax( <inflexible-breadth> , <fixed-breadth> )"
  18948. },
  18949. "font-stretch-absolute": {
  18950. syntax: "normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage>"
  18951. },
  18952. "font-variant-css21": {
  18953. syntax: "[ normal | small-caps ]"
  18954. },
  18955. "font-weight-absolute": {
  18956. syntax: "normal | bold | <number>"
  18957. },
  18958. "frequency-percentage": {
  18959. syntax: "<frequency> | <percentage>"
  18960. },
  18961. "general-enclosed": {
  18962. syntax: "[ <function-token> <any-value> ) ] | ( <ident> <any-value> )"
  18963. },
  18964. "generic-family": {
  18965. syntax: "serif | sans-serif | cursive | fantasy | monospace"
  18966. },
  18967. "generic-name": {
  18968. syntax: "serif | sans-serif | cursive | fantasy | monospace"
  18969. },
  18970. "geometry-box": {
  18971. syntax: "<shape-box> | fill-box | stroke-box | view-box"
  18972. },
  18973. gradient: gradient,
  18974. "grayscale()": {
  18975. syntax: "grayscale( <number-percentage> )"
  18976. },
  18977. "grid-line": {
  18978. syntax: "auto | <custom-ident> | [ <integer> && <custom-ident>? ] | [ span && [ <integer> || <custom-ident> ] ]"
  18979. },
  18980. "historical-lig-values": {
  18981. syntax: "[ historical-ligatures | no-historical-ligatures ]"
  18982. },
  18983. "hsl()": {
  18984. syntax: "hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )"
  18985. },
  18986. "hsla()": {
  18987. syntax: "hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )"
  18988. },
  18989. hue: hue,
  18990. "hue-rotate()": {
  18991. syntax: "hue-rotate( <angle> )"
  18992. },
  18993. "id-selector": {
  18994. syntax: "<hash-token>"
  18995. },
  18996. image: image,
  18997. "image()": {
  18998. syntax: "image( <image-tags>? [ <image-src>? , <color>? ]! )"
  18999. },
  19000. "image-set()": {
  19001. syntax: "image-set( <image-set-option># )"
  19002. },
  19003. "image-set-option": {
  19004. syntax: "[ <image> | <string> ] <resolution>"
  19005. },
  19006. "image-src": {
  19007. syntax: "<url> | <string>"
  19008. },
  19009. "image-tags": {
  19010. syntax: "ltr | rtl"
  19011. },
  19012. "inflexible-breadth": {
  19013. syntax: "<length> | <percentage> | min-content | max-content | auto"
  19014. },
  19015. "inset()": {
  19016. syntax: "inset( <length-percentage>{1,4} [ round <'border-radius'> ]? )"
  19017. },
  19018. "invert()": {
  19019. syntax: "invert( <number-percentage> )"
  19020. },
  19021. "keyframes-name": {
  19022. syntax: "<custom-ident> | <string>"
  19023. },
  19024. "keyframe-block": {
  19025. syntax: "<keyframe-selector># {\n <declaration-list>\n}"
  19026. },
  19027. "keyframe-block-list": {
  19028. syntax: "<keyframe-block>+"
  19029. },
  19030. "keyframe-selector": {
  19031. syntax: "from | to | <percentage>"
  19032. },
  19033. "leader()": {
  19034. syntax: "leader( <leader-type> )"
  19035. },
  19036. "leader-type": {
  19037. syntax: "dotted | solid | space | <string>"
  19038. },
  19039. "length-percentage": {
  19040. syntax: "<length> | <percentage>"
  19041. },
  19042. "line-names": {
  19043. syntax: "'[' <custom-ident>* ']'"
  19044. },
  19045. "line-name-list": {
  19046. syntax: "[ <line-names> | <name-repeat> ]+"
  19047. },
  19048. "line-style": {
  19049. syntax: "none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset"
  19050. },
  19051. "line-width": {
  19052. syntax: "<length> | thin | medium | thick"
  19053. },
  19054. "linear-color-hint": {
  19055. syntax: "<length-percentage>"
  19056. },
  19057. "linear-color-stop": {
  19058. syntax: "<color> <color-stop-length>?"
  19059. },
  19060. "linear-gradient()": {
  19061. syntax: "linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
  19062. },
  19063. "mask-layer": {
  19064. syntax: "<mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode>"
  19065. },
  19066. "mask-position": {
  19067. syntax: "[ <length-percentage> | left | center | right ] [ <length-percentage> | top | center | bottom ]?"
  19068. },
  19069. "mask-reference": {
  19070. syntax: "none | <image> | <mask-source>"
  19071. },
  19072. "mask-source": {
  19073. syntax: "<url>"
  19074. },
  19075. "masking-mode": {
  19076. syntax: "alpha | luminance | match-source"
  19077. },
  19078. "matrix()": {
  19079. syntax: "matrix( <number>#{6} )"
  19080. },
  19081. "matrix3d()": {
  19082. syntax: "matrix3d( <number>#{16} )"
  19083. },
  19084. "max()": {
  19085. syntax: "max( <calc-sum># )"
  19086. },
  19087. "media-and": {
  19088. syntax: "<media-in-parens> [ and <media-in-parens> ]+"
  19089. },
  19090. "media-condition": {
  19091. syntax: "<media-not> | <media-and> | <media-or> | <media-in-parens>"
  19092. },
  19093. "media-condition-without-or": {
  19094. syntax: "<media-not> | <media-and> | <media-in-parens>"
  19095. },
  19096. "media-feature": {
  19097. syntax: "( [ <mf-plain> | <mf-boolean> | <mf-range> ] )"
  19098. },
  19099. "media-in-parens": {
  19100. syntax: "( <media-condition> ) | <media-feature> | <general-enclosed>"
  19101. },
  19102. "media-not": {
  19103. syntax: "not <media-in-parens>"
  19104. },
  19105. "media-or": {
  19106. syntax: "<media-in-parens> [ or <media-in-parens> ]+"
  19107. },
  19108. "media-query": {
  19109. syntax: "<media-condition> | [ not | only ]? <media-type> [ and <media-condition-without-or> ]?"
  19110. },
  19111. "media-query-list": {
  19112. syntax: "<media-query>#"
  19113. },
  19114. "media-type": {
  19115. syntax: "<ident>"
  19116. },
  19117. "mf-boolean": {
  19118. syntax: "<mf-name>"
  19119. },
  19120. "mf-name": {
  19121. syntax: "<ident>"
  19122. },
  19123. "mf-plain": {
  19124. syntax: "<mf-name> : <mf-value>"
  19125. },
  19126. "mf-range": {
  19127. syntax: "<mf-name> [ '<' | '>' ]? '='? <mf-value>\n| <mf-value> [ '<' | '>' ]? '='? <mf-name>\n| <mf-value> '<' '='? <mf-name> '<' '='? <mf-value>\n| <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>"
  19128. },
  19129. "mf-value": {
  19130. syntax: "<number> | <dimension> | <ident> | <ratio>"
  19131. },
  19132. "min()": {
  19133. syntax: "min( <calc-sum># )"
  19134. },
  19135. "minmax()": {
  19136. syntax: "minmax( [ <length> | <percentage> | <flex> | min-content | max-content | auto ] , [ <length> | <percentage> | <flex> | min-content | max-content | auto ] )"
  19137. },
  19138. "named-color": {
  19139. 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"
  19140. },
  19141. "namespace-prefix": {
  19142. syntax: "<ident>"
  19143. },
  19144. "ns-prefix": {
  19145. syntax: "[ <ident-token> | '*' ]? '|'"
  19146. },
  19147. "number-percentage": {
  19148. syntax: "<number> | <percentage>"
  19149. },
  19150. "numeric-figure-values": {
  19151. syntax: "[ lining-nums | oldstyle-nums ]"
  19152. },
  19153. "numeric-fraction-values": {
  19154. syntax: "[ diagonal-fractions | stacked-fractions ]"
  19155. },
  19156. "numeric-spacing-values": {
  19157. syntax: "[ proportional-nums | tabular-nums ]"
  19158. },
  19159. nth: nth,
  19160. "opacity()": {
  19161. syntax: "opacity( [ <number-percentage> ] )"
  19162. },
  19163. "overflow-position": {
  19164. syntax: "unsafe | safe"
  19165. },
  19166. "outline-radius": {
  19167. syntax: "<length> | <percentage>"
  19168. },
  19169. "page-body": {
  19170. syntax: "<declaration>? [ ; <page-body> ]? | <page-margin-box> <page-body>"
  19171. },
  19172. "page-margin-box": {
  19173. syntax: "<page-margin-box-type> '{' <declaration-list> '}'"
  19174. },
  19175. "page-margin-box-type": {
  19176. 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"
  19177. },
  19178. "page-selector-list": {
  19179. syntax: "[ <page-selector># ]?"
  19180. },
  19181. "page-selector": {
  19182. syntax: "<pseudo-page>+ | <ident> <pseudo-page>*"
  19183. },
  19184. "paint()": {
  19185. syntax: "paint( <ident>, <declaration-value>? )"
  19186. },
  19187. "perspective()": {
  19188. syntax: "perspective( <length> )"
  19189. },
  19190. "polygon()": {
  19191. syntax: "polygon( <fill-rule>? , [ <length-percentage> <length-percentage> ]# )"
  19192. },
  19193. position: position$1,
  19194. "pseudo-class-selector": {
  19195. syntax: "':' <ident-token> | ':' <function-token> <any-value> ')'"
  19196. },
  19197. "pseudo-element-selector": {
  19198. syntax: "':' <pseudo-class-selector>"
  19199. },
  19200. "pseudo-page": {
  19201. syntax: ": [ left | right | first | blank ]"
  19202. },
  19203. quote: quote,
  19204. "radial-gradient()": {
  19205. syntax: "radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
  19206. },
  19207. "relative-selector": {
  19208. syntax: "<combinator>? <complex-selector>"
  19209. },
  19210. "relative-selector-list": {
  19211. syntax: "<relative-selector>#"
  19212. },
  19213. "relative-size": {
  19214. syntax: "larger | smaller"
  19215. },
  19216. "repeat-style": {
  19217. syntax: "repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2}"
  19218. },
  19219. "repeating-linear-gradient()": {
  19220. syntax: "repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
  19221. },
  19222. "repeating-radial-gradient()": {
  19223. syntax: "repeating-radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
  19224. },
  19225. "rgb()": {
  19226. syntax: "rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )"
  19227. },
  19228. "rgba()": {
  19229. syntax: "rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )"
  19230. },
  19231. "rotate()": {
  19232. syntax: "rotate( [ <angle> | <zero> ] )"
  19233. },
  19234. "rotate3d()": {
  19235. syntax: "rotate3d( <number> , <number> , <number> , [ <angle> | <zero> ] )"
  19236. },
  19237. "rotateX()": {
  19238. syntax: "rotateX( [ <angle> | <zero> ] )"
  19239. },
  19240. "rotateY()": {
  19241. syntax: "rotateY( [ <angle> | <zero> ] )"
  19242. },
  19243. "rotateZ()": {
  19244. syntax: "rotateZ( [ <angle> | <zero> ] )"
  19245. },
  19246. "saturate()": {
  19247. syntax: "saturate( <number-percentage> )"
  19248. },
  19249. "scale()": {
  19250. syntax: "scale( <number> , <number>? )"
  19251. },
  19252. "scale3d()": {
  19253. syntax: "scale3d( <number> , <number> , <number> )"
  19254. },
  19255. "scaleX()": {
  19256. syntax: "scaleX( <number> )"
  19257. },
  19258. "scaleY()": {
  19259. syntax: "scaleY( <number> )"
  19260. },
  19261. "scaleZ()": {
  19262. syntax: "scaleZ( <number> )"
  19263. },
  19264. "self-position": {
  19265. syntax: "center | start | end | self-start | self-end | flex-start | flex-end"
  19266. },
  19267. "shape-radius": {
  19268. syntax: "<length-percentage> | closest-side | farthest-side"
  19269. },
  19270. "skew()": {
  19271. syntax: "skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? )"
  19272. },
  19273. "skewX()": {
  19274. syntax: "skewX( [ <angle> | <zero> ] )"
  19275. },
  19276. "skewY()": {
  19277. syntax: "skewY( [ <angle> | <zero> ] )"
  19278. },
  19279. "sepia()": {
  19280. syntax: "sepia( <number-percentage> )"
  19281. },
  19282. shadow: shadow,
  19283. "shadow-t": {
  19284. syntax: "[ <length>{2,3} && <color>? ]"
  19285. },
  19286. shape: shape$1,
  19287. "shape-box": {
  19288. syntax: "<box> | margin-box"
  19289. },
  19290. "side-or-corner": {
  19291. syntax: "[ left | right ] || [ top | bottom ]"
  19292. },
  19293. "single-animation": {
  19294. syntax: "<time> || <timing-function> || <time> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state> || [ none | <keyframes-name> ]"
  19295. },
  19296. "single-animation-direction": {
  19297. syntax: "normal | reverse | alternate | alternate-reverse"
  19298. },
  19299. "single-animation-fill-mode": {
  19300. syntax: "none | forwards | backwards | both"
  19301. },
  19302. "single-animation-iteration-count": {
  19303. syntax: "infinite | <number>"
  19304. },
  19305. "single-animation-play-state": {
  19306. syntax: "running | paused"
  19307. },
  19308. "single-transition": {
  19309. syntax: "[ none | <single-transition-property> ] || <time> || <timing-function> || <time>"
  19310. },
  19311. "single-transition-property": {
  19312. syntax: "all | <custom-ident>"
  19313. },
  19314. size: size,
  19315. "step-position": {
  19316. syntax: "jump-start | jump-end | jump-none | jump-both | start | end"
  19317. },
  19318. "step-timing-function": {
  19319. syntax: "step-start | step-end | steps(<integer>[, <step-position>]?)"
  19320. },
  19321. "subclass-selector": {
  19322. syntax: "<id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector>"
  19323. },
  19324. "supports-condition": {
  19325. syntax: "not <supports-in-parens> | <supports-in-parens> [ and <supports-in-parens> ]* | <supports-in-parens> [ or <supports-in-parens> ]*"
  19326. },
  19327. "supports-in-parens": {
  19328. syntax: "( <supports-condition> ) | <supports-feature> | <general-enclosed>"
  19329. },
  19330. "supports-feature": {
  19331. syntax: "<supports-decl> | <supports-selector-fn>"
  19332. },
  19333. "supports-decl": {
  19334. syntax: "( <declaration> )"
  19335. },
  19336. "supports-selector-fn": {
  19337. syntax: "selector( <complex-selector> )"
  19338. },
  19339. symbol: symbol,
  19340. target: target,
  19341. "target-counter()": {
  19342. syntax: "target-counter( [ <string> | <url> ] , <custom-ident> , <counter-style>? )"
  19343. },
  19344. "target-counters()": {
  19345. syntax: "target-counters( [ <string> | <url> ] , <custom-ident> , <string> , <counter-style>? )"
  19346. },
  19347. "target-text()": {
  19348. syntax: "target-text( [ <string> | <url> ] , [ content | before | after | first-letter ]? )"
  19349. },
  19350. "time-percentage": {
  19351. syntax: "<time> | <percentage>"
  19352. },
  19353. "timing-function": {
  19354. syntax: "linear | <cubic-bezier-timing-function> | <step-timing-function>"
  19355. },
  19356. "track-breadth": {
  19357. syntax: "<length-percentage> | <flex> | min-content | max-content | auto"
  19358. },
  19359. "track-list": {
  19360. syntax: "[ <line-names>? [ <track-size> | <track-repeat> ] ]+ <line-names>?"
  19361. },
  19362. "track-repeat": {
  19363. syntax: "repeat( [ <positive-integer> ] , [ <line-names>? <track-size> ]+ <line-names>? )"
  19364. },
  19365. "track-size": {
  19366. syntax: "<track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] )"
  19367. },
  19368. "transform-function": {
  19369. syntax: "<matrix()> | <translate()> | <translateX()> | <translateY()> | <scale()> | <scaleX()> | <scaleY()> | <rotate()> | <skew()> | <skewX()> | <skewY()> | <matrix3d()> | <translate3d()> | <translateZ()> | <scale3d()> | <scaleZ()> | <rotate3d()> | <rotateX()> | <rotateY()> | <rotateZ()> | <perspective()>"
  19370. },
  19371. "transform-list": {
  19372. syntax: "<transform-function>+"
  19373. },
  19374. "translate()": {
  19375. syntax: "translate( <length-percentage> , <length-percentage>? )"
  19376. },
  19377. "translate3d()": {
  19378. syntax: "translate3d( <length-percentage> , <length-percentage> , <length> )"
  19379. },
  19380. "translateX()": {
  19381. syntax: "translateX( <length-percentage> )"
  19382. },
  19383. "translateY()": {
  19384. syntax: "translateY( <length-percentage> )"
  19385. },
  19386. "translateZ()": {
  19387. syntax: "translateZ( <length> )"
  19388. },
  19389. "type-or-unit": {
  19390. 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 | %"
  19391. },
  19392. "type-selector": {
  19393. syntax: "<wq-name> | <ns-prefix>? '*'"
  19394. },
  19395. "var()": {
  19396. syntax: "var( <custom-property-name> , <declaration-value>? )"
  19397. },
  19398. "viewport-length": {
  19399. syntax: "auto | <length-percentage>"
  19400. },
  19401. "wq-name": {
  19402. syntax: "<ns-prefix>? <ident-token>"
  19403. }
  19404. };
  19405. var syntaxes$1 = /*#__PURE__*/Object.freeze({
  19406. __proto__: null,
  19407. attachment: attachment,
  19408. box: box,
  19409. color: color$1,
  19410. combinator: combinator,
  19411. compat: compat,
  19412. gradient: gradient,
  19413. hue: hue,
  19414. image: image,
  19415. nth: nth,
  19416. position: position$1,
  19417. quote: quote,
  19418. shadow: shadow,
  19419. shape: shape$1,
  19420. size: size,
  19421. symbol: symbol,
  19422. target: target,
  19423. 'default': syntaxes
  19424. });
  19425. var properties$3 = {
  19426. "-moz-background-clip": {
  19427. comment: "deprecated syntax in old Firefox, https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
  19428. syntax: "padding | border"
  19429. },
  19430. "-moz-border-radius-bottomleft": {
  19431. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-left-radius",
  19432. syntax: "<'border-bottom-left-radius'>"
  19433. },
  19434. "-moz-border-radius-bottomright": {
  19435. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
  19436. syntax: "<'border-bottom-right-radius'>"
  19437. },
  19438. "-moz-border-radius-topleft": {
  19439. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-top-left-radius",
  19440. syntax: "<'border-top-left-radius'>"
  19441. },
  19442. "-moz-border-radius-topright": {
  19443. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
  19444. syntax: "<'border-bottom-right-radius'>"
  19445. },
  19446. "-moz-control-character-visibility": {
  19447. comment: "firefox specific keywords, https://bugzilla.mozilla.org/show_bug.cgi?id=947588",
  19448. syntax: "visible | hidden"
  19449. },
  19450. "-moz-osx-font-smoothing": {
  19451. comment: "misssed old syntax https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
  19452. syntax: "auto | grayscale"
  19453. },
  19454. "-moz-user-select": {
  19455. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
  19456. syntax: "none | text | all | -moz-none"
  19457. },
  19458. "-ms-flex-align": {
  19459. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
  19460. syntax: "start | end | center | baseline | stretch"
  19461. },
  19462. "-ms-flex-item-align": {
  19463. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
  19464. syntax: "auto | start | end | center | baseline | stretch"
  19465. },
  19466. "-ms-flex-line-pack": {
  19467. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-line-pack",
  19468. syntax: "start | end | center | justify | distribute | stretch"
  19469. },
  19470. "-ms-flex-negative": {
  19471. comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
  19472. syntax: "<'flex-shrink'>"
  19473. },
  19474. "-ms-flex-pack": {
  19475. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-pack",
  19476. syntax: "start | end | center | justify | distribute"
  19477. },
  19478. "-ms-flex-order": {
  19479. comment: "misssed old syntax implemented in IE; https://msdn.microsoft.com/en-us/library/jj127303(v=vs.85).aspx",
  19480. syntax: "<integer>"
  19481. },
  19482. "-ms-flex-positive": {
  19483. comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
  19484. syntax: "<'flex-grow'>"
  19485. },
  19486. "-ms-flex-preferred-size": {
  19487. comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
  19488. syntax: "<'flex-basis'>"
  19489. },
  19490. "-ms-interpolation-mode": {
  19491. comment: "https://msdn.microsoft.com/en-us/library/ff521095(v=vs.85).aspx",
  19492. syntax: "nearest-neighbor | bicubic"
  19493. },
  19494. "-ms-grid-column-align": {
  19495. comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466338.aspx",
  19496. syntax: "start | end | center | stretch"
  19497. },
  19498. "-ms-grid-columns": {
  19499. comment: "misssed old syntax implemented in IE; https://www.w3.org/TR/2012/WD-css3-grid-layout-20120322/#grid-columns",
  19500. syntax: "<track-list-v0>"
  19501. },
  19502. "-ms-grid-row-align": {
  19503. comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466348.aspx",
  19504. syntax: "start | end | center | stretch"
  19505. },
  19506. "-ms-grid-rows": {
  19507. comment: "misssed old syntax implemented in IE; https://www.w3.org/TR/2012/WD-css3-grid-layout-20120322/#grid-rows",
  19508. syntax: "<track-list-v0>"
  19509. },
  19510. "-ms-hyphenate-limit-last": {
  19511. comment: "misssed old syntax implemented in IE; https://www.w3.org/TR/css-text-4/#hyphenate-line-limits",
  19512. syntax: "none | always | column | page | spread"
  19513. },
  19514. "-webkit-appearance": {
  19515. comment: "webkit specific keywords",
  19516. references: [
  19517. "http://css-infos.net/property/-webkit-appearance"
  19518. ],
  19519. 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"
  19520. },
  19521. "-webkit-background-clip": {
  19522. comment: "https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
  19523. syntax: "[ <box> | border | padding | content | text ]#"
  19524. },
  19525. "-webkit-column-break-after": {
  19526. comment: "added, http://help.dottoro.com/lcrthhhv.php",
  19527. syntax: "always | auto | avoid"
  19528. },
  19529. "-webkit-column-break-before": {
  19530. comment: "added, http://help.dottoro.com/lcxquvkf.php",
  19531. syntax: "always | auto | avoid"
  19532. },
  19533. "-webkit-column-break-inside": {
  19534. comment: "added, http://help.dottoro.com/lclhnthl.php",
  19535. syntax: "always | auto | avoid"
  19536. },
  19537. "-webkit-font-smoothing": {
  19538. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
  19539. syntax: "auto | none | antialiased | subpixel-antialiased"
  19540. },
  19541. "-webkit-mask-box-image": {
  19542. comment: "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
  19543. syntax: "[ <url> | <gradient> | none ] [ <length-percentage>{4} <-webkit-mask-box-repeat>{2} ]?"
  19544. },
  19545. "-webkit-print-color-adjust": {
  19546. comment: "missed",
  19547. references: [
  19548. "https://developer.mozilla.org/en/docs/Web/CSS/-webkit-print-color-adjust"
  19549. ],
  19550. syntax: "economy | exact"
  19551. },
  19552. "-webkit-text-security": {
  19553. comment: "missed; http://help.dottoro.com/lcbkewgt.php",
  19554. syntax: "none | circle | disc | square"
  19555. },
  19556. "-webkit-user-drag": {
  19557. comment: "missed; http://help.dottoro.com/lcbixvwm.php",
  19558. syntax: "none | element | auto"
  19559. },
  19560. "-webkit-user-select": {
  19561. comment: "auto is supported by old webkit, https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
  19562. syntax: "auto | none | text | all"
  19563. },
  19564. "alignment-baseline": {
  19565. comment: "added SVG property",
  19566. references: [
  19567. "https://www.w3.org/TR/SVG/text.html#AlignmentBaselineProperty"
  19568. ],
  19569. syntax: "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical"
  19570. },
  19571. "baseline-shift": {
  19572. comment: "added SVG property",
  19573. references: [
  19574. "https://www.w3.org/TR/SVG/text.html#BaselineShiftProperty"
  19575. ],
  19576. syntax: "baseline | sub | super | <svg-length>"
  19577. },
  19578. behavior: {
  19579. comment: "added old IE property https://msdn.microsoft.com/en-us/library/ms530723(v=vs.85).aspx",
  19580. syntax: "<url>+"
  19581. },
  19582. "clip-rule": {
  19583. comment: "added SVG property",
  19584. references: [
  19585. "https://www.w3.org/TR/SVG/masking.html#ClipRuleProperty"
  19586. ],
  19587. syntax: "nonzero | evenodd"
  19588. },
  19589. cue: {
  19590. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19591. syntax: "<'cue-before'> <'cue-after'>?"
  19592. },
  19593. "cue-after": {
  19594. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19595. syntax: "<url> <decibel>? | none"
  19596. },
  19597. "cue-before": {
  19598. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19599. syntax: "<url> <decibel>? | none"
  19600. },
  19601. cursor: {
  19602. 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",
  19603. references: [
  19604. "https://www.sitepoint.com/css3-cursor-styles/"
  19605. ],
  19606. 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 ] ]"
  19607. },
  19608. display: {
  19609. comment: "extended with -ms-flexbox",
  19610. 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"
  19611. },
  19612. position: {
  19613. comment: "extended with -webkit-sticky",
  19614. syntax: "static | relative | absolute | sticky | fixed | -webkit-sticky"
  19615. },
  19616. "dominant-baseline": {
  19617. comment: "added SVG property",
  19618. references: [
  19619. "https://www.w3.org/TR/SVG/text.html#DominantBaselineProperty"
  19620. ],
  19621. syntax: "auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge"
  19622. },
  19623. "image-rendering": {
  19624. comment: "extended with <-non-standard-image-rendering>, added SVG keywords optimizeSpeed and optimizeQuality",
  19625. references: [
  19626. "https://developer.mozilla.org/en/docs/Web/CSS/image-rendering",
  19627. "https://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty"
  19628. ],
  19629. syntax: "auto | crisp-edges | pixelated | optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>"
  19630. },
  19631. fill: {
  19632. comment: "added SVG property",
  19633. references: [
  19634. "https://www.w3.org/TR/SVG/painting.html#FillProperty"
  19635. ],
  19636. syntax: "<paint>"
  19637. },
  19638. "fill-opacity": {
  19639. comment: "added SVG property",
  19640. references: [
  19641. "https://www.w3.org/TR/SVG/painting.html#FillProperty"
  19642. ],
  19643. syntax: "<number-zero-one>"
  19644. },
  19645. "fill-rule": {
  19646. comment: "added SVG property",
  19647. references: [
  19648. "https://www.w3.org/TR/SVG/painting.html#FillProperty"
  19649. ],
  19650. syntax: "nonzero | evenodd"
  19651. },
  19652. filter: {
  19653. comment: "extend with IE legacy syntaxes",
  19654. syntax: "none | <filter-function-list> | <-ms-filter-function-list>"
  19655. },
  19656. "glyph-orientation-horizontal": {
  19657. comment: "added SVG property",
  19658. references: [
  19659. "https://www.w3.org/TR/SVG/text.html#GlyphOrientationHorizontalProperty"
  19660. ],
  19661. syntax: "<angle>"
  19662. },
  19663. "glyph-orientation-vertical": {
  19664. comment: "added SVG property",
  19665. references: [
  19666. "https://www.w3.org/TR/SVG/text.html#GlyphOrientationVerticalProperty"
  19667. ],
  19668. syntax: "<angle>"
  19669. },
  19670. kerning: {
  19671. comment: "added SVG property",
  19672. references: [
  19673. "https://www.w3.org/TR/SVG/text.html#KerningProperty"
  19674. ],
  19675. syntax: "auto | <svg-length>"
  19676. },
  19677. "letter-spacing": {
  19678. comment: "fix syntax <length> -> <length-percentage>",
  19679. references: [
  19680. "https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/letter-spacing"
  19681. ],
  19682. syntax: "normal | <length-percentage>"
  19683. },
  19684. marker: {
  19685. comment: "added SVG property",
  19686. references: [
  19687. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  19688. ],
  19689. syntax: "none | <url>"
  19690. },
  19691. "marker-end": {
  19692. comment: "added SVG property",
  19693. references: [
  19694. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  19695. ],
  19696. syntax: "none | <url>"
  19697. },
  19698. "marker-mid": {
  19699. comment: "added SVG property",
  19700. references: [
  19701. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  19702. ],
  19703. syntax: "none | <url>"
  19704. },
  19705. "marker-start": {
  19706. comment: "added SVG property",
  19707. references: [
  19708. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  19709. ],
  19710. syntax: "none | <url>"
  19711. },
  19712. "max-width": {
  19713. comment: "extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/max-width",
  19714. syntax: "<length> | <percentage> | none | max-content | min-content | fit-content | fill-available | <-non-standard-width>"
  19715. },
  19716. "min-width": {
  19717. comment: "extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
  19718. syntax: "<length> | <percentage> | auto | max-content | min-content | fit-content | fill-available | <-non-standard-width>"
  19719. },
  19720. opacity: {
  19721. comment: "strict to 0..1 <number> -> <number-zero-one>",
  19722. syntax: "<number-zero-one>"
  19723. },
  19724. overflow: {
  19725. comment: "extend by vendor keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
  19726. syntax: "[ visible | hidden | clip | scroll | auto ]{1,2} | <-non-standard-overflow>"
  19727. },
  19728. pause: {
  19729. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19730. syntax: "<'pause-before'> <'pause-after'>?"
  19731. },
  19732. "pause-after": {
  19733. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19734. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  19735. },
  19736. "pause-before": {
  19737. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19738. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  19739. },
  19740. rest: {
  19741. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19742. syntax: "<'rest-before'> <'rest-after'>?"
  19743. },
  19744. "rest-after": {
  19745. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19746. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  19747. },
  19748. "rest-before": {
  19749. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19750. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  19751. },
  19752. "shape-rendering": {
  19753. comment: "added SVG property",
  19754. references: [
  19755. "https://www.w3.org/TR/SVG/painting.html#ShapeRenderingPropert"
  19756. ],
  19757. syntax: "auto | optimizeSpeed | crispEdges | geometricPrecision"
  19758. },
  19759. src: {
  19760. comment: "added @font-face's src property https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src",
  19761. syntax: "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#"
  19762. },
  19763. speak: {
  19764. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19765. syntax: "auto | none | normal"
  19766. },
  19767. "speak-as": {
  19768. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19769. syntax: "normal | spell-out || digits || [ literal-punctuation | no-punctuation ]"
  19770. },
  19771. stroke: {
  19772. comment: "added SVG property",
  19773. references: [
  19774. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19775. ],
  19776. syntax: "<paint>"
  19777. },
  19778. "stroke-dasharray": {
  19779. comment: "added SVG property; a list of comma and/or white space separated <length>s and <percentage>s",
  19780. references: [
  19781. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19782. ],
  19783. syntax: "none | [ <svg-length>+ ]#"
  19784. },
  19785. "stroke-dashoffset": {
  19786. comment: "added SVG property",
  19787. references: [
  19788. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19789. ],
  19790. syntax: "<svg-length>"
  19791. },
  19792. "stroke-linecap": {
  19793. comment: "added SVG property",
  19794. references: [
  19795. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19796. ],
  19797. syntax: "butt | round | square"
  19798. },
  19799. "stroke-linejoin": {
  19800. comment: "added SVG property",
  19801. references: [
  19802. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19803. ],
  19804. syntax: "miter | round | bevel"
  19805. },
  19806. "stroke-miterlimit": {
  19807. comment: "added SVG property (<miterlimit> = <number-one-or-greater>) ",
  19808. references: [
  19809. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19810. ],
  19811. syntax: "<number-one-or-greater>"
  19812. },
  19813. "stroke-opacity": {
  19814. comment: "added SVG property",
  19815. references: [
  19816. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19817. ],
  19818. syntax: "<number-zero-one>"
  19819. },
  19820. "stroke-width": {
  19821. comment: "added SVG property",
  19822. references: [
  19823. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19824. ],
  19825. syntax: "<svg-length>"
  19826. },
  19827. "text-anchor": {
  19828. comment: "added SVG property",
  19829. references: [
  19830. "https://www.w3.org/TR/SVG/text.html#TextAlignmentProperties"
  19831. ],
  19832. syntax: "start | middle | end"
  19833. },
  19834. "unicode-bidi": {
  19835. comment: "added prefixed keywords https://developer.mozilla.org/en-US/docs/Web/CSS/unicode-bidi",
  19836. syntax: "normal | embed | isolate | bidi-override | isolate-override | plaintext | -moz-isolate | -moz-isolate-override | -moz-plaintext | -webkit-isolate"
  19837. },
  19838. "unicode-range": {
  19839. comment: "added missed property https://developer.mozilla.org/en-US/docs/Web/CSS/%40font-face/unicode-range",
  19840. syntax: "<urange>#"
  19841. },
  19842. "voice-balance": {
  19843. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19844. syntax: "<number> | left | center | right | leftwards | rightwards"
  19845. },
  19846. "voice-duration": {
  19847. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19848. syntax: "auto | <time>"
  19849. },
  19850. "voice-family": {
  19851. comment: "<name> -> <family-name>, https://www.w3.org/TR/css3-speech/#property-index",
  19852. syntax: "[ [ <family-name> | <generic-voice> ] , ]* [ <family-name> | <generic-voice> ] | preserve"
  19853. },
  19854. "voice-pitch": {
  19855. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19856. syntax: "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
  19857. },
  19858. "voice-range": {
  19859. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19860. syntax: "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
  19861. },
  19862. "voice-rate": {
  19863. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19864. syntax: "[ normal | x-slow | slow | medium | fast | x-fast ] || <percentage>"
  19865. },
  19866. "voice-stress": {
  19867. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19868. syntax: "normal | strong | moderate | none | reduced"
  19869. },
  19870. "voice-volume": {
  19871. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19872. syntax: "silent | [ [ x-soft | soft | medium | loud | x-loud ] || <decibel> ]"
  19873. },
  19874. "writing-mode": {
  19875. comment: "extend with SVG keywords",
  19876. syntax: "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr | <svg-writing-mode>"
  19877. }
  19878. };
  19879. var syntaxes$2 = {
  19880. "-legacy-gradient": {
  19881. comment: "added collection of legacy gradient syntaxes",
  19882. syntax: "<-webkit-gradient()> | <-legacy-linear-gradient> | <-legacy-repeating-linear-gradient> | <-legacy-radial-gradient> | <-legacy-repeating-radial-gradient>"
  19883. },
  19884. "-legacy-linear-gradient": {
  19885. comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
  19886. syntax: "-moz-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-linear-gradient( <-legacy-linear-gradient-arguments> )"
  19887. },
  19888. "-legacy-repeating-linear-gradient": {
  19889. comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
  19890. 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> )"
  19891. },
  19892. "-legacy-linear-gradient-arguments": {
  19893. comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
  19894. syntax: "[ <angle> | <side-or-corner> ]? , <color-stop-list>"
  19895. },
  19896. "-legacy-radial-gradient": {
  19897. comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
  19898. syntax: "-moz-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-radial-gradient( <-legacy-radial-gradient-arguments> )"
  19899. },
  19900. "-legacy-repeating-radial-gradient": {
  19901. comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
  19902. 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> )"
  19903. },
  19904. "-legacy-radial-gradient-arguments": {
  19905. comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
  19906. syntax: "[ <position> , ]? [ [ [ <-legacy-radial-gradient-shape> || <-legacy-radial-gradient-size> ] | [ <length> | <percentage> ]{2} ] , ]? <color-stop-list>"
  19907. },
  19908. "-legacy-radial-gradient-size": {
  19909. comment: "before a standard it contains 2 extra keywords (`contain` and `cover`) https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltsize",
  19910. syntax: "closest-side | closest-corner | farthest-side | farthest-corner | contain | cover"
  19911. },
  19912. "-legacy-radial-gradient-shape": {
  19913. comment: "define to double sure it doesn't extends in future https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltshape",
  19914. syntax: "circle | ellipse"
  19915. },
  19916. "-non-standard-font": {
  19917. comment: "non standard fonts",
  19918. references: [
  19919. "https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
  19920. ],
  19921. 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"
  19922. },
  19923. "-non-standard-color": {
  19924. comment: "non standard colors",
  19925. references: [
  19926. "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",
  19927. "https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Mozilla_Color_Preference_Extensions"
  19928. ],
  19929. 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"
  19930. },
  19931. "-non-standard-image-rendering": {
  19932. comment: "non-standard keywords http://phrogz.net/tmp/canvas_image_zoom.html",
  19933. syntax: "optimize-contrast | -moz-crisp-edges | -o-crisp-edges | -webkit-optimize-contrast"
  19934. },
  19935. "-non-standard-overflow": {
  19936. comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
  19937. syntax: "-moz-scrollbars-none | -moz-scrollbars-horizontal | -moz-scrollbars-vertical | -moz-hidden-unscrollable"
  19938. },
  19939. "-non-standard-width": {
  19940. comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
  19941. syntax: "min-intrinsic | intrinsic | -moz-min-content | -moz-max-content | -webkit-min-content | -webkit-max-content"
  19942. },
  19943. "-webkit-gradient()": {
  19944. 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 )",
  19945. 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>]* )"
  19946. },
  19947. "-webkit-gradient-color-stop": {
  19948. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  19949. syntax: "from( <color> ) | color-stop( [ <number-zero-one> | <percentage> ] , <color> ) | to( <color> )"
  19950. },
  19951. "-webkit-gradient-point": {
  19952. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  19953. syntax: "[ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]"
  19954. },
  19955. "-webkit-gradient-radius": {
  19956. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  19957. syntax: "<length> | <percentage>"
  19958. },
  19959. "-webkit-gradient-type": {
  19960. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  19961. syntax: "linear | radial"
  19962. },
  19963. "-webkit-mask-box-repeat": {
  19964. comment: "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
  19965. syntax: "repeat | stretch | round"
  19966. },
  19967. "-webkit-mask-clip-style": {
  19968. comment: "missed; there is no enough information about `-webkit-mask-clip` property, but looks like all those keywords are working",
  19969. syntax: "border | border-box | padding | padding-box | content | content-box | text"
  19970. },
  19971. "-ms-filter-function-list": {
  19972. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  19973. syntax: "<-ms-filter-function>+"
  19974. },
  19975. "-ms-filter-function": {
  19976. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  19977. syntax: "<-ms-filter-function-progid> | <-ms-filter-function-legacy>"
  19978. },
  19979. "-ms-filter-function-progid": {
  19980. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  19981. syntax: "'progid:' [ <ident-token> '.' ]* [ <ident-token> | <function-token> <any-value>? ) ]"
  19982. },
  19983. "-ms-filter-function-legacy": {
  19984. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  19985. syntax: "<ident-token> | <function-token> <any-value>? )"
  19986. },
  19987. "-ms-filter": {
  19988. syntax: "<string>"
  19989. },
  19990. age: {
  19991. comment: "https://www.w3.org/TR/css3-speech/#voice-family",
  19992. syntax: "child | young | old"
  19993. },
  19994. "attr-name": {
  19995. syntax: "<wq-name>"
  19996. },
  19997. "attr-fallback": {
  19998. syntax: "<any-value>"
  19999. },
  20000. "border-radius": {
  20001. comment: "missed, https://drafts.csswg.org/css-backgrounds-3/#the-border-radius",
  20002. syntax: "<length-percentage>{1,2}"
  20003. },
  20004. bottom: {
  20005. 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",
  20006. syntax: "<length> | auto"
  20007. },
  20008. "content-list": {
  20009. comment: "missed -> https://drafts.csswg.org/css-content/#typedef-content-list (document-url, <target> and leader() is omitted util stabilization)",
  20010. syntax: "[ <string> | contents | <url> | <quote> | <attr()> | counter( <ident>, <'list-style-type'>? ) ]+"
  20011. },
  20012. "generic-voice": {
  20013. comment: "https://www.w3.org/TR/css3-speech/#voice-family",
  20014. syntax: "[ <age>? <gender> <integer>? ]"
  20015. },
  20016. gender: {
  20017. comment: "https://www.w3.org/TR/css3-speech/#voice-family",
  20018. syntax: "male | female | neutral"
  20019. },
  20020. "generic-family": {
  20021. comment: "added -apple-system",
  20022. references: [
  20023. "https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
  20024. ],
  20025. syntax: "serif | sans-serif | cursive | fantasy | monospace | -apple-system"
  20026. },
  20027. gradient: {
  20028. comment: "added legacy syntaxes support",
  20029. syntax: "<linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()> | <-legacy-gradient>"
  20030. },
  20031. left: {
  20032. 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",
  20033. syntax: "<length> | auto"
  20034. },
  20035. "mask-image": {
  20036. comment: "missed; https://drafts.fxtf.org/css-masking-1/#the-mask-image",
  20037. syntax: "<mask-reference>#"
  20038. },
  20039. "name-repeat": {
  20040. 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",
  20041. syntax: "repeat( [ <positive-integer> | auto-fill ], <line-names>+)"
  20042. },
  20043. "named-color": {
  20044. comment: "added non standard color names",
  20045. 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>"
  20046. },
  20047. paint: {
  20048. comment: "used by SVG https://www.w3.org/TR/SVG/painting.html#SpecifyingPaint",
  20049. syntax: "none | <color> | <url> [ none | <color> ]? | context-fill | context-stroke"
  20050. },
  20051. "path()": {
  20052. 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",
  20053. syntax: "path( <string> )"
  20054. },
  20055. ratio: {
  20056. comment: "missed, https://drafts.csswg.org/mediaqueries-4/#typedef-ratio",
  20057. syntax: "<integer> / <integer>"
  20058. },
  20059. right: {
  20060. 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",
  20061. syntax: "<length> | auto"
  20062. },
  20063. shape: {
  20064. comment: "missed spaces in function body and add backwards compatible syntax",
  20065. syntax: "rect( <top>, <right>, <bottom>, <left> ) | rect( <top> <right> <bottom> <left> )"
  20066. },
  20067. "svg-length": {
  20068. comment: "All coordinates and lengths in SVG can be specified with or without a unit identifier",
  20069. references: [
  20070. "https://www.w3.org/TR/SVG11/coords.html#Units"
  20071. ],
  20072. syntax: "<percentage> | <length> | <number>"
  20073. },
  20074. "svg-writing-mode": {
  20075. comment: "SVG specific keywords (deprecated for CSS)",
  20076. references: [
  20077. "https://developer.mozilla.org/en/docs/Web/CSS/writing-mode",
  20078. "https://www.w3.org/TR/SVG/text.html#WritingModeProperty"
  20079. ],
  20080. syntax: "lr-tb | rl-tb | tb-rl | lr | rl | tb"
  20081. },
  20082. top: {
  20083. 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",
  20084. syntax: "<length> | auto"
  20085. },
  20086. "track-group": {
  20087. comment: "used by old grid-columns and grid-rows syntax v0",
  20088. syntax: "'(' [ <string>* <track-minmax> <string>* ]+ ')' [ '[' <positive-integer> ']' ]? | <track-minmax>"
  20089. },
  20090. "track-list-v0": {
  20091. comment: "used by old grid-columns and grid-rows syntax v0",
  20092. syntax: "[ <string>* <track-group> <string>* ]+ | none"
  20093. },
  20094. "track-minmax": {
  20095. comment: "used by old grid-columns and grid-rows syntax v0",
  20096. syntax: "minmax( <track-breadth> , <track-breadth> ) | auto | <track-breadth> | fit-content"
  20097. },
  20098. x: {
  20099. 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",
  20100. syntax: "<number>"
  20101. },
  20102. y: {
  20103. 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",
  20104. syntax: "<number>"
  20105. },
  20106. declaration: {
  20107. comment: "missed, restored by https://drafts.csswg.org/css-syntax",
  20108. syntax: "<ident-token> : <declaration-value>? [ '!' important ]?"
  20109. },
  20110. "declaration-list": {
  20111. comment: "missed, restored by https://drafts.csswg.org/css-syntax",
  20112. syntax: "[ <declaration>? ';' ]* <declaration>?"
  20113. },
  20114. url: {
  20115. comment: "https://drafts.csswg.org/css-values-4/#urls",
  20116. syntax: "url( <string> <url-modifier>* ) | <url-token>"
  20117. },
  20118. "url-modifier": {
  20119. comment: "https://drafts.csswg.org/css-values-4/#typedef-url-modifier",
  20120. syntax: "<ident> | <function-token> <any-value> )"
  20121. },
  20122. "number-zero-one": {
  20123. syntax: "<number [0,1]>"
  20124. },
  20125. "number-one-or-greater": {
  20126. syntax: "<number [1,∞]>"
  20127. },
  20128. "positive-integer": {
  20129. syntax: "<integer [0,∞]>"
  20130. }
  20131. };
  20132. var patch = {
  20133. properties: properties$3,
  20134. syntaxes: syntaxes$2
  20135. };
  20136. var patch$1 = /*#__PURE__*/Object.freeze({
  20137. __proto__: null,
  20138. properties: properties$3,
  20139. syntaxes: syntaxes$2,
  20140. 'default': patch
  20141. });
  20142. var mdnAtrules = getCjsExportFromNamespace(atRules$1);
  20143. var mdnProperties = getCjsExportFromNamespace(properties$2);
  20144. var mdnSyntaxes = getCjsExportFromNamespace(syntaxes$1);
  20145. var patch$2 = getCjsExportFromNamespace(patch$1);
  20146. function preprocessAtrules(dict) {
  20147. var result = Object.create(null);
  20148. for (var atruleName in dict) {
  20149. var atrule = dict[atruleName];
  20150. var descriptors = null;
  20151. if (atrule.descriptors) {
  20152. descriptors = Object.create(null);
  20153. for (var descriptor in atrule.descriptors) {
  20154. descriptors[descriptor] = atrule.descriptors[descriptor].syntax;
  20155. }
  20156. }
  20157. result[atruleName.substr(1)] = {
  20158. prelude: atrule.syntax.trim().match(/^@\S+\s+([^;\{]*)/)[1].trim() || null,
  20159. descriptors
  20160. };
  20161. }
  20162. return result;
  20163. }
  20164. function buildDictionary(dict, patchDict) {
  20165. var result = {};
  20166. // copy all syntaxes for an original dict
  20167. for (var key in dict) {
  20168. result[key] = dict[key].syntax;
  20169. }
  20170. // apply a patch
  20171. for (var key in patchDict) {
  20172. if (key in dict) {
  20173. if (patchDict[key].syntax) {
  20174. result[key] = patchDict[key].syntax;
  20175. } else {
  20176. delete result[key];
  20177. }
  20178. } else {
  20179. if (patchDict[key].syntax) {
  20180. result[key] = patchDict[key].syntax;
  20181. }
  20182. }
  20183. }
  20184. return result;
  20185. }
  20186. var data = {
  20187. types: buildDictionary(mdnSyntaxes, patch$2.syntaxes),
  20188. atrules: preprocessAtrules(mdnAtrules),
  20189. properties: buildDictionary(mdnProperties, patch$2.properties)
  20190. };
  20191. var cmpChar$3 = tokenizer.cmpChar;
  20192. var isDigit$4 = tokenizer.isDigit;
  20193. var TYPE$9 = tokenizer.TYPE;
  20194. var WHITESPACE$4 = TYPE$9.WhiteSpace;
  20195. var COMMENT$3 = TYPE$9.Comment;
  20196. var IDENT$3 = TYPE$9.Ident;
  20197. var NUMBER$3 = TYPE$9.Number;
  20198. var DIMENSION$2 = TYPE$9.Dimension;
  20199. var PLUSSIGN$3 = 0x002B; // U+002B PLUS SIGN (+)
  20200. var HYPHENMINUS$3 = 0x002D; // U+002D HYPHEN-MINUS (-)
  20201. var N$4 = 0x006E; // U+006E LATIN SMALL LETTER N (n)
  20202. var DISALLOW_SIGN$1 = true;
  20203. var ALLOW_SIGN$1 = false;
  20204. function checkInteger$1(offset, disallowSign) {
  20205. var pos = this.scanner.tokenStart + offset;
  20206. var code = this.scanner.source.charCodeAt(pos);
  20207. if (code === PLUSSIGN$3 || code === HYPHENMINUS$3) {
  20208. if (disallowSign) {
  20209. this.error('Number sign is not allowed');
  20210. }
  20211. pos++;
  20212. }
  20213. for (; pos < this.scanner.tokenEnd; pos++) {
  20214. if (!isDigit$4(this.scanner.source.charCodeAt(pos))) {
  20215. this.error('Integer is expected', pos);
  20216. }
  20217. }
  20218. }
  20219. function checkTokenIsInteger(disallowSign) {
  20220. return checkInteger$1.call(this, 0, disallowSign);
  20221. }
  20222. function expectCharCode(offset, code) {
  20223. if (!cmpChar$3(this.scanner.source, this.scanner.tokenStart + offset, code)) {
  20224. var msg = '';
  20225. switch (code) {
  20226. case N$4:
  20227. msg = 'N is expected';
  20228. break;
  20229. case HYPHENMINUS$3:
  20230. msg = 'HyphenMinus is expected';
  20231. break;
  20232. }
  20233. this.error(msg, this.scanner.tokenStart + offset);
  20234. }
  20235. }
  20236. // ... <signed-integer>
  20237. // ... ['+' | '-'] <signless-integer>
  20238. function consumeB$1() {
  20239. var offset = 0;
  20240. var sign = 0;
  20241. var type = this.scanner.tokenType;
  20242. while (type === WHITESPACE$4 || type === COMMENT$3) {
  20243. type = this.scanner.lookupType(++offset);
  20244. }
  20245. if (type !== NUMBER$3) {
  20246. if (this.scanner.isDelim(PLUSSIGN$3, offset) ||
  20247. this.scanner.isDelim(HYPHENMINUS$3, offset)) {
  20248. sign = this.scanner.isDelim(PLUSSIGN$3, offset) ? PLUSSIGN$3 : HYPHENMINUS$3;
  20249. do {
  20250. type = this.scanner.lookupType(++offset);
  20251. } while (type === WHITESPACE$4 || type === COMMENT$3);
  20252. if (type !== NUMBER$3) {
  20253. this.scanner.skip(offset);
  20254. checkTokenIsInteger.call(this, DISALLOW_SIGN$1);
  20255. }
  20256. } else {
  20257. return null;
  20258. }
  20259. }
  20260. if (offset > 0) {
  20261. this.scanner.skip(offset);
  20262. }
  20263. if (sign === 0) {
  20264. type = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  20265. if (type !== PLUSSIGN$3 && type !== HYPHENMINUS$3) {
  20266. this.error('Number sign is expected');
  20267. }
  20268. }
  20269. checkTokenIsInteger.call(this, sign !== 0);
  20270. return sign === HYPHENMINUS$3 ? '-' + this.consume(NUMBER$3) : this.consume(NUMBER$3);
  20271. }
  20272. // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
  20273. var AnPlusB = {
  20274. name: 'AnPlusB',
  20275. structure: {
  20276. a: [String, null],
  20277. b: [String, null]
  20278. },
  20279. parse: function() {
  20280. /* eslint-disable brace-style*/
  20281. var start = this.scanner.tokenStart;
  20282. var a = null;
  20283. var b = null;
  20284. // <integer>
  20285. if (this.scanner.tokenType === NUMBER$3) {
  20286. checkTokenIsInteger.call(this, ALLOW_SIGN$1);
  20287. b = this.consume(NUMBER$3);
  20288. }
  20289. // -n
  20290. // -n <signed-integer>
  20291. // -n ['+' | '-'] <signless-integer>
  20292. // -n- <signless-integer>
  20293. // <dashndashdigit-ident>
  20294. else if (this.scanner.tokenType === IDENT$3 && cmpChar$3(this.scanner.source, this.scanner.tokenStart, HYPHENMINUS$3)) {
  20295. a = '-1';
  20296. expectCharCode.call(this, 1, N$4);
  20297. switch (this.scanner.getTokenLength()) {
  20298. // -n
  20299. // -n <signed-integer>
  20300. // -n ['+' | '-'] <signless-integer>
  20301. case 2:
  20302. this.scanner.next();
  20303. b = consumeB$1.call(this);
  20304. break;
  20305. // -n- <signless-integer>
  20306. case 3:
  20307. expectCharCode.call(this, 2, HYPHENMINUS$3);
  20308. this.scanner.next();
  20309. this.scanner.skipSC();
  20310. checkTokenIsInteger.call(this, DISALLOW_SIGN$1);
  20311. b = '-' + this.consume(NUMBER$3);
  20312. break;
  20313. // <dashndashdigit-ident>
  20314. default:
  20315. expectCharCode.call(this, 2, HYPHENMINUS$3);
  20316. checkInteger$1.call(this, 3, DISALLOW_SIGN$1);
  20317. this.scanner.next();
  20318. b = this.scanner.substrToCursor(start + 2);
  20319. }
  20320. }
  20321. // '+'? n
  20322. // '+'? n <signed-integer>
  20323. // '+'? n ['+' | '-'] <signless-integer>
  20324. // '+'? n- <signless-integer>
  20325. // '+'? <ndashdigit-ident>
  20326. else if (this.scanner.tokenType === IDENT$3 || (this.scanner.isDelim(PLUSSIGN$3) && this.scanner.lookupType(1) === IDENT$3)) {
  20327. var sign = 0;
  20328. a = '1';
  20329. // just ignore a plus
  20330. if (this.scanner.isDelim(PLUSSIGN$3)) {
  20331. sign = 1;
  20332. this.scanner.next();
  20333. }
  20334. expectCharCode.call(this, 0, N$4);
  20335. switch (this.scanner.getTokenLength()) {
  20336. // '+'? n
  20337. // '+'? n <signed-integer>
  20338. // '+'? n ['+' | '-'] <signless-integer>
  20339. case 1:
  20340. this.scanner.next();
  20341. b = consumeB$1.call(this);
  20342. break;
  20343. // '+'? n- <signless-integer>
  20344. case 2:
  20345. expectCharCode.call(this, 1, HYPHENMINUS$3);
  20346. this.scanner.next();
  20347. this.scanner.skipSC();
  20348. checkTokenIsInteger.call(this, DISALLOW_SIGN$1);
  20349. b = '-' + this.consume(NUMBER$3);
  20350. break;
  20351. // '+'? <ndashdigit-ident>
  20352. default:
  20353. expectCharCode.call(this, 1, HYPHENMINUS$3);
  20354. checkInteger$1.call(this, 2, DISALLOW_SIGN$1);
  20355. this.scanner.next();
  20356. b = this.scanner.substrToCursor(start + sign + 1);
  20357. }
  20358. }
  20359. // <ndashdigit-dimension>
  20360. // <ndash-dimension> <signless-integer>
  20361. // <n-dimension>
  20362. // <n-dimension> <signed-integer>
  20363. // <n-dimension> ['+' | '-'] <signless-integer>
  20364. else if (this.scanner.tokenType === DIMENSION$2) {
  20365. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  20366. var sign = code === PLUSSIGN$3 || code === HYPHENMINUS$3;
  20367. for (var i = this.scanner.tokenStart + sign; i < this.scanner.tokenEnd; i++) {
  20368. if (!isDigit$4(this.scanner.source.charCodeAt(i))) {
  20369. break;
  20370. }
  20371. }
  20372. if (i === this.scanner.tokenStart + sign) {
  20373. this.error('Integer is expected', this.scanner.tokenStart + sign);
  20374. }
  20375. expectCharCode.call(this, i - this.scanner.tokenStart, N$4);
  20376. a = this.scanner.source.substring(start, i);
  20377. // <n-dimension>
  20378. // <n-dimension> <signed-integer>
  20379. // <n-dimension> ['+' | '-'] <signless-integer>
  20380. if (i + 1 === this.scanner.tokenEnd) {
  20381. this.scanner.next();
  20382. b = consumeB$1.call(this);
  20383. } else {
  20384. expectCharCode.call(this, i - this.scanner.tokenStart + 1, HYPHENMINUS$3);
  20385. // <ndash-dimension> <signless-integer>
  20386. if (i + 2 === this.scanner.tokenEnd) {
  20387. this.scanner.next();
  20388. this.scanner.skipSC();
  20389. checkTokenIsInteger.call(this, DISALLOW_SIGN$1);
  20390. b = '-' + this.consume(NUMBER$3);
  20391. }
  20392. // <ndashdigit-dimension>
  20393. else {
  20394. checkInteger$1.call(this, i - this.scanner.tokenStart + 2, DISALLOW_SIGN$1);
  20395. this.scanner.next();
  20396. b = this.scanner.substrToCursor(i + 1);
  20397. }
  20398. }
  20399. } else {
  20400. this.error();
  20401. }
  20402. if (a !== null && a.charCodeAt(0) === PLUSSIGN$3) {
  20403. a = a.substr(1);
  20404. }
  20405. if (b !== null && b.charCodeAt(0) === PLUSSIGN$3) {
  20406. b = b.substr(1);
  20407. }
  20408. return {
  20409. type: 'AnPlusB',
  20410. loc: this.getLocation(start, this.scanner.tokenStart),
  20411. a: a,
  20412. b: b
  20413. };
  20414. },
  20415. generate: function(node) {
  20416. var a = node.a !== null && node.a !== undefined;
  20417. var b = node.b !== null && node.b !== undefined;
  20418. if (a) {
  20419. this.chunk(
  20420. node.a === '+1' ? '+n' : // eslint-disable-line operator-linebreak, indent
  20421. node.a === '1' ? 'n' : // eslint-disable-line operator-linebreak, indent
  20422. node.a === '-1' ? '-n' : // eslint-disable-line operator-linebreak, indent
  20423. node.a + 'n' // eslint-disable-line operator-linebreak, indent
  20424. );
  20425. if (b) {
  20426. b = String(node.b);
  20427. if (b.charAt(0) === '-' || b.charAt(0) === '+') {
  20428. this.chunk(b.charAt(0));
  20429. this.chunk(b.substr(1));
  20430. } else {
  20431. this.chunk('+');
  20432. this.chunk(b);
  20433. }
  20434. }
  20435. } else {
  20436. this.chunk(String(node.b));
  20437. }
  20438. }
  20439. };
  20440. var TYPE$a = tokenizer.TYPE;
  20441. var WhiteSpace = TYPE$a.WhiteSpace;
  20442. var Semicolon = TYPE$a.Semicolon;
  20443. var LeftCurlyBracket = TYPE$a.LeftCurlyBracket;
  20444. var Delim = TYPE$a.Delim;
  20445. var EXCLAMATIONMARK$1 = 0x0021; // U+0021 EXCLAMATION MARK (!)
  20446. function getOffsetExcludeWS() {
  20447. if (this.scanner.tokenIndex > 0) {
  20448. if (this.scanner.lookupType(-1) === WhiteSpace) {
  20449. return this.scanner.tokenIndex > 1
  20450. ? this.scanner.getTokenStart(this.scanner.tokenIndex - 1)
  20451. : this.scanner.firstCharOffset;
  20452. }
  20453. }
  20454. return this.scanner.tokenStart;
  20455. }
  20456. // 0, 0, false
  20457. function balanceEnd() {
  20458. return 0;
  20459. }
  20460. // LEFTCURLYBRACKET, 0, false
  20461. function leftCurlyBracket(tokenType) {
  20462. return tokenType === LeftCurlyBracket ? 1 : 0;
  20463. }
  20464. // LEFTCURLYBRACKET, SEMICOLON, false
  20465. function leftCurlyBracketOrSemicolon(tokenType) {
  20466. return tokenType === LeftCurlyBracket || tokenType === Semicolon ? 1 : 0;
  20467. }
  20468. // EXCLAMATIONMARK, SEMICOLON, false
  20469. function exclamationMarkOrSemicolon(tokenType, source, offset) {
  20470. if (tokenType === Delim && source.charCodeAt(offset) === EXCLAMATIONMARK$1) {
  20471. return 1;
  20472. }
  20473. return tokenType === Semicolon ? 1 : 0;
  20474. }
  20475. // 0, SEMICOLON, true
  20476. function semicolonIncluded(tokenType) {
  20477. return tokenType === Semicolon ? 2 : 0;
  20478. }
  20479. var Raw = {
  20480. name: 'Raw',
  20481. structure: {
  20482. value: String
  20483. },
  20484. parse: function(startToken, mode, excludeWhiteSpace) {
  20485. var startOffset = this.scanner.getTokenStart(startToken);
  20486. var endOffset;
  20487. this.scanner.skip(
  20488. this.scanner.getRawLength(startToken, mode || balanceEnd)
  20489. );
  20490. if (excludeWhiteSpace && this.scanner.tokenStart > startOffset) {
  20491. endOffset = getOffsetExcludeWS.call(this);
  20492. } else {
  20493. endOffset = this.scanner.tokenStart;
  20494. }
  20495. return {
  20496. type: 'Raw',
  20497. loc: this.getLocation(startOffset, endOffset),
  20498. value: this.scanner.source.substring(startOffset, endOffset)
  20499. };
  20500. },
  20501. generate: function(node) {
  20502. this.chunk(node.value);
  20503. },
  20504. mode: {
  20505. default: balanceEnd,
  20506. leftCurlyBracket: leftCurlyBracket,
  20507. leftCurlyBracketOrSemicolon: leftCurlyBracketOrSemicolon,
  20508. exclamationMarkOrSemicolon: exclamationMarkOrSemicolon,
  20509. semicolonIncluded: semicolonIncluded
  20510. }
  20511. };
  20512. var TYPE$b = tokenizer.TYPE;
  20513. var rawMode = Raw.mode;
  20514. var ATKEYWORD = TYPE$b.AtKeyword;
  20515. var SEMICOLON = TYPE$b.Semicolon;
  20516. var LEFTCURLYBRACKET$1 = TYPE$b.LeftCurlyBracket;
  20517. var RIGHTCURLYBRACKET$1 = TYPE$b.RightCurlyBracket;
  20518. function consumeRaw(startToken) {
  20519. return this.Raw(startToken, rawMode.leftCurlyBracketOrSemicolon, true);
  20520. }
  20521. function isDeclarationBlockAtrule() {
  20522. for (var offset = 1, type; type = this.scanner.lookupType(offset); offset++) {
  20523. if (type === RIGHTCURLYBRACKET$1) {
  20524. return true;
  20525. }
  20526. if (type === LEFTCURLYBRACKET$1 ||
  20527. type === ATKEYWORD) {
  20528. return false;
  20529. }
  20530. }
  20531. return false;
  20532. }
  20533. var Atrule = {
  20534. name: 'Atrule',
  20535. structure: {
  20536. name: String,
  20537. prelude: ['AtrulePrelude', 'Raw', null],
  20538. block: ['Block', null]
  20539. },
  20540. parse: function() {
  20541. var start = this.scanner.tokenStart;
  20542. var name;
  20543. var nameLowerCase;
  20544. var prelude = null;
  20545. var block = null;
  20546. this.eat(ATKEYWORD);
  20547. name = this.scanner.substrToCursor(start + 1);
  20548. nameLowerCase = name.toLowerCase();
  20549. this.scanner.skipSC();
  20550. // parse prelude
  20551. if (this.scanner.eof === false &&
  20552. this.scanner.tokenType !== LEFTCURLYBRACKET$1 &&
  20553. this.scanner.tokenType !== SEMICOLON) {
  20554. if (this.parseAtrulePrelude) {
  20555. prelude = this.parseWithFallback(this.AtrulePrelude.bind(this, name), consumeRaw);
  20556. // turn empty AtrulePrelude into null
  20557. if (prelude.type === 'AtrulePrelude' && prelude.children.head === null) {
  20558. prelude = null;
  20559. }
  20560. } else {
  20561. prelude = consumeRaw.call(this, this.scanner.tokenIndex);
  20562. }
  20563. this.scanner.skipSC();
  20564. }
  20565. switch (this.scanner.tokenType) {
  20566. case SEMICOLON:
  20567. this.scanner.next();
  20568. break;
  20569. case LEFTCURLYBRACKET$1:
  20570. if (this.atrule.hasOwnProperty(nameLowerCase) &&
  20571. typeof this.atrule[nameLowerCase].block === 'function') {
  20572. block = this.atrule[nameLowerCase].block.call(this);
  20573. } else {
  20574. // TODO: should consume block content as Raw?
  20575. block = this.Block(isDeclarationBlockAtrule.call(this));
  20576. }
  20577. break;
  20578. }
  20579. return {
  20580. type: 'Atrule',
  20581. loc: this.getLocation(start, this.scanner.tokenStart),
  20582. name: name,
  20583. prelude: prelude,
  20584. block: block
  20585. };
  20586. },
  20587. generate: function(node) {
  20588. this.chunk('@');
  20589. this.chunk(node.name);
  20590. if (node.prelude !== null) {
  20591. this.chunk(' ');
  20592. this.node(node.prelude);
  20593. }
  20594. if (node.block) {
  20595. this.node(node.block);
  20596. } else {
  20597. this.chunk(';');
  20598. }
  20599. },
  20600. walkContext: 'atrule'
  20601. };
  20602. var TYPE$c = tokenizer.TYPE;
  20603. var SEMICOLON$1 = TYPE$c.Semicolon;
  20604. var LEFTCURLYBRACKET$2 = TYPE$c.LeftCurlyBracket;
  20605. var AtrulePrelude = {
  20606. name: 'AtrulePrelude',
  20607. structure: {
  20608. children: [[]]
  20609. },
  20610. parse: function(name) {
  20611. var children = null;
  20612. if (name !== null) {
  20613. name = name.toLowerCase();
  20614. }
  20615. this.scanner.skipSC();
  20616. if (this.atrule.hasOwnProperty(name) &&
  20617. typeof this.atrule[name].prelude === 'function') {
  20618. // custom consumer
  20619. children = this.atrule[name].prelude.call(this);
  20620. } else {
  20621. // default consumer
  20622. children = this.readSequence(this.scope.AtrulePrelude);
  20623. }
  20624. this.scanner.skipSC();
  20625. if (this.scanner.eof !== true &&
  20626. this.scanner.tokenType !== LEFTCURLYBRACKET$2 &&
  20627. this.scanner.tokenType !== SEMICOLON$1) {
  20628. this.error('Semicolon or block is expected');
  20629. }
  20630. if (children === null) {
  20631. children = this.createList();
  20632. }
  20633. return {
  20634. type: 'AtrulePrelude',
  20635. loc: this.getLocationFromList(children),
  20636. children: children
  20637. };
  20638. },
  20639. generate: function(node) {
  20640. this.children(node);
  20641. },
  20642. walkContext: 'atrulePrelude'
  20643. };
  20644. var TYPE$d = tokenizer.TYPE;
  20645. var IDENT$4 = TYPE$d.Ident;
  20646. var STRING = TYPE$d.String;
  20647. var COLON = TYPE$d.Colon;
  20648. var LEFTSQUAREBRACKET$1 = TYPE$d.LeftSquareBracket;
  20649. var RIGHTSQUAREBRACKET$1 = TYPE$d.RightSquareBracket;
  20650. var DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
  20651. var ASTERISK$1 = 0x002A; // U+002A ASTERISK (*)
  20652. var EQUALSSIGN = 0x003D; // U+003D EQUALS SIGN (=)
  20653. var CIRCUMFLEXACCENT = 0x005E; // U+005E (^)
  20654. var VERTICALLINE$1 = 0x007C; // U+007C VERTICAL LINE (|)
  20655. var TILDE = 0x007E; // U+007E TILDE (~)
  20656. function getAttributeName() {
  20657. if (this.scanner.eof) {
  20658. this.error('Unexpected end of input');
  20659. }
  20660. var start = this.scanner.tokenStart;
  20661. var expectIdent = false;
  20662. var checkColon = true;
  20663. if (this.scanner.isDelim(ASTERISK$1)) {
  20664. expectIdent = true;
  20665. checkColon = false;
  20666. this.scanner.next();
  20667. } else if (!this.scanner.isDelim(VERTICALLINE$1)) {
  20668. this.eat(IDENT$4);
  20669. }
  20670. if (this.scanner.isDelim(VERTICALLINE$1)) {
  20671. if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 1) !== EQUALSSIGN) {
  20672. this.scanner.next();
  20673. this.eat(IDENT$4);
  20674. } else if (expectIdent) {
  20675. this.error('Identifier is expected', this.scanner.tokenEnd);
  20676. }
  20677. } else if (expectIdent) {
  20678. this.error('Vertical line is expected');
  20679. }
  20680. if (checkColon && this.scanner.tokenType === COLON) {
  20681. this.scanner.next();
  20682. this.eat(IDENT$4);
  20683. }
  20684. return {
  20685. type: 'Identifier',
  20686. loc: this.getLocation(start, this.scanner.tokenStart),
  20687. name: this.scanner.substrToCursor(start)
  20688. };
  20689. }
  20690. function getOperator() {
  20691. var start = this.scanner.tokenStart;
  20692. var code = this.scanner.source.charCodeAt(start);
  20693. if (code !== EQUALSSIGN && // =
  20694. code !== TILDE && // ~=
  20695. code !== CIRCUMFLEXACCENT && // ^=
  20696. code !== DOLLARSIGN && // $=
  20697. code !== ASTERISK$1 && // *=
  20698. code !== VERTICALLINE$1 // |=
  20699. ) {
  20700. this.error('Attribute selector (=, ~=, ^=, $=, *=, |=) is expected');
  20701. }
  20702. this.scanner.next();
  20703. if (code !== EQUALSSIGN) {
  20704. if (!this.scanner.isDelim(EQUALSSIGN)) {
  20705. this.error('Equal sign is expected');
  20706. }
  20707. this.scanner.next();
  20708. }
  20709. return this.scanner.substrToCursor(start);
  20710. }
  20711. // '[' <wq-name> ']'
  20712. // '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'
  20713. var AttributeSelector = {
  20714. name: 'AttributeSelector',
  20715. structure: {
  20716. name: 'Identifier',
  20717. matcher: [String, null],
  20718. value: ['String', 'Identifier', null],
  20719. flags: [String, null]
  20720. },
  20721. parse: function() {
  20722. var start = this.scanner.tokenStart;
  20723. var name;
  20724. var matcher = null;
  20725. var value = null;
  20726. var flags = null;
  20727. this.eat(LEFTSQUAREBRACKET$1);
  20728. this.scanner.skipSC();
  20729. name = getAttributeName.call(this);
  20730. this.scanner.skipSC();
  20731. if (this.scanner.tokenType !== RIGHTSQUAREBRACKET$1) {
  20732. // avoid case `[name i]`
  20733. if (this.scanner.tokenType !== IDENT$4) {
  20734. matcher = getOperator.call(this);
  20735. this.scanner.skipSC();
  20736. value = this.scanner.tokenType === STRING
  20737. ? this.String()
  20738. : this.Identifier();
  20739. this.scanner.skipSC();
  20740. }
  20741. // attribute flags
  20742. if (this.scanner.tokenType === IDENT$4) {
  20743. flags = this.scanner.getTokenValue();
  20744. this.scanner.next();
  20745. this.scanner.skipSC();
  20746. }
  20747. }
  20748. this.eat(RIGHTSQUAREBRACKET$1);
  20749. return {
  20750. type: 'AttributeSelector',
  20751. loc: this.getLocation(start, this.scanner.tokenStart),
  20752. name: name,
  20753. matcher: matcher,
  20754. value: value,
  20755. flags: flags
  20756. };
  20757. },
  20758. generate: function(node) {
  20759. var flagsPrefix = ' ';
  20760. this.chunk('[');
  20761. this.node(node.name);
  20762. if (node.matcher !== null) {
  20763. this.chunk(node.matcher);
  20764. if (node.value !== null) {
  20765. this.node(node.value);
  20766. // space between string and flags is not required
  20767. if (node.value.type === 'String') {
  20768. flagsPrefix = '';
  20769. }
  20770. }
  20771. }
  20772. if (node.flags !== null) {
  20773. this.chunk(flagsPrefix);
  20774. this.chunk(node.flags);
  20775. }
  20776. this.chunk(']');
  20777. }
  20778. };
  20779. var TYPE$e = tokenizer.TYPE;
  20780. var rawMode$1 = Raw.mode;
  20781. var WHITESPACE$5 = TYPE$e.WhiteSpace;
  20782. var COMMENT$4 = TYPE$e.Comment;
  20783. var SEMICOLON$2 = TYPE$e.Semicolon;
  20784. var ATKEYWORD$1 = TYPE$e.AtKeyword;
  20785. var LEFTCURLYBRACKET$3 = TYPE$e.LeftCurlyBracket;
  20786. var RIGHTCURLYBRACKET$2 = TYPE$e.RightCurlyBracket;
  20787. function consumeRaw$1(startToken) {
  20788. return this.Raw(startToken, null, true);
  20789. }
  20790. function consumeRule() {
  20791. return this.parseWithFallback(this.Rule, consumeRaw$1);
  20792. }
  20793. function consumeRawDeclaration(startToken) {
  20794. return this.Raw(startToken, rawMode$1.semicolonIncluded, true);
  20795. }
  20796. function consumeDeclaration() {
  20797. if (this.scanner.tokenType === SEMICOLON$2) {
  20798. return consumeRawDeclaration.call(this, this.scanner.tokenIndex);
  20799. }
  20800. var node = this.parseWithFallback(this.Declaration, consumeRawDeclaration);
  20801. if (this.scanner.tokenType === SEMICOLON$2) {
  20802. this.scanner.next();
  20803. }
  20804. return node;
  20805. }
  20806. var Block = {
  20807. name: 'Block',
  20808. structure: {
  20809. children: [[
  20810. 'Atrule',
  20811. 'Rule',
  20812. 'Declaration'
  20813. ]]
  20814. },
  20815. parse: function(isDeclaration) {
  20816. var consumer = isDeclaration ? consumeDeclaration : consumeRule;
  20817. var start = this.scanner.tokenStart;
  20818. var children = this.createList();
  20819. this.eat(LEFTCURLYBRACKET$3);
  20820. scan:
  20821. while (!this.scanner.eof) {
  20822. switch (this.scanner.tokenType) {
  20823. case RIGHTCURLYBRACKET$2:
  20824. break scan;
  20825. case WHITESPACE$5:
  20826. case COMMENT$4:
  20827. this.scanner.next();
  20828. break;
  20829. case ATKEYWORD$1:
  20830. children.push(this.parseWithFallback(this.Atrule, consumeRaw$1));
  20831. break;
  20832. default:
  20833. children.push(consumer.call(this));
  20834. }
  20835. }
  20836. if (!this.scanner.eof) {
  20837. this.eat(RIGHTCURLYBRACKET$2);
  20838. }
  20839. return {
  20840. type: 'Block',
  20841. loc: this.getLocation(start, this.scanner.tokenStart),
  20842. children: children
  20843. };
  20844. },
  20845. generate: function(node) {
  20846. this.chunk('{');
  20847. this.children(node, function(prev) {
  20848. if (prev.type === 'Declaration') {
  20849. this.chunk(';');
  20850. }
  20851. });
  20852. this.chunk('}');
  20853. },
  20854. walkContext: 'block'
  20855. };
  20856. var TYPE$f = tokenizer.TYPE;
  20857. var LEFTSQUAREBRACKET$2 = TYPE$f.LeftSquareBracket;
  20858. var RIGHTSQUAREBRACKET$2 = TYPE$f.RightSquareBracket;
  20859. var Brackets = {
  20860. name: 'Brackets',
  20861. structure: {
  20862. children: [[]]
  20863. },
  20864. parse: function(readSequence, recognizer) {
  20865. var start = this.scanner.tokenStart;
  20866. var children = null;
  20867. this.eat(LEFTSQUAREBRACKET$2);
  20868. children = readSequence.call(this, recognizer);
  20869. if (!this.scanner.eof) {
  20870. this.eat(RIGHTSQUAREBRACKET$2);
  20871. }
  20872. return {
  20873. type: 'Brackets',
  20874. loc: this.getLocation(start, this.scanner.tokenStart),
  20875. children: children
  20876. };
  20877. },
  20878. generate: function(node) {
  20879. this.chunk('[');
  20880. this.children(node);
  20881. this.chunk(']');
  20882. }
  20883. };
  20884. var CDC = tokenizer.TYPE.CDC;
  20885. var CDC_1 = {
  20886. name: 'CDC',
  20887. structure: [],
  20888. parse: function() {
  20889. var start = this.scanner.tokenStart;
  20890. this.eat(CDC); // -->
  20891. return {
  20892. type: 'CDC',
  20893. loc: this.getLocation(start, this.scanner.tokenStart)
  20894. };
  20895. },
  20896. generate: function() {
  20897. this.chunk('-->');
  20898. }
  20899. };
  20900. var CDO = tokenizer.TYPE.CDO;
  20901. var CDO_1 = {
  20902. name: 'CDO',
  20903. structure: [],
  20904. parse: function() {
  20905. var start = this.scanner.tokenStart;
  20906. this.eat(CDO); // <!--
  20907. return {
  20908. type: 'CDO',
  20909. loc: this.getLocation(start, this.scanner.tokenStart)
  20910. };
  20911. },
  20912. generate: function() {
  20913. this.chunk('<!--');
  20914. }
  20915. };
  20916. var TYPE$g = tokenizer.TYPE;
  20917. var IDENT$5 = TYPE$g.Ident;
  20918. var FULLSTOP = 0x002E; // U+002E FULL STOP (.)
  20919. // '.' ident
  20920. var ClassSelector = {
  20921. name: 'ClassSelector',
  20922. structure: {
  20923. name: String
  20924. },
  20925. parse: function() {
  20926. if (!this.scanner.isDelim(FULLSTOP)) {
  20927. this.error('Full stop is expected');
  20928. }
  20929. this.scanner.next();
  20930. return {
  20931. type: 'ClassSelector',
  20932. loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),
  20933. name: this.consume(IDENT$5)
  20934. };
  20935. },
  20936. generate: function(node) {
  20937. this.chunk('.');
  20938. this.chunk(node.name);
  20939. }
  20940. };
  20941. var TYPE$h = tokenizer.TYPE;
  20942. var IDENT$6 = TYPE$h.Ident;
  20943. var PLUSSIGN$4 = 0x002B; // U+002B PLUS SIGN (+)
  20944. var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
  20945. var GREATERTHANSIGN$1 = 0x003E; // U+003E GREATER-THAN SIGN (>)
  20946. var TILDE$1 = 0x007E; // U+007E TILDE (~)
  20947. // + | > | ~ | /deep/
  20948. var Combinator = {
  20949. name: 'Combinator',
  20950. structure: {
  20951. name: String
  20952. },
  20953. parse: function() {
  20954. var start = this.scanner.tokenStart;
  20955. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  20956. switch (code) {
  20957. case GREATERTHANSIGN$1:
  20958. case PLUSSIGN$4:
  20959. case TILDE$1:
  20960. this.scanner.next();
  20961. break;
  20962. case SOLIDUS:
  20963. this.scanner.next();
  20964. if (this.scanner.tokenType !== IDENT$6 || this.scanner.lookupValue(0, 'deep') === false) {
  20965. this.error('Identifier `deep` is expected');
  20966. }
  20967. this.scanner.next();
  20968. if (!this.scanner.isDelim(SOLIDUS)) {
  20969. this.error('Solidus is expected');
  20970. }
  20971. this.scanner.next();
  20972. break;
  20973. default:
  20974. this.error('Combinator is expected');
  20975. }
  20976. return {
  20977. type: 'Combinator',
  20978. loc: this.getLocation(start, this.scanner.tokenStart),
  20979. name: this.scanner.substrToCursor(start)
  20980. };
  20981. },
  20982. generate: function(node) {
  20983. this.chunk(node.name);
  20984. }
  20985. };
  20986. var TYPE$i = tokenizer.TYPE;
  20987. var COMMENT$5 = TYPE$i.Comment;
  20988. var ASTERISK$2 = 0x002A; // U+002A ASTERISK (*)
  20989. var SOLIDUS$1 = 0x002F; // U+002F SOLIDUS (/)
  20990. // '/*' .* '*/'
  20991. var Comment = {
  20992. name: 'Comment',
  20993. structure: {
  20994. value: String
  20995. },
  20996. parse: function() {
  20997. var start = this.scanner.tokenStart;
  20998. var end = this.scanner.tokenEnd;
  20999. this.eat(COMMENT$5);
  21000. if ((end - start + 2) >= 2 &&
  21001. this.scanner.source.charCodeAt(end - 2) === ASTERISK$2 &&
  21002. this.scanner.source.charCodeAt(end - 1) === SOLIDUS$1) {
  21003. end -= 2;
  21004. }
  21005. return {
  21006. type: 'Comment',
  21007. loc: this.getLocation(start, this.scanner.tokenStart),
  21008. value: this.scanner.source.substring(start + 2, end)
  21009. };
  21010. },
  21011. generate: function(node) {
  21012. this.chunk('/*');
  21013. this.chunk(node.value);
  21014. this.chunk('*/');
  21015. }
  21016. };
  21017. var isCustomProperty$1 = names.isCustomProperty;
  21018. var TYPE$j = tokenizer.TYPE;
  21019. var rawMode$2 = Raw.mode;
  21020. var IDENT$7 = TYPE$j.Ident;
  21021. var HASH$1 = TYPE$j.Hash;
  21022. var COLON$1 = TYPE$j.Colon;
  21023. var SEMICOLON$3 = TYPE$j.Semicolon;
  21024. var DELIM$2 = TYPE$j.Delim;
  21025. var EXCLAMATIONMARK$2 = 0x0021; // U+0021 EXCLAMATION MARK (!)
  21026. var NUMBERSIGN$2 = 0x0023; // U+0023 NUMBER SIGN (#)
  21027. var DOLLARSIGN$1 = 0x0024; // U+0024 DOLLAR SIGN ($)
  21028. var AMPERSAND$1 = 0x0026; // U+0026 ANPERSAND (&)
  21029. var ASTERISK$3 = 0x002A; // U+002A ASTERISK (*)
  21030. var PLUSSIGN$5 = 0x002B; // U+002B PLUS SIGN (+)
  21031. var SOLIDUS$2 = 0x002F; // U+002F SOLIDUS (/)
  21032. function consumeValueRaw(startToken) {
  21033. return this.Raw(startToken, rawMode$2.exclamationMarkOrSemicolon, true);
  21034. }
  21035. function consumeCustomPropertyRaw(startToken) {
  21036. return this.Raw(startToken, rawMode$2.exclamationMarkOrSemicolon, false);
  21037. }
  21038. function consumeValue() {
  21039. var startValueToken = this.scanner.tokenIndex;
  21040. var value = this.Value();
  21041. if (value.type !== 'Raw' &&
  21042. this.scanner.eof === false &&
  21043. this.scanner.tokenType !== SEMICOLON$3 &&
  21044. this.scanner.isDelim(EXCLAMATIONMARK$2) === false &&
  21045. this.scanner.isBalanceEdge(startValueToken) === false) {
  21046. this.error();
  21047. }
  21048. return value;
  21049. }
  21050. var Declaration = {
  21051. name: 'Declaration',
  21052. structure: {
  21053. important: [Boolean, String],
  21054. property: String,
  21055. value: ['Value', 'Raw']
  21056. },
  21057. parse: function() {
  21058. var start = this.scanner.tokenStart;
  21059. var startToken = this.scanner.tokenIndex;
  21060. var property = readProperty$1.call(this);
  21061. var customProperty = isCustomProperty$1(property);
  21062. var parseValue = customProperty ? this.parseCustomProperty : this.parseValue;
  21063. var consumeRaw = customProperty ? consumeCustomPropertyRaw : consumeValueRaw;
  21064. var important = false;
  21065. var value;
  21066. this.scanner.skipSC();
  21067. this.eat(COLON$1);
  21068. if (!customProperty) {
  21069. this.scanner.skipSC();
  21070. }
  21071. if (parseValue) {
  21072. value = this.parseWithFallback(consumeValue, consumeRaw);
  21073. } else {
  21074. value = consumeRaw.call(this, this.scanner.tokenIndex);
  21075. }
  21076. if (this.scanner.isDelim(EXCLAMATIONMARK$2)) {
  21077. important = getImportant.call(this);
  21078. this.scanner.skipSC();
  21079. }
  21080. // Do not include semicolon to range per spec
  21081. // https://drafts.csswg.org/css-syntax/#declaration-diagram
  21082. if (this.scanner.eof === false &&
  21083. this.scanner.tokenType !== SEMICOLON$3 &&
  21084. this.scanner.isBalanceEdge(startToken) === false) {
  21085. this.error();
  21086. }
  21087. return {
  21088. type: 'Declaration',
  21089. loc: this.getLocation(start, this.scanner.tokenStart),
  21090. important: important,
  21091. property: property,
  21092. value: value
  21093. };
  21094. },
  21095. generate: function(node) {
  21096. this.chunk(node.property);
  21097. this.chunk(':');
  21098. this.node(node.value);
  21099. if (node.important) {
  21100. this.chunk(node.important === true ? '!important' : '!' + node.important);
  21101. }
  21102. },
  21103. walkContext: 'declaration'
  21104. };
  21105. function readProperty$1() {
  21106. var start = this.scanner.tokenStart;
  21107. // hacks
  21108. if (this.scanner.tokenType === DELIM$2) {
  21109. switch (this.scanner.source.charCodeAt(this.scanner.tokenStart)) {
  21110. case ASTERISK$3:
  21111. case DOLLARSIGN$1:
  21112. case PLUSSIGN$5:
  21113. case NUMBERSIGN$2:
  21114. case AMPERSAND$1:
  21115. this.scanner.next();
  21116. break;
  21117. // TODO: not sure we should support this hack
  21118. case SOLIDUS$2:
  21119. this.scanner.next();
  21120. if (this.scanner.isDelim(SOLIDUS$2)) {
  21121. this.scanner.next();
  21122. }
  21123. break;
  21124. }
  21125. }
  21126. if (this.scanner.tokenType === HASH$1) {
  21127. this.eat(HASH$1);
  21128. } else {
  21129. this.eat(IDENT$7);
  21130. }
  21131. return this.scanner.substrToCursor(start);
  21132. }
  21133. // ! ws* important
  21134. function getImportant() {
  21135. this.eat(DELIM$2);
  21136. this.scanner.skipSC();
  21137. var important = this.consume(IDENT$7);
  21138. // store original value in case it differ from `important`
  21139. // for better original source restoring and hacks like `!ie` support
  21140. return important === 'important' ? true : important;
  21141. }
  21142. var TYPE$k = tokenizer.TYPE;
  21143. var rawMode$3 = Raw.mode;
  21144. var WHITESPACE$6 = TYPE$k.WhiteSpace;
  21145. var COMMENT$6 = TYPE$k.Comment;
  21146. var SEMICOLON$4 = TYPE$k.Semicolon;
  21147. function consumeRaw$2(startToken) {
  21148. return this.Raw(startToken, rawMode$3.semicolonIncluded, true);
  21149. }
  21150. var DeclarationList = {
  21151. name: 'DeclarationList',
  21152. structure: {
  21153. children: [[
  21154. 'Declaration'
  21155. ]]
  21156. },
  21157. parse: function() {
  21158. var children = this.createList();
  21159. while (!this.scanner.eof) {
  21160. switch (this.scanner.tokenType) {
  21161. case WHITESPACE$6:
  21162. case COMMENT$6:
  21163. case SEMICOLON$4:
  21164. this.scanner.next();
  21165. break;
  21166. default:
  21167. children.push(this.parseWithFallback(this.Declaration, consumeRaw$2));
  21168. }
  21169. }
  21170. return {
  21171. type: 'DeclarationList',
  21172. loc: this.getLocationFromList(children),
  21173. children: children
  21174. };
  21175. },
  21176. generate: function(node) {
  21177. this.children(node, function(prev) {
  21178. if (prev.type === 'Declaration') {
  21179. this.chunk(';');
  21180. }
  21181. });
  21182. }
  21183. };
  21184. var consumeNumber$3 = utils.consumeNumber;
  21185. var TYPE$l = tokenizer.TYPE;
  21186. var DIMENSION$3 = TYPE$l.Dimension;
  21187. var Dimension = {
  21188. name: 'Dimension',
  21189. structure: {
  21190. value: String,
  21191. unit: String
  21192. },
  21193. parse: function() {
  21194. var start = this.scanner.tokenStart;
  21195. var numberEnd = consumeNumber$3(this.scanner.source, start);
  21196. this.eat(DIMENSION$3);
  21197. return {
  21198. type: 'Dimension',
  21199. loc: this.getLocation(start, this.scanner.tokenStart),
  21200. value: this.scanner.source.substring(start, numberEnd),
  21201. unit: this.scanner.source.substring(numberEnd, this.scanner.tokenStart)
  21202. };
  21203. },
  21204. generate: function(node) {
  21205. this.chunk(node.value);
  21206. this.chunk(node.unit);
  21207. }
  21208. };
  21209. var TYPE$m = tokenizer.TYPE;
  21210. var RIGHTPARENTHESIS$2 = TYPE$m.RightParenthesis;
  21211. // <function-token> <sequence> )
  21212. var _Function = {
  21213. name: 'Function',
  21214. structure: {
  21215. name: String,
  21216. children: [[]]
  21217. },
  21218. parse: function(readSequence, recognizer) {
  21219. var start = this.scanner.tokenStart;
  21220. var name = this.consumeFunctionName();
  21221. var nameLowerCase = name.toLowerCase();
  21222. var children;
  21223. children = recognizer.hasOwnProperty(nameLowerCase)
  21224. ? recognizer[nameLowerCase].call(this, recognizer)
  21225. : readSequence.call(this, recognizer);
  21226. if (!this.scanner.eof) {
  21227. this.eat(RIGHTPARENTHESIS$2);
  21228. }
  21229. return {
  21230. type: 'Function',
  21231. loc: this.getLocation(start, this.scanner.tokenStart),
  21232. name: name,
  21233. children: children
  21234. };
  21235. },
  21236. generate: function(node) {
  21237. this.chunk(node.name);
  21238. this.chunk('(');
  21239. this.children(node);
  21240. this.chunk(')');
  21241. },
  21242. walkContext: 'function'
  21243. };
  21244. var TYPE$n = tokenizer.TYPE;
  21245. var HASH$2 = TYPE$n.Hash;
  21246. // '#' ident
  21247. var HexColor = {
  21248. name: 'HexColor',
  21249. structure: {
  21250. value: String
  21251. },
  21252. parse: function() {
  21253. var start = this.scanner.tokenStart;
  21254. this.eat(HASH$2);
  21255. return {
  21256. type: 'HexColor',
  21257. loc: this.getLocation(start, this.scanner.tokenStart),
  21258. value: this.scanner.substrToCursor(start + 1)
  21259. };
  21260. },
  21261. generate: function(node) {
  21262. this.chunk('#');
  21263. this.chunk(node.value);
  21264. }
  21265. };
  21266. var TYPE$o = tokenizer.TYPE;
  21267. var IDENT$8 = TYPE$o.Ident;
  21268. var Identifier = {
  21269. name: 'Identifier',
  21270. structure: {
  21271. name: String
  21272. },
  21273. parse: function() {
  21274. return {
  21275. type: 'Identifier',
  21276. loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  21277. name: this.consume(IDENT$8)
  21278. };
  21279. },
  21280. generate: function(node) {
  21281. this.chunk(node.name);
  21282. }
  21283. };
  21284. var TYPE$p = tokenizer.TYPE;
  21285. var HASH$3 = TYPE$p.Hash;
  21286. // <hash-token>
  21287. var IdSelector = {
  21288. name: 'IdSelector',
  21289. structure: {
  21290. name: String
  21291. },
  21292. parse: function() {
  21293. var start = this.scanner.tokenStart;
  21294. // TODO: check value is an ident
  21295. this.eat(HASH$3);
  21296. return {
  21297. type: 'IdSelector',
  21298. loc: this.getLocation(start, this.scanner.tokenStart),
  21299. name: this.scanner.substrToCursor(start + 1)
  21300. };
  21301. },
  21302. generate: function(node) {
  21303. this.chunk('#');
  21304. this.chunk(node.name);
  21305. }
  21306. };
  21307. var TYPE$q = tokenizer.TYPE;
  21308. var IDENT$9 = TYPE$q.Ident;
  21309. var NUMBER$4 = TYPE$q.Number;
  21310. var DIMENSION$4 = TYPE$q.Dimension;
  21311. var LEFTPARENTHESIS$2 = TYPE$q.LeftParenthesis;
  21312. var RIGHTPARENTHESIS$3 = TYPE$q.RightParenthesis;
  21313. var COLON$2 = TYPE$q.Colon;
  21314. var DELIM$3 = TYPE$q.Delim;
  21315. var MediaFeature = {
  21316. name: 'MediaFeature',
  21317. structure: {
  21318. name: String,
  21319. value: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
  21320. },
  21321. parse: function() {
  21322. var start = this.scanner.tokenStart;
  21323. var name;
  21324. var value = null;
  21325. this.eat(LEFTPARENTHESIS$2);
  21326. this.scanner.skipSC();
  21327. name = this.consume(IDENT$9);
  21328. this.scanner.skipSC();
  21329. if (this.scanner.tokenType !== RIGHTPARENTHESIS$3) {
  21330. this.eat(COLON$2);
  21331. this.scanner.skipSC();
  21332. switch (this.scanner.tokenType) {
  21333. case NUMBER$4:
  21334. if (this.lookupNonWSType(1) === DELIM$3) {
  21335. value = this.Ratio();
  21336. } else {
  21337. value = this.Number();
  21338. }
  21339. break;
  21340. case DIMENSION$4:
  21341. value = this.Dimension();
  21342. break;
  21343. case IDENT$9:
  21344. value = this.Identifier();
  21345. break;
  21346. default:
  21347. this.error('Number, dimension, ratio or identifier is expected');
  21348. }
  21349. this.scanner.skipSC();
  21350. }
  21351. this.eat(RIGHTPARENTHESIS$3);
  21352. return {
  21353. type: 'MediaFeature',
  21354. loc: this.getLocation(start, this.scanner.tokenStart),
  21355. name: name,
  21356. value: value
  21357. };
  21358. },
  21359. generate: function(node) {
  21360. this.chunk('(');
  21361. this.chunk(node.name);
  21362. if (node.value !== null) {
  21363. this.chunk(':');
  21364. this.node(node.value);
  21365. }
  21366. this.chunk(')');
  21367. }
  21368. };
  21369. var TYPE$r = tokenizer.TYPE;
  21370. var WHITESPACE$7 = TYPE$r.WhiteSpace;
  21371. var COMMENT$7 = TYPE$r.Comment;
  21372. var IDENT$a = TYPE$r.Ident;
  21373. var LEFTPARENTHESIS$3 = TYPE$r.LeftParenthesis;
  21374. var MediaQuery = {
  21375. name: 'MediaQuery',
  21376. structure: {
  21377. children: [[
  21378. 'Identifier',
  21379. 'MediaFeature',
  21380. 'WhiteSpace'
  21381. ]]
  21382. },
  21383. parse: function() {
  21384. this.scanner.skipSC();
  21385. var children = this.createList();
  21386. var child = null;
  21387. var space = null;
  21388. scan:
  21389. while (!this.scanner.eof) {
  21390. switch (this.scanner.tokenType) {
  21391. case COMMENT$7:
  21392. this.scanner.next();
  21393. continue;
  21394. case WHITESPACE$7:
  21395. space = this.WhiteSpace();
  21396. continue;
  21397. case IDENT$a:
  21398. child = this.Identifier();
  21399. break;
  21400. case LEFTPARENTHESIS$3:
  21401. child = this.MediaFeature();
  21402. break;
  21403. default:
  21404. break scan;
  21405. }
  21406. if (space !== null) {
  21407. children.push(space);
  21408. space = null;
  21409. }
  21410. children.push(child);
  21411. }
  21412. if (child === null) {
  21413. this.error('Identifier or parenthesis is expected');
  21414. }
  21415. return {
  21416. type: 'MediaQuery',
  21417. loc: this.getLocationFromList(children),
  21418. children: children
  21419. };
  21420. },
  21421. generate: function(node) {
  21422. this.children(node);
  21423. }
  21424. };
  21425. var COMMA$1 = tokenizer.TYPE.Comma;
  21426. var MediaQueryList = {
  21427. name: 'MediaQueryList',
  21428. structure: {
  21429. children: [[
  21430. 'MediaQuery'
  21431. ]]
  21432. },
  21433. parse: function(relative) {
  21434. var children = this.createList();
  21435. this.scanner.skipSC();
  21436. while (!this.scanner.eof) {
  21437. children.push(this.MediaQuery(relative));
  21438. if (this.scanner.tokenType !== COMMA$1) {
  21439. break;
  21440. }
  21441. this.scanner.next();
  21442. }
  21443. return {
  21444. type: 'MediaQueryList',
  21445. loc: this.getLocationFromList(children),
  21446. children: children
  21447. };
  21448. },
  21449. generate: function(node) {
  21450. this.children(node, function() {
  21451. this.chunk(',');
  21452. });
  21453. }
  21454. };
  21455. var Nth = {
  21456. name: 'Nth',
  21457. structure: {
  21458. nth: ['AnPlusB', 'Identifier'],
  21459. selector: ['SelectorList', null]
  21460. },
  21461. parse: function(allowOfClause) {
  21462. this.scanner.skipSC();
  21463. var start = this.scanner.tokenStart;
  21464. var end = start;
  21465. var selector = null;
  21466. var query;
  21467. if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {
  21468. query = this.Identifier();
  21469. } else {
  21470. query = this.AnPlusB();
  21471. }
  21472. this.scanner.skipSC();
  21473. if (allowOfClause && this.scanner.lookupValue(0, 'of')) {
  21474. this.scanner.next();
  21475. selector = this.SelectorList();
  21476. if (this.needPositions) {
  21477. end = this.getLastListNode(selector.children).loc.end.offset;
  21478. }
  21479. } else {
  21480. if (this.needPositions) {
  21481. end = query.loc.end.offset;
  21482. }
  21483. }
  21484. return {
  21485. type: 'Nth',
  21486. loc: this.getLocation(start, end),
  21487. nth: query,
  21488. selector: selector
  21489. };
  21490. },
  21491. generate: function(node) {
  21492. this.node(node.nth);
  21493. if (node.selector !== null) {
  21494. this.chunk(' of ');
  21495. this.node(node.selector);
  21496. }
  21497. }
  21498. };
  21499. var NUMBER$5 = tokenizer.TYPE.Number;
  21500. var _Number = {
  21501. name: 'Number',
  21502. structure: {
  21503. value: String
  21504. },
  21505. parse: function() {
  21506. return {
  21507. type: 'Number',
  21508. loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  21509. value: this.consume(NUMBER$5)
  21510. };
  21511. },
  21512. generate: function(node) {
  21513. this.chunk(node.value);
  21514. }
  21515. };
  21516. // '/' | '*' | ',' | ':' | '+' | '-'
  21517. var Operator = {
  21518. name: 'Operator',
  21519. structure: {
  21520. value: String
  21521. },
  21522. parse: function() {
  21523. var start = this.scanner.tokenStart;
  21524. this.scanner.next();
  21525. return {
  21526. type: 'Operator',
  21527. loc: this.getLocation(start, this.scanner.tokenStart),
  21528. value: this.scanner.substrToCursor(start)
  21529. };
  21530. },
  21531. generate: function(node) {
  21532. this.chunk(node.value);
  21533. }
  21534. };
  21535. var TYPE$s = tokenizer.TYPE;
  21536. var LEFTPARENTHESIS$4 = TYPE$s.LeftParenthesis;
  21537. var RIGHTPARENTHESIS$4 = TYPE$s.RightParenthesis;
  21538. var Parentheses = {
  21539. name: 'Parentheses',
  21540. structure: {
  21541. children: [[]]
  21542. },
  21543. parse: function(readSequence, recognizer) {
  21544. var start = this.scanner.tokenStart;
  21545. var children = null;
  21546. this.eat(LEFTPARENTHESIS$4);
  21547. children = readSequence.call(this, recognizer);
  21548. if (!this.scanner.eof) {
  21549. this.eat(RIGHTPARENTHESIS$4);
  21550. }
  21551. return {
  21552. type: 'Parentheses',
  21553. loc: this.getLocation(start, this.scanner.tokenStart),
  21554. children: children
  21555. };
  21556. },
  21557. generate: function(node) {
  21558. this.chunk('(');
  21559. this.children(node);
  21560. this.chunk(')');
  21561. }
  21562. };
  21563. var consumeNumber$4 = utils.consumeNumber;
  21564. var TYPE$t = tokenizer.TYPE;
  21565. var PERCENTAGE$1 = TYPE$t.Percentage;
  21566. var Percentage = {
  21567. name: 'Percentage',
  21568. structure: {
  21569. value: String
  21570. },
  21571. parse: function() {
  21572. var start = this.scanner.tokenStart;
  21573. var numberEnd = consumeNumber$4(this.scanner.source, start);
  21574. this.eat(PERCENTAGE$1);
  21575. return {
  21576. type: 'Percentage',
  21577. loc: this.getLocation(start, this.scanner.tokenStart),
  21578. value: this.scanner.source.substring(start, numberEnd)
  21579. };
  21580. },
  21581. generate: function(node) {
  21582. this.chunk(node.value);
  21583. this.chunk('%');
  21584. }
  21585. };
  21586. var TYPE$u = tokenizer.TYPE;
  21587. var IDENT$b = TYPE$u.Ident;
  21588. var FUNCTION$1 = TYPE$u.Function;
  21589. var COLON$3 = TYPE$u.Colon;
  21590. var RIGHTPARENTHESIS$5 = TYPE$u.RightParenthesis;
  21591. // : [ <ident> | <function-token> <any-value>? ) ]
  21592. var PseudoClassSelector = {
  21593. name: 'PseudoClassSelector',
  21594. structure: {
  21595. name: String,
  21596. children: [['Raw'], null]
  21597. },
  21598. parse: function() {
  21599. var start = this.scanner.tokenStart;
  21600. var children = null;
  21601. var name;
  21602. var nameLowerCase;
  21603. this.eat(COLON$3);
  21604. if (this.scanner.tokenType === FUNCTION$1) {
  21605. name = this.consumeFunctionName();
  21606. nameLowerCase = name.toLowerCase();
  21607. if (this.pseudo.hasOwnProperty(nameLowerCase)) {
  21608. this.scanner.skipSC();
  21609. children = this.pseudo[nameLowerCase].call(this);
  21610. this.scanner.skipSC();
  21611. } else {
  21612. children = this.createList();
  21613. children.push(
  21614. this.Raw(this.scanner.tokenIndex, null, false)
  21615. );
  21616. }
  21617. this.eat(RIGHTPARENTHESIS$5);
  21618. } else {
  21619. name = this.consume(IDENT$b);
  21620. }
  21621. return {
  21622. type: 'PseudoClassSelector',
  21623. loc: this.getLocation(start, this.scanner.tokenStart),
  21624. name: name,
  21625. children: children
  21626. };
  21627. },
  21628. generate: function(node) {
  21629. this.chunk(':');
  21630. this.chunk(node.name);
  21631. if (node.children !== null) {
  21632. this.chunk('(');
  21633. this.children(node);
  21634. this.chunk(')');
  21635. }
  21636. },
  21637. walkContext: 'function'
  21638. };
  21639. var TYPE$v = tokenizer.TYPE;
  21640. var IDENT$c = TYPE$v.Ident;
  21641. var FUNCTION$2 = TYPE$v.Function;
  21642. var COLON$4 = TYPE$v.Colon;
  21643. var RIGHTPARENTHESIS$6 = TYPE$v.RightParenthesis;
  21644. // :: [ <ident> | <function-token> <any-value>? ) ]
  21645. var PseudoElementSelector = {
  21646. name: 'PseudoElementSelector',
  21647. structure: {
  21648. name: String,
  21649. children: [['Raw'], null]
  21650. },
  21651. parse: function() {
  21652. var start = this.scanner.tokenStart;
  21653. var children = null;
  21654. var name;
  21655. var nameLowerCase;
  21656. this.eat(COLON$4);
  21657. this.eat(COLON$4);
  21658. if (this.scanner.tokenType === FUNCTION$2) {
  21659. name = this.consumeFunctionName();
  21660. nameLowerCase = name.toLowerCase();
  21661. if (this.pseudo.hasOwnProperty(nameLowerCase)) {
  21662. this.scanner.skipSC();
  21663. children = this.pseudo[nameLowerCase].call(this);
  21664. this.scanner.skipSC();
  21665. } else {
  21666. children = this.createList();
  21667. children.push(
  21668. this.Raw(this.scanner.tokenIndex, null, false)
  21669. );
  21670. }
  21671. this.eat(RIGHTPARENTHESIS$6);
  21672. } else {
  21673. name = this.consume(IDENT$c);
  21674. }
  21675. return {
  21676. type: 'PseudoElementSelector',
  21677. loc: this.getLocation(start, this.scanner.tokenStart),
  21678. name: name,
  21679. children: children
  21680. };
  21681. },
  21682. generate: function(node) {
  21683. this.chunk('::');
  21684. this.chunk(node.name);
  21685. if (node.children !== null) {
  21686. this.chunk('(');
  21687. this.children(node);
  21688. this.chunk(')');
  21689. }
  21690. },
  21691. walkContext: 'function'
  21692. };
  21693. var isDigit$5 = tokenizer.isDigit;
  21694. var TYPE$w = tokenizer.TYPE;
  21695. var NUMBER$6 = TYPE$w.Number;
  21696. var DELIM$4 = TYPE$w.Delim;
  21697. var SOLIDUS$3 = 0x002F; // U+002F SOLIDUS (/)
  21698. var FULLSTOP$1 = 0x002E; // U+002E FULL STOP (.)
  21699. // Terms of <ratio> should be a positive numbers (not zero or negative)
  21700. // (see https://drafts.csswg.org/mediaqueries-3/#values)
  21701. // However, -o-min-device-pixel-ratio takes fractional values as a ratio's term
  21702. // and this is using by various sites. Therefore we relax checking on parse
  21703. // to test a term is unsigned number without an exponent part.
  21704. // Additional checking may be applied on lexer validation.
  21705. function consumeNumber$5() {
  21706. this.scanner.skipWS();
  21707. var value = this.consume(NUMBER$6);
  21708. for (var i = 0; i < value.length; i++) {
  21709. var code = value.charCodeAt(i);
  21710. if (!isDigit$5(code) && code !== FULLSTOP$1) {
  21711. this.error('Unsigned number is expected', this.scanner.tokenStart - value.length + i);
  21712. }
  21713. }
  21714. if (Number(value) === 0) {
  21715. this.error('Zero number is not allowed', this.scanner.tokenStart - value.length);
  21716. }
  21717. return value;
  21718. }
  21719. // <positive-integer> S* '/' S* <positive-integer>
  21720. var Ratio = {
  21721. name: 'Ratio',
  21722. structure: {
  21723. left: String,
  21724. right: String
  21725. },
  21726. parse: function() {
  21727. var start = this.scanner.tokenStart;
  21728. var left = consumeNumber$5.call(this);
  21729. var right;
  21730. this.scanner.skipWS();
  21731. if (!this.scanner.isDelim(SOLIDUS$3)) {
  21732. this.error('Solidus is expected');
  21733. }
  21734. this.eat(DELIM$4);
  21735. right = consumeNumber$5.call(this);
  21736. return {
  21737. type: 'Ratio',
  21738. loc: this.getLocation(start, this.scanner.tokenStart),
  21739. left: left,
  21740. right: right
  21741. };
  21742. },
  21743. generate: function(node) {
  21744. this.chunk(node.left);
  21745. this.chunk('/');
  21746. this.chunk(node.right);
  21747. }
  21748. };
  21749. var TYPE$x = tokenizer.TYPE;
  21750. var rawMode$4 = Raw.mode;
  21751. var LEFTCURLYBRACKET$4 = TYPE$x.LeftCurlyBracket;
  21752. function consumeRaw$3(startToken) {
  21753. return this.Raw(startToken, rawMode$4.leftCurlyBracket, true);
  21754. }
  21755. function consumePrelude() {
  21756. var prelude = this.SelectorList();
  21757. if (prelude.type !== 'Raw' &&
  21758. this.scanner.eof === false &&
  21759. this.scanner.tokenType !== LEFTCURLYBRACKET$4) {
  21760. this.error();
  21761. }
  21762. return prelude;
  21763. }
  21764. var Rule = {
  21765. name: 'Rule',
  21766. structure: {
  21767. prelude: ['SelectorList', 'Raw'],
  21768. block: ['Block']
  21769. },
  21770. parse: function() {
  21771. var startToken = this.scanner.tokenIndex;
  21772. var startOffset = this.scanner.tokenStart;
  21773. var prelude;
  21774. var block;
  21775. if (this.parseRulePrelude) {
  21776. prelude = this.parseWithFallback(consumePrelude, consumeRaw$3);
  21777. } else {
  21778. prelude = consumeRaw$3.call(this, startToken);
  21779. }
  21780. block = this.Block(true);
  21781. return {
  21782. type: 'Rule',
  21783. loc: this.getLocation(startOffset, this.scanner.tokenStart),
  21784. prelude: prelude,
  21785. block: block
  21786. };
  21787. },
  21788. generate: function(node) {
  21789. this.node(node.prelude);
  21790. this.node(node.block);
  21791. },
  21792. walkContext: 'rule'
  21793. };
  21794. var Selector = {
  21795. name: 'Selector',
  21796. structure: {
  21797. children: [[
  21798. 'TypeSelector',
  21799. 'IdSelector',
  21800. 'ClassSelector',
  21801. 'AttributeSelector',
  21802. 'PseudoClassSelector',
  21803. 'PseudoElementSelector',
  21804. 'Combinator',
  21805. 'WhiteSpace'
  21806. ]]
  21807. },
  21808. parse: function() {
  21809. var children = this.readSequence(this.scope.Selector);
  21810. // nothing were consumed
  21811. if (this.getFirstListNode(children) === null) {
  21812. this.error('Selector is expected');
  21813. }
  21814. return {
  21815. type: 'Selector',
  21816. loc: this.getLocationFromList(children),
  21817. children: children
  21818. };
  21819. },
  21820. generate: function(node) {
  21821. this.children(node);
  21822. }
  21823. };
  21824. var TYPE$y = tokenizer.TYPE;
  21825. var COMMA$2 = TYPE$y.Comma;
  21826. var SelectorList = {
  21827. name: 'SelectorList',
  21828. structure: {
  21829. children: [[
  21830. 'Selector',
  21831. 'Raw'
  21832. ]]
  21833. },
  21834. parse: function() {
  21835. var children = this.createList();
  21836. while (!this.scanner.eof) {
  21837. children.push(this.Selector());
  21838. if (this.scanner.tokenType === COMMA$2) {
  21839. this.scanner.next();
  21840. continue;
  21841. }
  21842. break;
  21843. }
  21844. return {
  21845. type: 'SelectorList',
  21846. loc: this.getLocationFromList(children),
  21847. children: children
  21848. };
  21849. },
  21850. generate: function(node) {
  21851. this.children(node, function() {
  21852. this.chunk(',');
  21853. });
  21854. },
  21855. walkContext: 'selector'
  21856. };
  21857. var STRING$1 = tokenizer.TYPE.String;
  21858. var _String = {
  21859. name: 'String',
  21860. structure: {
  21861. value: String
  21862. },
  21863. parse: function() {
  21864. return {
  21865. type: 'String',
  21866. loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  21867. value: this.consume(STRING$1)
  21868. };
  21869. },
  21870. generate: function(node) {
  21871. this.chunk(node.value);
  21872. }
  21873. };
  21874. var TYPE$z = tokenizer.TYPE;
  21875. var WHITESPACE$8 = TYPE$z.WhiteSpace;
  21876. var COMMENT$8 = TYPE$z.Comment;
  21877. var ATKEYWORD$2 = TYPE$z.AtKeyword;
  21878. var CDO$1 = TYPE$z.CDO;
  21879. var CDC$1 = TYPE$z.CDC;
  21880. var EXCLAMATIONMARK$3 = 0x0021; // U+0021 EXCLAMATION MARK (!)
  21881. function consumeRaw$4(startToken) {
  21882. return this.Raw(startToken, null, false);
  21883. }
  21884. var StyleSheet = {
  21885. name: 'StyleSheet',
  21886. structure: {
  21887. children: [[
  21888. 'Comment',
  21889. 'CDO',
  21890. 'CDC',
  21891. 'Atrule',
  21892. 'Rule',
  21893. 'Raw'
  21894. ]]
  21895. },
  21896. parse: function() {
  21897. var start = this.scanner.tokenStart;
  21898. var children = this.createList();
  21899. var child;
  21900. while (!this.scanner.eof) {
  21901. switch (this.scanner.tokenType) {
  21902. case WHITESPACE$8:
  21903. this.scanner.next();
  21904. continue;
  21905. case COMMENT$8:
  21906. // ignore comments except exclamation comments (i.e. /*! .. */) on top level
  21907. if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 2) !== EXCLAMATIONMARK$3) {
  21908. this.scanner.next();
  21909. continue;
  21910. }
  21911. child = this.Comment();
  21912. break;
  21913. case CDO$1: // <!--
  21914. child = this.CDO();
  21915. break;
  21916. case CDC$1: // -->
  21917. child = this.CDC();
  21918. break;
  21919. // CSS Syntax Module Level 3
  21920. // §2.2 Error handling
  21921. // At the "top level" of a stylesheet, an <at-keyword-token> starts an at-rule.
  21922. case ATKEYWORD$2:
  21923. child = this.parseWithFallback(this.Atrule, consumeRaw$4);
  21924. break;
  21925. // Anything else starts a qualified rule ...
  21926. default:
  21927. child = this.parseWithFallback(this.Rule, consumeRaw$4);
  21928. }
  21929. children.push(child);
  21930. }
  21931. return {
  21932. type: 'StyleSheet',
  21933. loc: this.getLocation(start, this.scanner.tokenStart),
  21934. children: children
  21935. };
  21936. },
  21937. generate: function(node) {
  21938. this.children(node);
  21939. },
  21940. walkContext: 'stylesheet'
  21941. };
  21942. var TYPE$A = tokenizer.TYPE;
  21943. var IDENT$d = TYPE$A.Ident;
  21944. var ASTERISK$4 = 0x002A; // U+002A ASTERISK (*)
  21945. var VERTICALLINE$2 = 0x007C; // U+007C VERTICAL LINE (|)
  21946. function eatIdentifierOrAsterisk() {
  21947. if (this.scanner.tokenType !== IDENT$d &&
  21948. this.scanner.isDelim(ASTERISK$4) === false) {
  21949. this.error('Identifier or asterisk is expected');
  21950. }
  21951. this.scanner.next();
  21952. }
  21953. // ident
  21954. // ident|ident
  21955. // ident|*
  21956. // *
  21957. // *|ident
  21958. // *|*
  21959. // |ident
  21960. // |*
  21961. var TypeSelector = {
  21962. name: 'TypeSelector',
  21963. structure: {
  21964. name: String
  21965. },
  21966. parse: function() {
  21967. var start = this.scanner.tokenStart;
  21968. if (this.scanner.isDelim(VERTICALLINE$2)) {
  21969. this.scanner.next();
  21970. eatIdentifierOrAsterisk.call(this);
  21971. } else {
  21972. eatIdentifierOrAsterisk.call(this);
  21973. if (this.scanner.isDelim(VERTICALLINE$2)) {
  21974. this.scanner.next();
  21975. eatIdentifierOrAsterisk.call(this);
  21976. }
  21977. }
  21978. return {
  21979. type: 'TypeSelector',
  21980. loc: this.getLocation(start, this.scanner.tokenStart),
  21981. name: this.scanner.substrToCursor(start)
  21982. };
  21983. },
  21984. generate: function(node) {
  21985. this.chunk(node.name);
  21986. }
  21987. };
  21988. var isHexDigit$4 = tokenizer.isHexDigit;
  21989. var cmpChar$4 = tokenizer.cmpChar;
  21990. var TYPE$B = tokenizer.TYPE;
  21991. var NAME$3 = tokenizer.NAME;
  21992. var IDENT$e = TYPE$B.Ident;
  21993. var NUMBER$7 = TYPE$B.Number;
  21994. var DIMENSION$5 = TYPE$B.Dimension;
  21995. var PLUSSIGN$6 = 0x002B; // U+002B PLUS SIGN (+)
  21996. var HYPHENMINUS$4 = 0x002D; // U+002D HYPHEN-MINUS (-)
  21997. var QUESTIONMARK$2 = 0x003F; // U+003F QUESTION MARK (?)
  21998. var U$1 = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
  21999. function eatHexSequence(offset, allowDash) {
  22000. for (var pos = this.scanner.tokenStart + offset, len = 0; pos < this.scanner.tokenEnd; pos++) {
  22001. var code = this.scanner.source.charCodeAt(pos);
  22002. if (code === HYPHENMINUS$4 && allowDash && len !== 0) {
  22003. if (eatHexSequence.call(this, offset + len + 1, false) === 0) {
  22004. this.error();
  22005. }
  22006. return -1;
  22007. }
  22008. if (!isHexDigit$4(code)) {
  22009. this.error(
  22010. allowDash && len !== 0
  22011. ? 'HyphenMinus' + (len < 6 ? ' or hex digit' : '') + ' is expected'
  22012. : (len < 6 ? 'Hex digit is expected' : 'Unexpected input'),
  22013. pos
  22014. );
  22015. }
  22016. if (++len > 6) {
  22017. this.error('Too many hex digits', pos);
  22018. } }
  22019. this.scanner.next();
  22020. return len;
  22021. }
  22022. function eatQuestionMarkSequence(max) {
  22023. var count = 0;
  22024. while (this.scanner.isDelim(QUESTIONMARK$2)) {
  22025. if (++count > max) {
  22026. this.error('Too many question marks');
  22027. }
  22028. this.scanner.next();
  22029. }
  22030. }
  22031. function startsWith$1(code) {
  22032. if (this.scanner.source.charCodeAt(this.scanner.tokenStart) !== code) {
  22033. this.error(NAME$3[code] + ' is expected');
  22034. }
  22035. }
  22036. // https://drafts.csswg.org/css-syntax/#urange
  22037. // Informally, the <urange> production has three forms:
  22038. // U+0001
  22039. // Defines a range consisting of a single code point, in this case the code point "1".
  22040. // U+0001-00ff
  22041. // Defines a range of codepoints between the first and the second value, in this case
  22042. // the range between "1" and "ff" (255 in decimal) inclusive.
  22043. // U+00??
  22044. // Defines a range of codepoints where the "?" characters range over all hex digits,
  22045. // in this case defining the same as the value U+0000-00ff.
  22046. // In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
  22047. //
  22048. // <urange> =
  22049. // u '+' <ident-token> '?'* |
  22050. // u <dimension-token> '?'* |
  22051. // u <number-token> '?'* |
  22052. // u <number-token> <dimension-token> |
  22053. // u <number-token> <number-token> |
  22054. // u '+' '?'+
  22055. function scanUnicodeRange() {
  22056. var hexLength = 0;
  22057. // u '+' <ident-token> '?'*
  22058. // u '+' '?'+
  22059. if (this.scanner.isDelim(PLUSSIGN$6)) {
  22060. this.scanner.next();
  22061. if (this.scanner.tokenType === IDENT$e) {
  22062. hexLength = eatHexSequence.call(this, 0, true);
  22063. if (hexLength > 0) {
  22064. eatQuestionMarkSequence.call(this, 6 - hexLength);
  22065. }
  22066. return;
  22067. }
  22068. if (this.scanner.isDelim(QUESTIONMARK$2)) {
  22069. this.scanner.next();
  22070. eatQuestionMarkSequence.call(this, 5);
  22071. return;
  22072. }
  22073. this.error('Hex digit or question mark is expected');
  22074. return;
  22075. }
  22076. // u <number-token> '?'*
  22077. // u <number-token> <dimension-token>
  22078. // u <number-token> <number-token>
  22079. if (this.scanner.tokenType === NUMBER$7) {
  22080. startsWith$1.call(this, PLUSSIGN$6);
  22081. hexLength = eatHexSequence.call(this, 1, true);
  22082. if (this.scanner.isDelim(QUESTIONMARK$2)) {
  22083. eatQuestionMarkSequence.call(this, 6 - hexLength);
  22084. return;
  22085. }
  22086. if (this.scanner.tokenType === DIMENSION$5 ||
  22087. this.scanner.tokenType === NUMBER$7) {
  22088. startsWith$1.call(this, HYPHENMINUS$4);
  22089. eatHexSequence.call(this, 1, false);
  22090. return;
  22091. }
  22092. return;
  22093. }
  22094. // u <dimension-token> '?'*
  22095. if (this.scanner.tokenType === DIMENSION$5) {
  22096. startsWith$1.call(this, PLUSSIGN$6);
  22097. hexLength = eatHexSequence.call(this, 1, true);
  22098. if (hexLength > 0) {
  22099. eatQuestionMarkSequence.call(this, 6 - hexLength);
  22100. }
  22101. return;
  22102. }
  22103. this.error();
  22104. }
  22105. var UnicodeRange = {
  22106. name: 'UnicodeRange',
  22107. structure: {
  22108. value: String
  22109. },
  22110. parse: function() {
  22111. var start = this.scanner.tokenStart;
  22112. // U or u
  22113. if (!cmpChar$4(this.scanner.source, start, U$1)) {
  22114. this.error('U is expected');
  22115. }
  22116. if (!cmpChar$4(this.scanner.source, start + 1, PLUSSIGN$6)) {
  22117. this.error('Plus sign is expected');
  22118. }
  22119. this.scanner.next();
  22120. scanUnicodeRange.call(this);
  22121. return {
  22122. type: 'UnicodeRange',
  22123. loc: this.getLocation(start, this.scanner.tokenStart),
  22124. value: this.scanner.substrToCursor(start)
  22125. };
  22126. },
  22127. generate: function(node) {
  22128. this.chunk(node.value);
  22129. }
  22130. };
  22131. var isWhiteSpace$2 = tokenizer.isWhiteSpace;
  22132. var cmpStr$4 = tokenizer.cmpStr;
  22133. var TYPE$C = tokenizer.TYPE;
  22134. var FUNCTION$3 = TYPE$C.Function;
  22135. var URL$2 = TYPE$C.Url;
  22136. var RIGHTPARENTHESIS$7 = TYPE$C.RightParenthesis;
  22137. // <url-token> | <function-token> <string> )
  22138. var Url = {
  22139. name: 'Url',
  22140. structure: {
  22141. value: ['String', 'Raw']
  22142. },
  22143. parse: function() {
  22144. var start = this.scanner.tokenStart;
  22145. var value;
  22146. switch (this.scanner.tokenType) {
  22147. case URL$2:
  22148. var rawStart = start + 4;
  22149. var rawEnd = this.scanner.tokenEnd - 1;
  22150. while (rawStart < rawEnd && isWhiteSpace$2(this.scanner.source.charCodeAt(rawStart))) {
  22151. rawStart++;
  22152. }
  22153. while (rawStart < rawEnd && isWhiteSpace$2(this.scanner.source.charCodeAt(rawEnd - 1))) {
  22154. rawEnd--;
  22155. }
  22156. value = {
  22157. type: 'Raw',
  22158. loc: this.getLocation(rawStart, rawEnd),
  22159. value: this.scanner.source.substring(rawStart, rawEnd)
  22160. };
  22161. this.eat(URL$2);
  22162. break;
  22163. case FUNCTION$3:
  22164. if (!cmpStr$4(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')) {
  22165. this.error('Function name must be `url`');
  22166. }
  22167. this.eat(FUNCTION$3);
  22168. this.scanner.skipSC();
  22169. value = this.String();
  22170. this.scanner.skipSC();
  22171. this.eat(RIGHTPARENTHESIS$7);
  22172. break;
  22173. default:
  22174. this.error('Url or Function is expected');
  22175. }
  22176. return {
  22177. type: 'Url',
  22178. loc: this.getLocation(start, this.scanner.tokenStart),
  22179. value: value
  22180. };
  22181. },
  22182. generate: function(node) {
  22183. this.chunk('url');
  22184. this.chunk('(');
  22185. this.node(node.value);
  22186. this.chunk(')');
  22187. }
  22188. };
  22189. var Value = {
  22190. name: 'Value',
  22191. structure: {
  22192. children: [[]]
  22193. },
  22194. parse: function() {
  22195. var start = this.scanner.tokenStart;
  22196. var children = this.readSequence(this.scope.Value);
  22197. return {
  22198. type: 'Value',
  22199. loc: this.getLocation(start, this.scanner.tokenStart),
  22200. children: children
  22201. };
  22202. },
  22203. generate: function(node) {
  22204. this.children(node);
  22205. }
  22206. };
  22207. var WHITESPACE$9 = tokenizer.TYPE.WhiteSpace;
  22208. var SPACE$2 = Object.freeze({
  22209. type: 'WhiteSpace',
  22210. loc: null,
  22211. value: ' '
  22212. });
  22213. var WhiteSpace$1 = {
  22214. name: 'WhiteSpace',
  22215. structure: {
  22216. value: String
  22217. },
  22218. parse: function() {
  22219. this.eat(WHITESPACE$9);
  22220. return SPACE$2;
  22221. // return {
  22222. // type: 'WhiteSpace',
  22223. // loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  22224. // value: this.consume(WHITESPACE)
  22225. // };
  22226. },
  22227. generate: function(node) {
  22228. this.chunk(node.value);
  22229. }
  22230. };
  22231. var node = {
  22232. AnPlusB: AnPlusB,
  22233. Atrule: Atrule,
  22234. AtrulePrelude: AtrulePrelude,
  22235. AttributeSelector: AttributeSelector,
  22236. Block: Block,
  22237. Brackets: Brackets,
  22238. CDC: CDC_1,
  22239. CDO: CDO_1,
  22240. ClassSelector: ClassSelector,
  22241. Combinator: Combinator,
  22242. Comment: Comment,
  22243. Declaration: Declaration,
  22244. DeclarationList: DeclarationList,
  22245. Dimension: Dimension,
  22246. Function: _Function,
  22247. HexColor: HexColor,
  22248. Identifier: Identifier,
  22249. IdSelector: IdSelector,
  22250. MediaFeature: MediaFeature,
  22251. MediaQuery: MediaQuery,
  22252. MediaQueryList: MediaQueryList,
  22253. Nth: Nth,
  22254. Number: _Number,
  22255. Operator: Operator,
  22256. Parentheses: Parentheses,
  22257. Percentage: Percentage,
  22258. PseudoClassSelector: PseudoClassSelector,
  22259. PseudoElementSelector: PseudoElementSelector,
  22260. Ratio: Ratio,
  22261. Raw: Raw,
  22262. Rule: Rule,
  22263. Selector: Selector,
  22264. SelectorList: SelectorList,
  22265. String: _String,
  22266. StyleSheet: StyleSheet,
  22267. TypeSelector: TypeSelector,
  22268. UnicodeRange: UnicodeRange,
  22269. Url: Url,
  22270. Value: Value,
  22271. WhiteSpace: WhiteSpace$1
  22272. };
  22273. var lexer = {
  22274. generic: true,
  22275. types: data.types,
  22276. atrules: data.atrules,
  22277. properties: data.properties,
  22278. node: node
  22279. };
  22280. var cmpChar$5 = tokenizer.cmpChar;
  22281. var cmpStr$5 = tokenizer.cmpStr;
  22282. var TYPE$D = tokenizer.TYPE;
  22283. var IDENT$f = TYPE$D.Ident;
  22284. var STRING$2 = TYPE$D.String;
  22285. var NUMBER$8 = TYPE$D.Number;
  22286. var FUNCTION$4 = TYPE$D.Function;
  22287. var URL$3 = TYPE$D.Url;
  22288. var HASH$4 = TYPE$D.Hash;
  22289. var DIMENSION$6 = TYPE$D.Dimension;
  22290. var PERCENTAGE$2 = TYPE$D.Percentage;
  22291. var LEFTPARENTHESIS$5 = TYPE$D.LeftParenthesis;
  22292. var LEFTSQUAREBRACKET$3 = TYPE$D.LeftSquareBracket;
  22293. var COMMA$3 = TYPE$D.Comma;
  22294. var DELIM$5 = TYPE$D.Delim;
  22295. var NUMBERSIGN$3 = 0x0023; // U+0023 NUMBER SIGN (#)
  22296. var ASTERISK$5 = 0x002A; // U+002A ASTERISK (*)
  22297. var PLUSSIGN$7 = 0x002B; // U+002B PLUS SIGN (+)
  22298. var HYPHENMINUS$5 = 0x002D; // U+002D HYPHEN-MINUS (-)
  22299. var SOLIDUS$4 = 0x002F; // U+002F SOLIDUS (/)
  22300. var U$2 = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
  22301. var _default = function defaultRecognizer(context) {
  22302. switch (this.scanner.tokenType) {
  22303. case HASH$4:
  22304. return this.HexColor();
  22305. case COMMA$3:
  22306. context.space = null;
  22307. context.ignoreWSAfter = true;
  22308. return this.Operator();
  22309. case LEFTPARENTHESIS$5:
  22310. return this.Parentheses(this.readSequence, context.recognizer);
  22311. case LEFTSQUAREBRACKET$3:
  22312. return this.Brackets(this.readSequence, context.recognizer);
  22313. case STRING$2:
  22314. return this.String();
  22315. case DIMENSION$6:
  22316. return this.Dimension();
  22317. case PERCENTAGE$2:
  22318. return this.Percentage();
  22319. case NUMBER$8:
  22320. return this.Number();
  22321. case FUNCTION$4:
  22322. return cmpStr$5(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')
  22323. ? this.Url()
  22324. : this.Function(this.readSequence, context.recognizer);
  22325. case URL$3:
  22326. return this.Url();
  22327. case IDENT$f:
  22328. // check for unicode range, it should start with u+ or U+
  22329. if (cmpChar$5(this.scanner.source, this.scanner.tokenStart, U$2) &&
  22330. cmpChar$5(this.scanner.source, this.scanner.tokenStart + 1, PLUSSIGN$7)) {
  22331. return this.UnicodeRange();
  22332. } else {
  22333. return this.Identifier();
  22334. }
  22335. case DELIM$5:
  22336. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  22337. if (code === SOLIDUS$4 ||
  22338. code === ASTERISK$5 ||
  22339. code === PLUSSIGN$7 ||
  22340. code === HYPHENMINUS$5) {
  22341. return this.Operator(); // TODO: replace with Delim
  22342. }
  22343. // TODO: produce a node with Delim node type
  22344. if (code === NUMBERSIGN$3) {
  22345. this.error('Hex or identifier is expected', this.scanner.tokenStart + 1);
  22346. }
  22347. break;
  22348. }
  22349. };
  22350. var atrulePrelude = {
  22351. getNode: _default
  22352. };
  22353. var TYPE$E = tokenizer.TYPE;
  22354. var DELIM$6 = TYPE$E.Delim;
  22355. var IDENT$g = TYPE$E.Ident;
  22356. var DIMENSION$7 = TYPE$E.Dimension;
  22357. var PERCENTAGE$3 = TYPE$E.Percentage;
  22358. var NUMBER$9 = TYPE$E.Number;
  22359. var HASH$5 = TYPE$E.Hash;
  22360. var COLON$5 = TYPE$E.Colon;
  22361. var LEFTSQUAREBRACKET$4 = TYPE$E.LeftSquareBracket;
  22362. var NUMBERSIGN$4 = 0x0023; // U+0023 NUMBER SIGN (#)
  22363. var ASTERISK$6 = 0x002A; // U+002A ASTERISK (*)
  22364. var PLUSSIGN$8 = 0x002B; // U+002B PLUS SIGN (+)
  22365. var SOLIDUS$5 = 0x002F; // U+002F SOLIDUS (/)
  22366. var FULLSTOP$2 = 0x002E; // U+002E FULL STOP (.)
  22367. var GREATERTHANSIGN$2 = 0x003E; // U+003E GREATER-THAN SIGN (>)
  22368. var VERTICALLINE$3 = 0x007C; // U+007C VERTICAL LINE (|)
  22369. var TILDE$2 = 0x007E; // U+007E TILDE (~)
  22370. function getNode(context) {
  22371. switch (this.scanner.tokenType) {
  22372. case LEFTSQUAREBRACKET$4:
  22373. return this.AttributeSelector();
  22374. case HASH$5:
  22375. return this.IdSelector();
  22376. case COLON$5:
  22377. if (this.scanner.lookupType(1) === COLON$5) {
  22378. return this.PseudoElementSelector();
  22379. } else {
  22380. return this.PseudoClassSelector();
  22381. }
  22382. case IDENT$g:
  22383. return this.TypeSelector();
  22384. case NUMBER$9:
  22385. case PERCENTAGE$3:
  22386. return this.Percentage();
  22387. case DIMENSION$7:
  22388. // throws when .123ident
  22389. if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === FULLSTOP$2) {
  22390. this.error('Identifier is expected', this.scanner.tokenStart + 1);
  22391. }
  22392. break;
  22393. case DELIM$6:
  22394. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  22395. switch (code) {
  22396. case PLUSSIGN$8:
  22397. case GREATERTHANSIGN$2:
  22398. case TILDE$2:
  22399. context.space = null;
  22400. context.ignoreWSAfter = true;
  22401. return this.Combinator();
  22402. case SOLIDUS$5: // /deep/
  22403. return this.Combinator();
  22404. case FULLSTOP$2:
  22405. return this.ClassSelector();
  22406. case ASTERISK$6:
  22407. case VERTICALLINE$3:
  22408. return this.TypeSelector();
  22409. case NUMBERSIGN$4:
  22410. return this.IdSelector();
  22411. }
  22412. break;
  22413. }
  22414. }
  22415. var selector = {
  22416. getNode: getNode
  22417. };
  22418. // https://drafts.csswg.org/css-images-4/#element-notation
  22419. // https://developer.mozilla.org/en-US/docs/Web/CSS/element
  22420. var element = function() {
  22421. this.scanner.skipSC();
  22422. var children = this.createSingleNodeList(
  22423. this.IdSelector()
  22424. );
  22425. this.scanner.skipSC();
  22426. return children;
  22427. };
  22428. // legacy IE function
  22429. // expression( <any-value> )
  22430. var expression = function() {
  22431. return this.createSingleNodeList(
  22432. this.Raw(this.scanner.tokenIndex, null, false)
  22433. );
  22434. };
  22435. var TYPE$F = tokenizer.TYPE;
  22436. var rawMode$5 = Raw.mode;
  22437. var COMMA$4 = TYPE$F.Comma;
  22438. // var( <ident> , <value>? )
  22439. var _var = function() {
  22440. var children = this.createList();
  22441. this.scanner.skipSC();
  22442. // NOTE: Don't check more than a first argument is an ident, rest checks are for lexer
  22443. children.push(this.Identifier());
  22444. this.scanner.skipSC();
  22445. if (this.scanner.tokenType === COMMA$4) {
  22446. children.push(this.Operator());
  22447. children.push(this.parseCustomProperty
  22448. ? this.Value(null)
  22449. : this.Raw(this.scanner.tokenIndex, rawMode$5.exclamationMarkOrSemicolon, false)
  22450. );
  22451. }
  22452. return children;
  22453. };
  22454. var value = {
  22455. getNode: _default,
  22456. '-moz-element': element,
  22457. 'element': element,
  22458. 'expression': expression,
  22459. 'var': _var
  22460. };
  22461. var scope = {
  22462. AtrulePrelude: atrulePrelude,
  22463. Selector: selector,
  22464. Value: value
  22465. };
  22466. var fontFace = {
  22467. parse: {
  22468. prelude: null,
  22469. block: function() {
  22470. return this.Block(true);
  22471. }
  22472. }
  22473. };
  22474. var TYPE$G = tokenizer.TYPE;
  22475. var STRING$3 = TYPE$G.String;
  22476. var IDENT$h = TYPE$G.Ident;
  22477. var URL$4 = TYPE$G.Url;
  22478. var FUNCTION$5 = TYPE$G.Function;
  22479. var LEFTPARENTHESIS$6 = TYPE$G.LeftParenthesis;
  22480. var _import = {
  22481. parse: {
  22482. prelude: function() {
  22483. var children = this.createList();
  22484. this.scanner.skipSC();
  22485. switch (this.scanner.tokenType) {
  22486. case STRING$3:
  22487. children.push(this.String());
  22488. break;
  22489. case URL$4:
  22490. case FUNCTION$5:
  22491. children.push(this.Url());
  22492. break;
  22493. default:
  22494. this.error('String or url() is expected');
  22495. }
  22496. if (this.lookupNonWSType(0) === IDENT$h ||
  22497. this.lookupNonWSType(0) === LEFTPARENTHESIS$6) {
  22498. children.push(this.WhiteSpace());
  22499. children.push(this.MediaQueryList());
  22500. }
  22501. return children;
  22502. },
  22503. block: null
  22504. }
  22505. };
  22506. var media = {
  22507. parse: {
  22508. prelude: function() {
  22509. return this.createSingleNodeList(
  22510. this.MediaQueryList()
  22511. );
  22512. },
  22513. block: function() {
  22514. return this.Block(false);
  22515. }
  22516. }
  22517. };
  22518. var page = {
  22519. parse: {
  22520. prelude: function() {
  22521. return this.createSingleNodeList(
  22522. this.SelectorList()
  22523. );
  22524. },
  22525. block: function() {
  22526. return this.Block(true);
  22527. }
  22528. }
  22529. };
  22530. var TYPE$H = tokenizer.TYPE;
  22531. var WHITESPACE$a = TYPE$H.WhiteSpace;
  22532. var COMMENT$9 = TYPE$H.Comment;
  22533. var IDENT$i = TYPE$H.Ident;
  22534. var FUNCTION$6 = TYPE$H.Function;
  22535. var COLON$6 = TYPE$H.Colon;
  22536. var LEFTPARENTHESIS$7 = TYPE$H.LeftParenthesis;
  22537. function consumeRaw$5() {
  22538. return this.createSingleNodeList(
  22539. this.Raw(this.scanner.tokenIndex, null, false)
  22540. );
  22541. }
  22542. function parentheses() {
  22543. this.scanner.skipSC();
  22544. if (this.scanner.tokenType === IDENT$i &&
  22545. this.lookupNonWSType(1) === COLON$6) {
  22546. return this.createSingleNodeList(
  22547. this.Declaration()
  22548. );
  22549. }
  22550. return readSequence.call(this);
  22551. }
  22552. function readSequence() {
  22553. var children = this.createList();
  22554. var space = null;
  22555. var child;
  22556. this.scanner.skipSC();
  22557. scan:
  22558. while (!this.scanner.eof) {
  22559. switch (this.scanner.tokenType) {
  22560. case WHITESPACE$a:
  22561. space = this.WhiteSpace();
  22562. continue;
  22563. case COMMENT$9:
  22564. this.scanner.next();
  22565. continue;
  22566. case FUNCTION$6:
  22567. child = this.Function(consumeRaw$5, this.scope.AtrulePrelude);
  22568. break;
  22569. case IDENT$i:
  22570. child = this.Identifier();
  22571. break;
  22572. case LEFTPARENTHESIS$7:
  22573. child = this.Parentheses(parentheses, this.scope.AtrulePrelude);
  22574. break;
  22575. default:
  22576. break scan;
  22577. }
  22578. if (space !== null) {
  22579. children.push(space);
  22580. space = null;
  22581. }
  22582. children.push(child);
  22583. }
  22584. return children;
  22585. }
  22586. var supports = {
  22587. parse: {
  22588. prelude: function() {
  22589. var children = readSequence.call(this);
  22590. if (this.getFirstListNode(children) === null) {
  22591. this.error('Condition is expected');
  22592. }
  22593. return children;
  22594. },
  22595. block: function() {
  22596. return this.Block(false);
  22597. }
  22598. }
  22599. };
  22600. var atrule = {
  22601. 'font-face': fontFace,
  22602. 'import': _import,
  22603. 'media': media,
  22604. 'page': page,
  22605. 'supports': supports
  22606. };
  22607. var dir = {
  22608. parse: function() {
  22609. return this.createSingleNodeList(
  22610. this.Identifier()
  22611. );
  22612. }
  22613. };
  22614. var has$1 = {
  22615. parse: function() {
  22616. return this.createSingleNodeList(
  22617. this.SelectorList()
  22618. );
  22619. }
  22620. };
  22621. var lang = {
  22622. parse: function() {
  22623. return this.createSingleNodeList(
  22624. this.Identifier()
  22625. );
  22626. }
  22627. };
  22628. var selectorList = {
  22629. parse: function selectorList() {
  22630. return this.createSingleNodeList(
  22631. this.SelectorList()
  22632. );
  22633. }
  22634. };
  22635. var matches = selectorList;
  22636. var not = selectorList;
  22637. var ALLOW_OF_CLAUSE = true;
  22638. var nthWithOfClause = {
  22639. parse: function nthWithOfClause() {
  22640. return this.createSingleNodeList(
  22641. this.Nth(ALLOW_OF_CLAUSE)
  22642. );
  22643. }
  22644. };
  22645. var nthChild = nthWithOfClause;
  22646. var nthLastChild = nthWithOfClause;
  22647. var DISALLOW_OF_CLAUSE = false;
  22648. var nth$1 = {
  22649. parse: function nth() {
  22650. return this.createSingleNodeList(
  22651. this.Nth(DISALLOW_OF_CLAUSE)
  22652. );
  22653. }
  22654. };
  22655. var nthLastOfType = nth$1;
  22656. var nthOfType = nth$1;
  22657. var slotted = {
  22658. parse: function compoundSelector() {
  22659. return this.createSingleNodeList(
  22660. this.Selector()
  22661. );
  22662. }
  22663. };
  22664. var pseudo = {
  22665. 'dir': dir,
  22666. 'has': has$1,
  22667. 'lang': lang,
  22668. 'matches': matches,
  22669. 'not': not,
  22670. 'nth-child': nthChild,
  22671. 'nth-last-child': nthLastChild,
  22672. 'nth-last-of-type': nthLastOfType,
  22673. 'nth-of-type': nthOfType,
  22674. 'slotted': slotted
  22675. };
  22676. var parser = {
  22677. parseContext: {
  22678. default: 'StyleSheet',
  22679. stylesheet: 'StyleSheet',
  22680. atrule: 'Atrule',
  22681. atrulePrelude: function(options) {
  22682. return this.AtrulePrelude(options.atrule ? String(options.atrule) : null);
  22683. },
  22684. mediaQueryList: 'MediaQueryList',
  22685. mediaQuery: 'MediaQuery',
  22686. rule: 'Rule',
  22687. selectorList: 'SelectorList',
  22688. selector: 'Selector',
  22689. block: function() {
  22690. return this.Block(true);
  22691. },
  22692. declarationList: 'DeclarationList',
  22693. declaration: 'Declaration',
  22694. value: 'Value'
  22695. },
  22696. scope: scope,
  22697. atrule: atrule,
  22698. pseudo: pseudo,
  22699. node: node
  22700. };
  22701. var walker = {
  22702. node: node
  22703. };
  22704. function merge() {
  22705. var dest = {};
  22706. for (var i = 0; i < arguments.length; i++) {
  22707. var src = arguments[i];
  22708. for (var key in src) {
  22709. dest[key] = src[key];
  22710. }
  22711. }
  22712. return dest;
  22713. }
  22714. var syntax = create$5.create(
  22715. merge(
  22716. lexer,
  22717. parser,
  22718. walker
  22719. )
  22720. );
  22721. var lib = syntax;
  22722. class Sheet {
  22723. constructor(url, hooks) {
  22724. if (hooks) {
  22725. this.hooks = hooks;
  22726. } else {
  22727. this.hooks = {};
  22728. this.hooks.onUrl = new Hook(this);
  22729. this.hooks.onAtPage = new Hook(this);
  22730. this.hooks.onAtMedia = new Hook(this);
  22731. this.hooks.onRule = new Hook(this);
  22732. this.hooks.onDeclaration = new Hook(this);
  22733. this.hooks.onSelector = new Hook(this);
  22734. this.hooks.onPseudoSelector = new Hook(this);
  22735. this.hooks.onContent = new Hook(this);
  22736. this.hooks.onImport = new Hook(this);
  22737. this.hooks.beforeTreeParse = new Hook(this);
  22738. this.hooks.beforeTreeWalk = new Hook(this);
  22739. this.hooks.afterTreeWalk = new Hook(this);
  22740. }
  22741. try {
  22742. this.url = new URL(url, window.location.href);
  22743. } catch (e) {
  22744. this.url = new URL(window.location.href);
  22745. }
  22746. }
  22747. // parse
  22748. async parse(text) {
  22749. this.text = text;
  22750. await this.hooks.beforeTreeParse.trigger(this.text, this);
  22751. // send to csstree
  22752. this.ast = lib.parse(this._text);
  22753. await this.hooks.beforeTreeWalk.trigger(this.ast);
  22754. // Replace urls
  22755. this.replaceUrls(this.ast);
  22756. // Scope
  22757. this.id = UUID();
  22758. // this.addScope(this.ast, this.uuid);
  22759. // Replace IDs with data-id
  22760. this.replaceIds(this.ast);
  22761. this.imported = [];
  22762. // Trigger Hooks
  22763. this.urls(this.ast);
  22764. this.rules(this.ast);
  22765. this.atrules(this.ast);
  22766. await this.hooks.afterTreeWalk.trigger(this.ast, this);
  22767. // return ast
  22768. return this.ast;
  22769. }
  22770. insertRule(rule) {
  22771. let inserted = this.ast.children.appendData(rule);
  22772. inserted.forEach((item) => {
  22773. this.declarations(item);
  22774. });
  22775. }
  22776. urls(ast) {
  22777. lib.walk(ast, {
  22778. visit: "Url",
  22779. enter: (node, item, list) => {
  22780. this.hooks.onUrl.trigger(node, item, list);
  22781. }
  22782. });
  22783. }
  22784. atrules(ast) {
  22785. lib.walk(ast, {
  22786. visit: "Atrule",
  22787. enter: (node, item, list) => {
  22788. const basename = lib.keyword(node.name).basename;
  22789. if (basename === "page") {
  22790. this.hooks.onAtPage.trigger(node, item, list);
  22791. this.declarations(node, item, list);
  22792. }
  22793. if (basename === "media") {
  22794. this.hooks.onAtMedia.trigger(node, item, list);
  22795. this.declarations(node, item, list);
  22796. }
  22797. if (basename === "import") {
  22798. this.hooks.onImport.trigger(node, item, list);
  22799. this.imports(node, item, list);
  22800. }
  22801. }
  22802. });
  22803. }
  22804. rules(ast) {
  22805. lib.walk(ast, {
  22806. visit: "Rule",
  22807. enter: (ruleNode, ruleItem, rulelist) => {
  22808. // console.log("rule", ruleNode);
  22809. this.hooks.onRule.trigger(ruleNode, ruleItem, rulelist);
  22810. this.declarations(ruleNode, ruleItem, rulelist);
  22811. this.onSelector(ruleNode, ruleItem, rulelist);
  22812. }
  22813. });
  22814. }
  22815. declarations(ruleNode, ruleItem, rulelist) {
  22816. lib.walk(ruleNode, {
  22817. visit: "Declaration",
  22818. enter: (declarationNode, dItem, dList) => {
  22819. // console.log(declarationNode);
  22820. this.hooks.onDeclaration.trigger(declarationNode, dItem, dList, {ruleNode, ruleItem, rulelist});
  22821. if (declarationNode.property === "content") {
  22822. lib.walk(declarationNode, {
  22823. visit: "Function",
  22824. enter: (funcNode, fItem, fList) => {
  22825. this.hooks.onContent.trigger(funcNode, fItem, fList, {declarationNode, dItem, dList}, {ruleNode, ruleItem, rulelist});
  22826. }
  22827. });
  22828. }
  22829. }
  22830. });
  22831. }
  22832. // add pseudo elements to parser
  22833. onSelector(ruleNode, ruleItem, rulelist) {
  22834. lib.walk(ruleNode, {
  22835. visit: "Selector",
  22836. enter: (selectNode, selectItem, selectList) => {
  22837. // console.log(selectNode);
  22838. this.hooks.onSelector.trigger(selectNode, selectItem, selectList, {ruleNode, ruleItem, rulelist});
  22839. if (selectNode.children.forEach(node => {if (node.type === "PseudoElementSelector") {
  22840. lib.walk(node, {
  22841. visit: "PseudoElementSelector",
  22842. enter: (pseudoNode, pItem, pList) => {
  22843. this.hooks.onPseudoSelector.trigger(pseudoNode, pItem, pList, {selectNode, selectItem, selectList}, {ruleNode, ruleItem, rulelist});
  22844. }
  22845. });
  22846. }}));
  22847. // else {
  22848. // console.log("dommage");
  22849. // }
  22850. }
  22851. });
  22852. }
  22853. replaceUrls(ast) {
  22854. lib.walk(ast, {
  22855. visit: "Url",
  22856. enter: (node, item, list) => {
  22857. let content = node.value.value;
  22858. if ((node.value.type === "Raw" && content.startsWith("data:")) || (node.value.type === "String" && (content.startsWith("\"data:") || content.startsWith("'data:")))) ; else {
  22859. let href = content.replace(/["']/g, "");
  22860. let url = new URL(href, this.url);
  22861. node.value.value = url.toString();
  22862. }
  22863. }
  22864. });
  22865. }
  22866. addScope(ast, id) {
  22867. // Get all selector lists
  22868. // add an id
  22869. lib.walk(ast, {
  22870. visit: "Selector",
  22871. enter: (node, item, list) => {
  22872. let children = node.children;
  22873. children.prepend(children.createItem({
  22874. type: "WhiteSpace",
  22875. value: " "
  22876. }));
  22877. children.prepend(children.createItem({
  22878. type: "IdSelector",
  22879. name: id,
  22880. loc: null,
  22881. children: null
  22882. }));
  22883. }
  22884. });
  22885. }
  22886. getNamedPageSelectors(ast) {
  22887. let namedPageSelectors = {};
  22888. lib.walk(ast, {
  22889. visit: "Rule",
  22890. enter: (node, item, list) => {
  22891. lib.walk(node, {
  22892. visit: "Declaration",
  22893. enter: (declaration, dItem, dList) => {
  22894. if (declaration.property === "page") {
  22895. let value = declaration.value.children.first();
  22896. let name = value.name;
  22897. let selector = lib.generate(node.prelude);
  22898. namedPageSelectors[name] = {
  22899. name: name,
  22900. selector: selector
  22901. };
  22902. // dList.remove(dItem);
  22903. // Add in page break
  22904. declaration.property = "break-before";
  22905. value.type = "Identifier";
  22906. value.name = "always";
  22907. }
  22908. }
  22909. });
  22910. }
  22911. });
  22912. return namedPageSelectors;
  22913. }
  22914. replaceIds(ast) {
  22915. lib.walk(ast, {
  22916. visit: "Rule",
  22917. enter: (node, item, list) => {
  22918. lib.walk(node, {
  22919. visit: "IdSelector",
  22920. enter: (idNode, idItem, idList) => {
  22921. let name = idNode.name;
  22922. idNode.flags = null;
  22923. idNode.matcher = "=";
  22924. idNode.name = {type: "Identifier", loc: null, name: "data-id"};
  22925. idNode.type = "AttributeSelector";
  22926. idNode.value = {type: "String", loc: null, value: `"${name}"`};
  22927. }
  22928. });
  22929. }
  22930. });
  22931. }
  22932. imports(node, item, list) {
  22933. // console.log("import", node, item, list);
  22934. let queries = [];
  22935. lib.walk(node, {
  22936. visit: "MediaQuery",
  22937. enter: (mqNode, mqItem, mqList) => {
  22938. lib.walk(mqNode, {
  22939. visit: "Identifier",
  22940. enter: (identNode, identItem, identList) => {
  22941. queries.push(identNode.name);
  22942. }
  22943. });
  22944. }
  22945. });
  22946. // Just basic media query support for now
  22947. let shouldNotApply = queries.some((query, index) => {
  22948. let q = query;
  22949. if (q === "not") {
  22950. q = queries[index + 1];
  22951. return !(q === "screen" || q === "speech");
  22952. } else {
  22953. return (q === "screen" || q === "speech");
  22954. }
  22955. });
  22956. if (shouldNotApply) {
  22957. return;
  22958. }
  22959. lib.walk(node, {
  22960. visit: "String",
  22961. enter: (urlNode, urlItem, urlList) => {
  22962. let href = urlNode.value.replace(/["']/g, "");
  22963. let url = new URL(href, this.url);
  22964. let value = url.toString();
  22965. this.imported.push(value);
  22966. // Remove the original
  22967. list.remove(item);
  22968. }
  22969. });
  22970. }
  22971. set text(t) {
  22972. this._text = t;
  22973. }
  22974. get text() {
  22975. return this._text;
  22976. }
  22977. // generate string
  22978. toString(ast) {
  22979. return lib.generate(ast || this.ast);
  22980. }
  22981. }
  22982. var baseStyles = `
  22983. :root {
  22984. --pagedjs-width: 8.5in;
  22985. --pagedjs-height: 11in;
  22986. --pagedjs-width-right: 8.5in;
  22987. --pagedjs-height-right: 11in;
  22988. --pagedjs-width-left: 8.5in;
  22989. --pagedjs-height-left: 11in;
  22990. --pagedjs-pagebox-width: 8.5in;
  22991. --pagedjs-pagebox-height: 11in;
  22992. --pagedjs-margin-top: 1in;
  22993. --pagedjs-margin-right: 1in;
  22994. --pagedjs-margin-bottom: 1in;
  22995. --pagedjs-margin-left: 1in;
  22996. --pagedjs-padding-top: 0mm;
  22997. --pagedjs-padding-right: 0mm;
  22998. --pagedjs-padding-bottom: 0mm;
  22999. --pagedjs-padding-left: 0mm;
  23000. --pagedjs-bleed-top: 0mm;
  23001. --pagedjs-bleed-right: 0mm;
  23002. --pagedjs-bleed-bottom: 0mm;
  23003. --pagedjs-bleed-left: 0mm;
  23004. --pagedjs-bleed-right-top: 0mm;
  23005. --pagedjs-bleed-right-right: 0mm;
  23006. --pagedjs-bleed-right-bottom: 0mm;
  23007. --pagedjs-bleed-right-left: 0mm;
  23008. --pagedjs-bleed-left-top: 0mm;
  23009. --pagedjs-bleed-left-right: 0mm;
  23010. --pagedjs-bleed-left-bottom: 0mm;
  23011. --pagedjs-bleed-left-left: 0mm;
  23012. --pagedjs-crop-color: black;
  23013. --pagedjs-crop-offset: 2mm;
  23014. --pagedjs-crop-stroke: 1px;
  23015. --pagedjs-cross-size: 5mm;
  23016. --pagedjs-mark-cross-display: none;
  23017. --pagedjs-mark-crop-display: none;
  23018. --pagedjs-page-count: 0;
  23019. }
  23020. @page {
  23021. size: letter;
  23022. margin: 0;
  23023. }
  23024. .pagedjs_sheet {
  23025. box-sizing: border-box;
  23026. width: var(--pagedjs-width);
  23027. height: var(--pagedjs-height);
  23028. overflow: hidden;
  23029. position: relative;
  23030. display: grid;
  23031. 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);
  23032. 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);
  23033. }
  23034. .pagedjs_right_page .pagedjs_sheet {
  23035. width: var(--pagedjs-width-right);
  23036. height: var(--pagedjs-height-right);
  23037. 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);
  23038. 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);
  23039. }
  23040. .pagedjs_left_page .pagedjs_sheet {
  23041. width: var(--pagedjs-width-left);
  23042. height: var(--pagedjs-height-left);
  23043. 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);
  23044. 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);
  23045. }
  23046. .pagedjs_bleed {
  23047. display: flex;
  23048. align-items: center;
  23049. justify-content: center;
  23050. flex-wrap: nowrap;
  23051. overflow: hidden;
  23052. }
  23053. .pagedjs_bleed-top {
  23054. grid-column: bleed-left / -1;
  23055. grid-row: bleed-top;
  23056. flex-direction: row;
  23057. }
  23058. .pagedjs_bleed-bottom {
  23059. grid-column: bleed-left / -1;
  23060. grid-row: bleed-bottom;
  23061. flex-direction: row;
  23062. }
  23063. .pagedjs_bleed-left {
  23064. grid-column: bleed-left;
  23065. grid-row: bleed-top / -1;
  23066. flex-direction: column;
  23067. }
  23068. .pagedjs_bleed-right {
  23069. grid-column: bleed-right;
  23070. grid-row: bleed-top / -1;
  23071. flex-direction: column;
  23072. }
  23073. .pagedjs_marks-crop {
  23074. display: var(--pagedjs-mark-crop-display);
  23075. flex-grow: 0;
  23076. flex-shrink: 0;
  23077. }
  23078. .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
  23079. .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
  23080. width: calc(var(--pagedjs-bleed-left) - var(--pagedjs-crop-stroke));
  23081. border-right: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  23082. }
  23083. .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
  23084. .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
  23085. width: calc(var(--pagedjs-bleed-right-left) - var(--pagedjs-crop-stroke));
  23086. }
  23087. .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
  23088. .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
  23089. width: calc(var(--pagedjs-bleed-left-left) - var(--pagedjs-crop-stroke));
  23090. }
  23091. .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
  23092. .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
  23093. width: calc(var(--pagedjs-bleed-right) - var(--pagedjs-crop-stroke));
  23094. border-left: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  23095. }
  23096. .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
  23097. .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
  23098. width: calc(var(--pagedjs-bleed-right-right) - var(--pagedjs-crop-stroke));
  23099. }
  23100. .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
  23101. .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
  23102. width: calc(var(--pagedjs-bleed-left-right) - var(--pagedjs-crop-stroke));
  23103. }
  23104. .pagedjs_bleed-top .pagedjs_marks-crop {
  23105. align-self: flex-start;
  23106. height: calc(var(--pagedjs-bleed-top) - var(--pagedjs-crop-offset));
  23107. }
  23108. .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop {
  23109. height: calc(var(--pagedjs-bleed-right-top) - var(--pagedjs-crop-offset));
  23110. }
  23111. .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop {
  23112. height: calc(var(--pagedjs-bleed-left-top) - var(--pagedjs-crop-offset));
  23113. }
  23114. .pagedjs_bleed-bottom .pagedjs_marks-crop {
  23115. align-self: flex-end;
  23116. height: calc(var(--pagedjs-bleed-bottom) - var(--pagedjs-crop-offset));
  23117. }
  23118. .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop {
  23119. height: calc(var(--pagedjs-bleed-right-bottom) - var(--pagedjs-crop-offset));
  23120. }
  23121. .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop {
  23122. height: calc(var(--pagedjs-bleed-left-bottom) - var(--pagedjs-crop-offset));
  23123. }
  23124. .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
  23125. .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
  23126. height: calc(var(--pagedjs-bleed-top) - var(--pagedjs-crop-stroke));
  23127. border-bottom: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  23128. }
  23129. .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
  23130. .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
  23131. height: calc(var(--pagedjs-bleed-right-top) - var(--pagedjs-crop-stroke));
  23132. }
  23133. .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
  23134. .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
  23135. height: calc(var(--pagedjs-bleed-left-top) - var(--pagedjs-crop-stroke));
  23136. }
  23137. .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
  23138. .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
  23139. height: calc(var(--pagedjs-bleed-bottom) - var(--pagedjs-crop-stroke));
  23140. border-top: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  23141. }
  23142. .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
  23143. .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
  23144. height: calc(var(--pagedjs-bleed-right-bottom) - var(--pagedjs-crop-stroke));
  23145. }
  23146. .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
  23147. .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
  23148. height: calc(var(--pagedjs-bleed-left-bottom) - var(--pagedjs-crop-stroke));
  23149. }
  23150. .pagedjs_bleed-left .pagedjs_marks-crop {
  23151. width: calc(var(--pagedjs-bleed-left) - var(--pagedjs-crop-offset));
  23152. align-self: flex-start;
  23153. }
  23154. .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop {
  23155. width: calc(var(--pagedjs-bleed-right-left) - var(--pagedjs-crop-offset));
  23156. }
  23157. .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop {
  23158. width: calc(var(--pagedjs-bleed-left-left) - var(--pagedjs-crop-offset));
  23159. }
  23160. .pagedjs_bleed-right .pagedjs_marks-crop {
  23161. width: calc(var(--pagedjs-bleed-right) - var(--pagedjs-crop-offset));
  23162. align-self: flex-end;
  23163. }
  23164. .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop {
  23165. width: calc(var(--pagedjs-bleed-right-right) - var(--pagedjs-crop-offset));
  23166. }
  23167. .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop {
  23168. width: calc(var(--pagedjs-bleed-left-right) - var(--pagedjs-crop-offset));
  23169. }
  23170. .pagedjs_marks-middle {
  23171. display: flex;
  23172. flex-grow: 1;
  23173. flex-shrink: 0;
  23174. align-items: center;
  23175. justify-content: center;
  23176. }
  23177. .pagedjs_marks-cross {
  23178. display: var(--pagedjs-mark-cross-display);
  23179. background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIzMi41MzdweCIgaGVpZ2h0PSIzMi41MzdweCIgdmlld0JveD0iMC4xMDQgMC4xMDQgMzIuNTM3IDMyLjUzNyIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwLjEwNCAwLjEwNCAzMi41MzcgMzIuNTM3IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMy4zODkzIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGQ9Ik0yOS45MzEsMTYuMzczYzAsNy40ODktNi4wNjgsMTMuNTYtMTMuNTU4LDEzLjU2Yy03LjQ4MywwLTEzLjU1Ny02LjA3Mi0xMy41NTctMTMuNTZjMC03LjQ4Niw2LjA3NC0xMy41NTQsMTMuNTU3LTEzLjU1NEMyMy44NjIsMi44MTksMjkuOTMxLDguODg3LDI5LjkzMSwxNi4zNzN6Ii8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjMuMzg5MyIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMC4xMDQiIHkxPSIxNi4zNzMiIHgyPSIzMi42NDIiIHkyPSIxNi4zNzMiLz48bGluZSBmaWxsPSJub25lIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMy4zODkzIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHgxPSIxNi4zNzMiIHkxPSIwLjEwNCIgeDI9IjE2LjM3MyIgeTI9IjMyLjY0MiIvPjxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIzLjM4OTMiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgZD0iTTI0LjUwOCwxNi4zNzNjMCw0LjQ5Ni0zLjYzOCw4LjEzNS04LjEzNSw4LjEzNWMtNC40OTEsMC04LjEzNS0zLjYzOC04LjEzNS04LjEzNWMwLTQuNDg5LDMuNjQ0LTguMTM1LDguMTM1LTguMTM1QzIwLjg2OSw4LjIzOSwyNC41MDgsMTEuODg0LDI0LjUwOCwxNi4zNzN6Ii8+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMjkuOTMxLDE2LjM3M2MwLDcuNDg5LTYuMDY4LDEzLjU2LTEzLjU1OCwxMy41NmMtNy40ODMsMC0xMy41NTctNi4wNzItMTMuNTU3LTEzLjU2YzAtNy40ODYsNi4wNzQtMTMuNTU0LDEzLjU1Ny0xMy41NTRDMjMuODYyLDIuODE5LDI5LjkzMSw4Ljg4NywyOS45MzEsMTYuMzczeiIvPjxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIwLjY3NzgiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjAuMTA0IiB5MT0iMTYuMzczIiB4Mj0iMzIuNjQyIiB5Mj0iMTYuMzczIi8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMTYuMzczIiB5MT0iMC4xMDQiIHgyPSIxNi4zNzMiIHkyPSIzMi42NDIiLz48cGF0aCBkPSJNMjQuNTA4LDE2LjM3M2MwLDQuNDk2LTMuNjM4LDguMTM1LTguMTM1LDguMTM1Yy00LjQ5MSwwLTguMTM1LTMuNjM4LTguMTM1LTguMTM1YzAtNC40ODksMy42NDQtOC4xMzUsOC4xMzUtOC4xMzVDMjAuODY5LDguMjM5LDI0LjUwOCwxMS44ODQsMjQuNTA4LDE2LjM3MyIvPjxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIwLjY3NzgiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjguMjM5IiB5MT0iMTYuMzczIiB4Mj0iMjQuNTA4IiB5Mj0iMTYuMzczIi8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMTYuMzczIiB5MT0iOC4yMzkiIHgyPSIxNi4zNzMiIHkyPSIyNC41MDgiLz48L3N2Zz4=);
  23180. background-repeat: no-repeat;
  23181. background-position: 50% 50%;
  23182. background-size: var(--pagedjs-cross-size);
  23183. z-index: 2147483647;
  23184. width: var(--pagedjs-cross-size);
  23185. height: var(--pagedjs-cross-size);
  23186. }
  23187. .pagedjs_pagebox {
  23188. box-sizing: border-box;
  23189. width: var(--pagedjs-pagebox-width);
  23190. height: var(--pagedjs-pagebox-height);
  23191. position: relative;
  23192. display: grid;
  23193. 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);
  23194. 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);
  23195. grid-column: sheet-center;
  23196. grid-row: sheet-middle;
  23197. }
  23198. .pagedjs_pagebox * {
  23199. box-sizing: border-box;
  23200. }
  23201. .pagedjs_margin-top {
  23202. width: calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right));
  23203. height: var(--pagedjs-margin-top);
  23204. grid-column: center;
  23205. grid-row: header;
  23206. flex-wrap: nowrap;
  23207. display: grid;
  23208. grid-template-columns: repeat(3, 1fr);
  23209. grid-template-rows: 100%;
  23210. }
  23211. .pagedjs_margin-top-left-corner-holder {
  23212. width: var(--pagedjs-margin-left);
  23213. height: var(--pagedjs-margin-top);
  23214. display: flex;
  23215. grid-column: left;
  23216. grid-row: header;
  23217. }
  23218. .pagedjs_margin-top-right-corner-holder {
  23219. width: var(--pagedjs-margin-right);
  23220. height: var(--pagedjs-margin-top);
  23221. display: flex;
  23222. grid-column: right;
  23223. grid-row: header;
  23224. }
  23225. .pagedjs_margin-top-left-corner {
  23226. width: var(--pagedjs-margin-left);
  23227. }
  23228. .pagedjs_margin-top-right-corner {
  23229. width: var(--pagedjs-margin-right);
  23230. }
  23231. .pagedjs_margin-right {
  23232. height: calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom));
  23233. width: var(--pagedjs-margin-right);
  23234. right: 0;
  23235. grid-column: right;
  23236. grid-row: page;
  23237. display: grid;
  23238. grid-template-rows: repeat(3, 33.3333%);
  23239. grid-template-columns: 100%;
  23240. }
  23241. .pagedjs_margin-bottom {
  23242. width: calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right));
  23243. height: var(--pagedjs-margin-bottom);
  23244. grid-column: center;
  23245. grid-row: footer;
  23246. display: grid;
  23247. grid-template-columns: repeat(3, 1fr);
  23248. grid-template-rows: 100%;
  23249. }
  23250. .pagedjs_margin-bottom-left-corner-holder {
  23251. width: var(--pagedjs-margin-left);
  23252. height: var(--pagedjs-margin-bottom);
  23253. display: flex;
  23254. grid-column: left;
  23255. grid-row: footer;
  23256. }
  23257. .pagedjs_margin-bottom-right-corner-holder {
  23258. width: var(--pagedjs-margin-right);
  23259. height: var(--pagedjs-margin-bottom);
  23260. display: flex;
  23261. grid-column: right;
  23262. grid-row: footer;
  23263. }
  23264. .pagedjs_margin-bottom-left-corner {
  23265. width: var(--pagedjs-margin-left);
  23266. }
  23267. .pagedjs_margin-bottom-right-corner {
  23268. width: var(--pagedjs-margin-right);
  23269. }
  23270. .pagedjs_margin-left {
  23271. height: calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom));
  23272. width: var(--pagedjs-margin-left);
  23273. grid-column: left;
  23274. grid-row: page;
  23275. display: grid;
  23276. grid-template-rows: repeat(3, 33.33333%);
  23277. grid-template-columns: 100%;
  23278. }
  23279. .pagedjs_pages .pagedjs_pagebox .pagedjs_margin:not(.hasContent) {
  23280. visibility: hidden;
  23281. }
  23282. .pagedjs_pagebox > .pagedjs_area {
  23283. grid-column: center;
  23284. grid-row: page;
  23285. width: 100%;
  23286. height: 100%;
  23287. padding: var(--pagedjs-padding-top) var(--pagedjs-padding-right) var(--pagedjs-padding-bottom) var(--pagedjs-padding-left)
  23288. }
  23289. .pagedjs_pagebox > .pagedjs_area > .pagedjs_page_content {
  23290. width: 100%;
  23291. height: 100%;
  23292. position: relative;
  23293. column-fill: auto;
  23294. }
  23295. .pagedjs_page {
  23296. counter-increment: page;
  23297. width: var(--pagedjs-width);
  23298. height: var(--pagedjs-height);
  23299. }
  23300. .pagedjs_page.pagedjs_right_page {
  23301. counter-increment: page;
  23302. width: var(--pagedjs-width-right);
  23303. height: var(--pagedjs-height-right);
  23304. }
  23305. .pagedjs_page.pagedjs_left_page {
  23306. counter-increment: page;
  23307. width: var(--pagedjs-width-left);
  23308. height: var(--pagedjs-height-left);
  23309. }
  23310. .pagedjs_pages {
  23311. counter-reset: pages var(--pagedjs-page-count);
  23312. }
  23313. .pagedjs_pagebox .pagedjs_margin-top-left-corner,
  23314. .pagedjs_pagebox .pagedjs_margin-top-right-corner,
  23315. .pagedjs_pagebox .pagedjs_margin-bottom-left-corner,
  23316. .pagedjs_pagebox .pagedjs_margin-bottom-right-corner,
  23317. .pagedjs_pagebox .pagedjs_margin-top-left,
  23318. .pagedjs_pagebox .pagedjs_margin-top-right,
  23319. .pagedjs_pagebox .pagedjs_margin-bottom-left,
  23320. .pagedjs_pagebox .pagedjs_margin-bottom-right,
  23321. .pagedjs_pagebox .pagedjs_margin-top-center,
  23322. .pagedjs_pagebox .pagedjs_margin-bottom-center,
  23323. .pagedjs_pagebox .pagedjs_margin-top-center,
  23324. .pagedjs_pagebox .pagedjs_margin-bottom-center,
  23325. .pagedjs_margin-right-middle,
  23326. .pagedjs_margin-left-middle {
  23327. display: flex;
  23328. align-items: center;
  23329. }
  23330. .pagedjs_margin-right-top,
  23331. .pagedjs_margin-left-top {
  23332. display: flex;
  23333. align-items: flex-top;
  23334. }
  23335. .pagedjs_margin-right-bottom,
  23336. .pagedjs_margin-left-bottom {
  23337. display: flex;
  23338. align-items: flex-end;
  23339. }
  23340. /*
  23341. .pagedjs_pagebox .pagedjs_margin-top-center,
  23342. .pagedjs_pagebox .pagedjs_margin-bottom-center {
  23343. height: 100%;
  23344. display: none;
  23345. align-items: center;
  23346. flex: 1 0 33%;
  23347. margin: 0 auto;
  23348. }
  23349. .pagedjs_pagebox .pagedjs_margin-top-left-corner,
  23350. .pagedjs_pagebox .pagedjs_margin-top-right-corner,
  23351. .pagedjs_pagebox .pagedjs_margin-bottom-right-corner,
  23352. .pagedjs_pagebox .pagedjs_margin-bottom-left-corner {
  23353. display: none;
  23354. align-items: center;
  23355. }
  23356. .pagedjs_pagebox .pagedjs_margin-left-top,
  23357. .pagedjs_pagebox .pagedjs_margin-right-top {
  23358. display: none;
  23359. align-items: flex-start;
  23360. }
  23361. .pagedjs_pagebox .pagedjs_margin-right-middle,
  23362. .pagedjs_pagebox .pagedjs_margin-left-middle {
  23363. display: none;
  23364. align-items: center;
  23365. }
  23366. .pagedjs_pagebox .pagedjs_margin-left-bottom,
  23367. .pagedjs_pagebox .pagedjs_margin-right-bottom {
  23368. display: none;
  23369. align-items: flex-end;
  23370. }
  23371. */
  23372. .pagedjs_pagebox .pagedjs_margin-top-left,
  23373. .pagedjs_pagebox .pagedjs_margin-top-right-corner,
  23374. .pagedjs_pagebox .pagedjs_margin-bottom-left,
  23375. .pagedjs_pagebox .pagedjs_margin-bottom-right-corner { text-align: left; }
  23376. .pagedjs_pagebox .pagedjs_margin-top-left-corner,
  23377. .pagedjs_pagebox .pagedjs_margin-top-right,
  23378. .pagedjs_pagebox .pagedjs_margin-bottom-left-corner,
  23379. .pagedjs_pagebox .pagedjs_margin-bottom-right { text-align: right; }
  23380. .pagedjs_pagebox .pagedjs_margin-top-center,
  23381. .pagedjs_pagebox .pagedjs_margin-bottom-center,
  23382. .pagedjs_pagebox .pagedjs_margin-left-top,
  23383. .pagedjs_pagebox .pagedjs_margin-left-middle,
  23384. .pagedjs_pagebox .pagedjs_margin-left-bottom,
  23385. .pagedjs_pagebox .pagedjs_margin-right-top,
  23386. .pagedjs_pagebox .pagedjs_margin-right-middle,
  23387. .pagedjs_pagebox .pagedjs_margin-right-bottom { text-align: center; }
  23388. .pagedjs_pages .pagedjs_margin .pagedjs_margin-content {
  23389. width: 100%;
  23390. }
  23391. .pagedjs_pages .pagedjs_margin-left .pagedjs_margin-content::after,
  23392. .pagedjs_pages .pagedjs_margin-top .pagedjs_margin-content::after,
  23393. .pagedjs_pages .pagedjs_margin-right .pagedjs_margin-content::after,
  23394. .pagedjs_pages .pagedjs_margin-bottom .pagedjs_margin-content::after {
  23395. display: block;
  23396. }
  23397. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to] {
  23398. margin-bottom: unset;
  23399. padding-bottom: unset;
  23400. }
  23401. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from] {
  23402. text-indent: unset;
  23403. margin-top: unset;
  23404. padding-top: unset;
  23405. initial-letter: unset;
  23406. }
  23407. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from] > *::first-letter,
  23408. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]::first-letter {
  23409. color: unset;
  23410. font-size: unset;
  23411. font-weight: unset;
  23412. font-family: unset;
  23413. color: unset;
  23414. line-height: unset;
  23415. float: unset;
  23416. padding: unset;
  23417. margin: unset;
  23418. }
  23419. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]:after,
  23420. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]::after {
  23421. content: unset;
  23422. }
  23423. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]:before,
  23424. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]::before {
  23425. content: unset;
  23426. }
  23427. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div li[data-split-from]:first-of-type {
  23428. list-style: none;
  23429. }
  23430. /*
  23431. [data-page]:not([data-split-from]),
  23432. [data-break-before="page"]:not([data-split-from]),
  23433. [data-break-before="always"]:not([data-split-from]),
  23434. [data-break-before="left"]:not([data-split-from]),
  23435. [data-break-before="right"]:not([data-split-from]),
  23436. [data-break-before="recto"]:not([data-split-from]),
  23437. [data-break-before="verso"]:not([data-split-from])
  23438. {
  23439. break-before: column;
  23440. }
  23441. [data-page]:not([data-split-to]),
  23442. [data-break-after="page"]:not([data-split-to]),
  23443. [data-break-after="always"]:not([data-split-to]),
  23444. [data-break-after="left"]:not([data-split-to]),
  23445. [data-break-after="right"]:not([data-split-to]),
  23446. [data-break-after="recto"]:not([data-split-to]),
  23447. [data-break-after="verso"]:not([data-split-to])
  23448. {
  23449. break-after: column;
  23450. }
  23451. */
  23452. .pagedjs_clear-after::after {
  23453. content: none !important;
  23454. }
  23455. img {
  23456. height: auto;
  23457. }
  23458. [data-align-last-split-element='justify'] {
  23459. text-align-last: justify;
  23460. }
  23461. @media print {
  23462. html {
  23463. width: 100%;
  23464. height: 100%;
  23465. }
  23466. body {
  23467. margin: 0;
  23468. padding: 0;
  23469. width: 100% !important;
  23470. height: 100% !important;
  23471. min-width: 100%;
  23472. max-width: 100%;
  23473. min-height: 100%;
  23474. max-height: 100%;
  23475. }
  23476. .pagedjs_pages {
  23477. width: auto;
  23478. display: block !important;
  23479. transform: none !important;
  23480. height: 100% !important;
  23481. min-height: 100%;
  23482. max-height: 100%;
  23483. overflow: visible;
  23484. }
  23485. .pagedjs_page {
  23486. margin: 0;
  23487. padding: 0;
  23488. max-height: 100%;
  23489. min-height: 100%;
  23490. height: 100% !important;
  23491. page-break-after: always;
  23492. break-after: page;
  23493. }
  23494. .pagedjs_sheet {
  23495. margin: 0;
  23496. padding: 0;
  23497. max-height: 100%;
  23498. min-height: 100%;
  23499. height: 100% !important;
  23500. }
  23501. }
  23502. `;
  23503. async function request(url, options={}) {
  23504. return new Promise(function(resolve, reject) {
  23505. let request = new XMLHttpRequest();
  23506. request.open(options.method || "get", url, true);
  23507. for (let i in options.headers) {
  23508. request.setRequestHeader(i, options.headers[i]);
  23509. }
  23510. request.withCredentials = options.credentials === "include";
  23511. request.onload = () => {
  23512. // Chrome returns a status code of 0 for local files
  23513. const status = request.status === 0 && url.startsWith("file://") ? 200 : request.status;
  23514. resolve(new Response(request.responseText, {status}));
  23515. };
  23516. request.onerror = reject;
  23517. request.send(options.body || null);
  23518. });
  23519. }
  23520. class Polisher {
  23521. constructor(setup) {
  23522. this.sheets = [];
  23523. this.inserted = [];
  23524. this.hooks = {};
  23525. this.hooks.onUrl = new Hook(this);
  23526. this.hooks.onAtPage = new Hook(this);
  23527. this.hooks.onAtMedia = new Hook(this);
  23528. this.hooks.onRule = new Hook(this);
  23529. this.hooks.onDeclaration = new Hook(this);
  23530. this.hooks.onContent = new Hook(this);
  23531. this.hooks.onSelector = new Hook(this);
  23532. this.hooks.onPseudoSelector = new Hook(this);
  23533. this.hooks.onImport = new Hook(this);
  23534. this.hooks.beforeTreeParse = new Hook(this);
  23535. this.hooks.beforeTreeWalk = new Hook(this);
  23536. this.hooks.afterTreeWalk = new Hook(this);
  23537. if (setup !== false) {
  23538. this.setup();
  23539. }
  23540. }
  23541. setup() {
  23542. this.base = this.insert(baseStyles);
  23543. this.styleEl = document.createElement("style");
  23544. document.head.appendChild(this.styleEl);
  23545. this.styleSheet = this.styleEl.sheet;
  23546. return this.styleSheet;
  23547. }
  23548. async add() {
  23549. let fetched = [];
  23550. let urls = [];
  23551. for (var i = 0; i < arguments.length; i++) {
  23552. let f;
  23553. if (typeof arguments[i] === "object") {
  23554. for (let url in arguments[i]) {
  23555. let obj = arguments[i];
  23556. f = new Promise(function(resolve, reject) {
  23557. urls.push(url);
  23558. resolve(obj[url]);
  23559. });
  23560. }
  23561. } else {
  23562. urls.push(arguments[i]);
  23563. f = request(arguments[i]).then((response) => {
  23564. return response.text();
  23565. });
  23566. }
  23567. fetched.push(f);
  23568. }
  23569. return await Promise.all(fetched)
  23570. .then(async (originals) => {
  23571. let text = "";
  23572. for (let index = 0; index < originals.length; index++) {
  23573. text = await this.convertViaSheet(originals[index], urls[index]);
  23574. this.insert(text);
  23575. }
  23576. return text;
  23577. });
  23578. }
  23579. async convertViaSheet(cssStr, href) {
  23580. let sheet = new Sheet(href, this.hooks);
  23581. await sheet.parse(cssStr);
  23582. // Insert the imported sheets first
  23583. for (let url of sheet.imported) {
  23584. let str = await request(url).then((response) => {
  23585. return response.text();
  23586. });
  23587. let text = await this.convertViaSheet(str, url);
  23588. this.insert(text);
  23589. }
  23590. this.sheets.push(sheet);
  23591. if (typeof sheet.width !== "undefined") {
  23592. this.width = sheet.width;
  23593. }
  23594. if (typeof sheet.height !== "undefined") {
  23595. this.height = sheet.height;
  23596. }
  23597. if (typeof sheet.orientation !== "undefined") {
  23598. this.orientation = sheet.orientation;
  23599. }
  23600. return sheet.toString();
  23601. }
  23602. insert(text){
  23603. let head = document.querySelector("head");
  23604. let style = document.createElement("style");
  23605. style.type = "text/css";
  23606. style.setAttribute("data-pagedjs-inserted-styles", "true");
  23607. style.appendChild(document.createTextNode(text));
  23608. head.appendChild(style);
  23609. this.inserted.push(style);
  23610. return style;
  23611. }
  23612. destroy() {
  23613. this.styleEl.remove();
  23614. this.inserted.forEach((s) => {
  23615. s.remove();
  23616. });
  23617. this.sheets = [];
  23618. }
  23619. }
  23620. class Handler {
  23621. constructor(chunker, polisher, caller) {
  23622. let hooks = Object.assign({}, chunker && chunker.hooks, polisher && polisher.hooks, caller && caller.hooks);
  23623. this.chunker = chunker;
  23624. this.polisher = polisher;
  23625. this.caller = caller;
  23626. for (let name in hooks) {
  23627. if (name in this) {
  23628. let hook = hooks[name];
  23629. hook.register(this[name].bind(this));
  23630. }
  23631. }
  23632. }
  23633. }
  23634. eventEmitter(Handler.prototype);
  23635. // https://www.w3.org/TR/css3-page/#page-size-prop
  23636. var pageSizes = {
  23637. "A0": {
  23638. width: {
  23639. value: 841,
  23640. unit: "mm"
  23641. },
  23642. height: {
  23643. value: 1189,
  23644. unit: "mm"
  23645. }
  23646. },
  23647. "A1": {
  23648. width: {
  23649. value: 594,
  23650. unit: "mm"
  23651. },
  23652. height: {
  23653. value: 841,
  23654. unit: "mm"
  23655. }
  23656. },
  23657. "A2": {
  23658. width: {
  23659. value: 420,
  23660. unit: "mm"
  23661. },
  23662. height: {
  23663. value: 594,
  23664. unit: "mm"
  23665. }
  23666. },
  23667. "A3": {
  23668. width: {
  23669. value: 297,
  23670. unit: "mm"
  23671. },
  23672. height: {
  23673. value: 420,
  23674. unit: "mm"
  23675. }
  23676. },
  23677. "A4": {
  23678. width: {
  23679. value: 210,
  23680. unit: "mm"
  23681. },
  23682. height: {
  23683. value: 297,
  23684. unit: "mm"
  23685. }
  23686. },
  23687. "A5": {
  23688. width: {
  23689. value: 148,
  23690. unit: "mm"
  23691. },
  23692. height: {
  23693. value: 210,
  23694. unit: "mm"
  23695. }
  23696. },
  23697. "A6": {
  23698. width: {
  23699. value: 105,
  23700. unit: "mm"
  23701. },
  23702. height: {
  23703. value: 148,
  23704. unit: "mm"
  23705. }
  23706. },
  23707. "A7": {
  23708. width: {
  23709. value: 74,
  23710. unit: "mm"
  23711. },
  23712. height: {
  23713. value: 105,
  23714. unit: "mm"
  23715. }
  23716. },
  23717. "A8": {
  23718. width: {
  23719. value: 52,
  23720. unit: "mm"
  23721. },
  23722. height: {
  23723. value: 74,
  23724. unit: "mm"
  23725. }
  23726. },
  23727. "A9": {
  23728. width: {
  23729. value: 37,
  23730. unit: "mm"
  23731. },
  23732. height: {
  23733. value: 52,
  23734. unit: "mm"
  23735. }
  23736. },
  23737. "A10": {
  23738. width: {
  23739. value: 26,
  23740. unit: "mm"
  23741. },
  23742. height: {
  23743. value: 37,
  23744. unit: "mm"
  23745. }
  23746. },
  23747. "B4": {
  23748. width: {
  23749. value: 250,
  23750. unit: "mm"
  23751. },
  23752. height: {
  23753. value: 353,
  23754. unit: "mm"
  23755. }
  23756. },
  23757. "B5": {
  23758. width: {
  23759. value: 176,
  23760. unit: "mm"
  23761. },
  23762. height: {
  23763. value: 250,
  23764. unit: "mm"
  23765. }
  23766. },
  23767. "letter": {
  23768. width: {
  23769. value: 8.5,
  23770. unit: "in"
  23771. },
  23772. height: {
  23773. value: 11,
  23774. unit: "in"
  23775. }
  23776. },
  23777. "legal": {
  23778. width: {
  23779. value: 8.5,
  23780. unit: "in"
  23781. },
  23782. height: {
  23783. value: 14,
  23784. unit: "in"
  23785. }
  23786. },
  23787. "ledger": {
  23788. width: {
  23789. value: 11,
  23790. unit: "in"
  23791. },
  23792. height: {
  23793. value: 17,
  23794. unit: "in"
  23795. }
  23796. }
  23797. };
  23798. class AtPage extends Handler {
  23799. constructor(chunker, polisher, caller) {
  23800. super(chunker, polisher, caller);
  23801. this.pages = {};
  23802. this.width = undefined;
  23803. this.height = undefined;
  23804. this.orientation = undefined;
  23805. this.marginalia = {};
  23806. }
  23807. pageModel(selector) {
  23808. return {
  23809. selector: selector,
  23810. name: undefined,
  23811. psuedo: undefined,
  23812. nth: undefined,
  23813. marginalia: {},
  23814. width: undefined,
  23815. height: undefined,
  23816. orientation: undefined,
  23817. margin : {
  23818. top: {},
  23819. right: {},
  23820. left: {},
  23821. bottom: {}
  23822. },
  23823. padding : {
  23824. top: {},
  23825. right: {},
  23826. left: {},
  23827. bottom: {}
  23828. },
  23829. block: {},
  23830. marks: undefined
  23831. };
  23832. }
  23833. // Find and Remove @page rules
  23834. onAtPage(node, item, list) {
  23835. let page, marginalia;
  23836. let selector = "";
  23837. let named, psuedo, nth;
  23838. let needsMerge = false;
  23839. if (node.prelude) {
  23840. named = this.getTypeSelector(node);
  23841. psuedo = this.getPsuedoSelector(node);
  23842. nth = this.getNthSelector(node);
  23843. selector = lib.generate(node.prelude);
  23844. } else {
  23845. selector = "*";
  23846. }
  23847. if (selector in this.pages) {
  23848. // this.pages[selector] = Object.assign(this.pages[selector], page);
  23849. // console.log("after", selector, this.pages[selector]);
  23850. // this.pages[selector].added = false;
  23851. page = this.pages[selector];
  23852. marginalia = this.replaceMarginalia(node);
  23853. needsMerge = true;
  23854. } else {
  23855. page = this.pageModel(selector);
  23856. marginalia = this.replaceMarginalia(node);
  23857. this.pages[selector] = page;
  23858. }
  23859. page.name = named;
  23860. page.psuedo = psuedo;
  23861. page.nth = nth;
  23862. if (needsMerge) {
  23863. page.marginalia = Object.assign(page.marginalia, marginalia);
  23864. } else {
  23865. page.marginalia = marginalia;
  23866. }
  23867. let declarations = this.replaceDeclartations(node);
  23868. if (declarations.size) {
  23869. page.size = declarations.size;
  23870. page.width = declarations.size.width;
  23871. page.height = declarations.size.height;
  23872. page.orientation = declarations.size.orientation;
  23873. page.format = declarations.size.format;
  23874. }
  23875. if (declarations.bleed && declarations.bleed[0] != "auto") {
  23876. switch (declarations.bleed.length) {
  23877. case 4: // top right bottom left
  23878. page.bleed = {
  23879. top: declarations.bleed[0],
  23880. right: declarations.bleed[1],
  23881. bottom: declarations.bleed[2],
  23882. left: declarations.bleed[3]
  23883. };
  23884. break;
  23885. case 3: // top right bottom right
  23886. page.bleed = {
  23887. top: declarations.bleed[0],
  23888. right: declarations.bleed[1],
  23889. bottom: declarations.bleed[2],
  23890. left: declarations.bleed[1]
  23891. };
  23892. break;
  23893. case 2: // top right top right
  23894. page.bleed = {
  23895. top: declarations.bleed[0],
  23896. right: declarations.bleed[1],
  23897. bottom: declarations.bleed[0],
  23898. left: declarations.bleed[1]
  23899. };
  23900. break;
  23901. default:
  23902. page.bleed = {
  23903. top: declarations.bleed[0],
  23904. right: declarations.bleed[0],
  23905. bottom: declarations.bleed[0],
  23906. left: declarations.bleed[0]
  23907. };
  23908. }
  23909. }
  23910. if (declarations.marks) {
  23911. if (!declarations.bleed || declarations.bleed && declarations.bleed[0] === "auto") {
  23912. // Spec say 6pt, but needs more space for marks
  23913. page.bleed = {
  23914. top: { value: 6, unit: "mm" },
  23915. right: { value: 6, unit: "mm" },
  23916. bottom: { value: 6, unit: "mm" },
  23917. left: { value: 6, unit: "mm" }
  23918. };
  23919. }
  23920. page.marks = declarations.marks;
  23921. }
  23922. if (declarations.margin) {
  23923. page.margin = declarations.margin;
  23924. }
  23925. if (declarations.padding) {
  23926. page.padding = declarations.padding;
  23927. }
  23928. if (declarations.marks) {
  23929. page.marks = declarations.marks;
  23930. }
  23931. if (needsMerge) {
  23932. page.block.children.appendList(node.block.children);
  23933. } else {
  23934. page.block = node.block;
  23935. }
  23936. // Remove the rule
  23937. list.remove(item);
  23938. }
  23939. /* Handled in breaks */
  23940. /*
  23941. afterParsed(parsed) {
  23942. for (let b in this.named) {
  23943. // Find elements
  23944. let elements = parsed.querySelectorAll(b);
  23945. // Add break data
  23946. for (var i = 0; i < elements.length; i++) {
  23947. elements[i].setAttribute("data-page", this.named[b]);
  23948. }
  23949. }
  23950. }
  23951. */
  23952. afterTreeWalk(ast, sheet) {
  23953. this.addPageClasses(this.pages, ast, sheet);
  23954. if ("*" in this.pages) {
  23955. let width = this.pages["*"].width;
  23956. let height = this.pages["*"].height;
  23957. let format = this.pages["*"].format;
  23958. let orientation = this.pages["*"].orientation;
  23959. let bleed = this.pages["*"].bleed;
  23960. let marks = this.pages["*"].marks;
  23961. let bleedverso = undefined;
  23962. let bleedrecto = undefined;
  23963. if (":left" in this.pages) {
  23964. bleedverso = this.pages[":left"].bleed;
  23965. }
  23966. if (":right" in this.pages) {
  23967. bleedrecto = this.pages[":right"].bleed;
  23968. }
  23969. if ((width && height) &&
  23970. (this.width !== width || this.height !== height)) {
  23971. this.width = width;
  23972. this.height = height;
  23973. this.format = format;
  23974. this.orientation = orientation;
  23975. this.addRootVars(ast, width, height, orientation, bleed, bleedrecto, bleedverso, marks);
  23976. this.addRootPage(ast, this.pages["*"].size, bleed, bleedrecto, bleedverso);
  23977. this.emit("size", { width, height, orientation, format, bleed });
  23978. this.emit("atpages", this.pages);
  23979. }
  23980. }
  23981. }
  23982. getTypeSelector(ast) {
  23983. // Find page name
  23984. let name;
  23985. lib.walk(ast, {
  23986. visit: "TypeSelector",
  23987. enter: (node, item, list) => {
  23988. name = node.name;
  23989. }
  23990. });
  23991. return name;
  23992. }
  23993. getPsuedoSelector(ast) {
  23994. // Find if it has :left & :right & :black & :first
  23995. let name;
  23996. lib.walk(ast, {
  23997. visit: "PseudoClassSelector",
  23998. enter: (node, item, list) => {
  23999. if (node.name !== "nth") {
  24000. name = node.name;
  24001. }
  24002. }
  24003. });
  24004. return name;
  24005. }
  24006. getNthSelector(ast) {
  24007. // Find if it has :nth
  24008. let nth;
  24009. lib.walk(ast, {
  24010. visit: "PseudoClassSelector",
  24011. enter: (node, item, list) => {
  24012. if (node.name === "nth" && node.children) {
  24013. let raw = node.children.first();
  24014. nth = raw.value;
  24015. }
  24016. }
  24017. });
  24018. return nth;
  24019. }
  24020. replaceMarginalia(ast) {
  24021. let parsed = {};
  24022. lib.walk(ast.block, {
  24023. visit: "Atrule",
  24024. enter: (node, item, list) => {
  24025. let name = node.name;
  24026. if (name === "top") {
  24027. name = "top-center";
  24028. }
  24029. if (name === "right") {
  24030. name = "right-middle";
  24031. }
  24032. if (name === "left") {
  24033. name = "left-middle";
  24034. }
  24035. if (name === "bottom") {
  24036. name = "bottom-center";
  24037. }
  24038. parsed[name] = node.block;
  24039. list.remove(item);
  24040. }
  24041. });
  24042. return parsed;
  24043. }
  24044. replaceDeclartations(ast) {
  24045. let parsed = {};
  24046. lib.walk(ast.block, {
  24047. visit: "Declaration",
  24048. enter: (declaration, dItem, dList) => {
  24049. let prop = lib.property(declaration.property).name;
  24050. // let value = declaration.value;
  24051. if (prop === "marks") {
  24052. parsed.marks = [];
  24053. lib.walk(declaration, {
  24054. visit: "Identifier",
  24055. enter: (ident) => {
  24056. parsed.marks.push(ident.name);
  24057. }
  24058. });
  24059. dList.remove(dItem);
  24060. } else if (prop === "margin") {
  24061. parsed.margin = this.getMargins(declaration);
  24062. dList.remove(dItem);
  24063. } else if (prop.indexOf("margin-") === 0) {
  24064. let m = prop.substring("margin-".length);
  24065. if (!parsed.margin) {
  24066. parsed.margin = {
  24067. top: {},
  24068. right: {},
  24069. left: {},
  24070. bottom: {}
  24071. };
  24072. }
  24073. parsed.margin[m] = declaration.value.children.first();
  24074. dList.remove(dItem);
  24075. } else if (prop === "padding"){
  24076. parsed.padding = this.getPaddings(declaration.value);
  24077. dList.remove(dItem);
  24078. } else if (prop.indexOf("padding-") === 0) {
  24079. let p = prop.substring("padding-".length);
  24080. if (!parsed.padding) {
  24081. parsed.padding = {
  24082. top: {},
  24083. right: {},
  24084. left: {},
  24085. bottom: {}
  24086. };
  24087. }
  24088. parsed.padding[p] = declaration.value.children.first();
  24089. dList.remove(dItem);
  24090. } else if (prop === "size") {
  24091. parsed.size = this.getSize(declaration);
  24092. dList.remove(dItem);
  24093. } else if (prop === "bleed") {
  24094. parsed.bleed = [];
  24095. lib.walk(declaration, {
  24096. enter: (subNode) => {
  24097. switch (subNode.type) {
  24098. case "String": // bleed: "auto"
  24099. if (subNode.value.indexOf("auto") > -1) {
  24100. parsed.bleed.push("auto");
  24101. }
  24102. break;
  24103. case "Dimension": // bleed: 1in 2in, bleed: 20px ect.
  24104. parsed.bleed.push({
  24105. value: subNode.value,
  24106. unit: subNode.unit
  24107. });
  24108. break;
  24109. case "Number":
  24110. parsed.bleed.push({
  24111. value: subNode.value,
  24112. unit: "px"
  24113. });
  24114. break;
  24115. // ignore
  24116. }
  24117. }
  24118. });
  24119. dList.remove(dItem);
  24120. }
  24121. }
  24122. });
  24123. return parsed;
  24124. }
  24125. getSize(declaration) {
  24126. let width, height, orientation, format;
  24127. // Get size: Xmm Ymm
  24128. lib.walk(declaration, {
  24129. visit: "Dimension",
  24130. enter: (node, item, list) => {
  24131. let {value, unit} = node;
  24132. if (typeof width === "undefined") {
  24133. width = { value, unit };
  24134. } else if (typeof height === "undefined") {
  24135. height = { value, unit };
  24136. }
  24137. }
  24138. });
  24139. // Get size: "A4"
  24140. lib.walk(declaration, {
  24141. visit: "String",
  24142. enter: (node, item, list) => {
  24143. let name = node.value.replace(/["|']/g, "");
  24144. let s = pageSizes[name];
  24145. if (s) {
  24146. width = s.width;
  24147. height = s.height;
  24148. }
  24149. }
  24150. });
  24151. // Get Format or Landscape or Portrait
  24152. lib.walk(declaration, {
  24153. visit: "Identifier",
  24154. enter: (node, item, list) => {
  24155. let name = node.name;
  24156. if (name === "landscape" || name === "portrait") {
  24157. orientation = node.name;
  24158. } else if (name !== "auto") {
  24159. let s = pageSizes[name];
  24160. if (s) {
  24161. width = s.width;
  24162. height = s.height;
  24163. }
  24164. format = name;
  24165. }
  24166. }
  24167. });
  24168. return {
  24169. width,
  24170. height,
  24171. orientation,
  24172. format
  24173. };
  24174. }
  24175. getMargins(declaration) {
  24176. let margins = [];
  24177. let margin = {
  24178. top: {},
  24179. right: {},
  24180. left: {},
  24181. bottom: {}
  24182. };
  24183. lib.walk(declaration, {
  24184. visit: "Dimension",
  24185. enter: (node, item, list) => {
  24186. margins.push(node);
  24187. }
  24188. });
  24189. if (margins.length === 1) {
  24190. for (let m in margin) {
  24191. margin[m] = margins[0];
  24192. }
  24193. } else if (margins.length === 2) {
  24194. margin.top = margins[0];
  24195. margin.right = margins[1];
  24196. margin.bottom = margins[0];
  24197. margin.left = margins[1];
  24198. } else if (margins.length === 3) {
  24199. margin.top = margins[0];
  24200. margin.right = margins[1];
  24201. margin.bottom = margins[2];
  24202. margin.left = margins[1];
  24203. } else if (margins.length === 4) {
  24204. margin.top = margins[0];
  24205. margin.right = margins[1];
  24206. margin.bottom = margins[2];
  24207. margin.left = margins[3];
  24208. }
  24209. return margin;
  24210. }
  24211. getPaddings(declaration) {
  24212. let paddings = [];
  24213. let padding = {
  24214. top: {},
  24215. right: {},
  24216. left: {},
  24217. bottom: {}
  24218. };
  24219. lib.walk(declaration, {
  24220. visit: "Dimension",
  24221. enter: (node, item, list) => {
  24222. paddings.push(node);
  24223. }
  24224. });
  24225. if (paddings.length === 1) {
  24226. for (let p in padding) {
  24227. padding[p] = paddings[0];
  24228. }
  24229. } else if (paddings.length === 2) {
  24230. padding.top = paddings[0];
  24231. padding.right = paddings[1];
  24232. padding.bottom = paddings[0];
  24233. padding.left = paddings[1];
  24234. } else if (paddings.length === 3) {
  24235. padding.top = paddings[0];
  24236. padding.right = paddings[1];
  24237. padding.bottom = paddings[2];
  24238. padding.left = paddings[1];
  24239. } else if (paddings.length === 4) {
  24240. padding.top = paddings[0];
  24241. padding.right = paddings[1];
  24242. padding.bottom = paddings[2];
  24243. padding.left = paddings[3];
  24244. }
  24245. return padding;
  24246. }
  24247. addPageClasses(pages, ast, sheet) {
  24248. // First add * page
  24249. if ("*" in pages && !pages["*"].added) {
  24250. let p = this.createPage(pages["*"], ast.children, sheet);
  24251. sheet.insertRule(p);
  24252. pages["*"].added = true;
  24253. }
  24254. // Add :left & :right
  24255. if (":left" in pages && !pages[":left"].added) {
  24256. let left = this.createPage(pages[":left"], ast.children, sheet);
  24257. sheet.insertRule(left);
  24258. pages[":left"].added = true;
  24259. }
  24260. if (":right" in pages && !pages[":right"].added) {
  24261. let right = this.createPage(pages[":right"], ast.children, sheet);
  24262. sheet.insertRule(right);
  24263. pages[":right"].added = true;
  24264. }
  24265. // Add :first & :blank
  24266. if (":first" in pages && !pages[":first"].first) {
  24267. let first = this.createPage(pages[":first"], ast.children, sheet);
  24268. sheet.insertRule(first);
  24269. pages[":first"].added = true;
  24270. }
  24271. if (":blank" in pages && !pages[":blank"].added) {
  24272. let blank = this.createPage(pages[":blank"], ast.children, sheet);
  24273. sheet.insertRule(blank);
  24274. pages[":blank"].added = true;
  24275. }
  24276. // Add nth pages
  24277. for (let pg in pages) {
  24278. if (pages[pg].nth && !pages[pg].added) {
  24279. let nth = this.createPage(pages[pg], ast.children, sheet);
  24280. sheet.insertRule(nth);
  24281. pages[pg].added = true;
  24282. }
  24283. }
  24284. // Add named pages
  24285. for (let pg in pages) {
  24286. if (pages[pg].name && !pages[pg].added) {
  24287. let named = this.createPage(pages[pg], ast.children, sheet);
  24288. sheet.insertRule(named);
  24289. pages[pg].added = true;
  24290. }
  24291. }
  24292. }
  24293. createPage(page, ruleList, sheet) {
  24294. let selectors = this.selectorsForPage(page);
  24295. let children = page.block.children.copy();
  24296. let block = {
  24297. type: "Block",
  24298. loc: 0,
  24299. children: children
  24300. };
  24301. let rule = this.createRule(selectors, block);
  24302. this.addMarginVars(page.margin, children, children.first());
  24303. this.addPaddingVars(page.padding, children, children.first());
  24304. if (page.width) {
  24305. this.addDimensions(page.width, page.height, page.orientation, children, children.first());
  24306. }
  24307. if (page.marginalia) {
  24308. this.addMarginaliaStyles(page, ruleList, rule, sheet);
  24309. this.addMarginaliaContent(page, ruleList, rule, sheet);
  24310. }
  24311. return rule;
  24312. }
  24313. addMarginVars(margin, list, item) {
  24314. // variables for margins
  24315. for (let m in margin) {
  24316. if (typeof margin[m].value !== "undefined") {
  24317. let value = margin[m].value + (margin[m].unit || "");
  24318. let mVar = list.createItem({
  24319. type: "Declaration",
  24320. property: "--pagedjs-margin-" + m,
  24321. value: {
  24322. type: "Raw",
  24323. value: value
  24324. }
  24325. });
  24326. list.append(mVar, item);
  24327. }
  24328. }
  24329. }
  24330. addPaddingVars(padding, list, item) {
  24331. // variables for padding
  24332. for (let p in padding) {
  24333. if (typeof padding[p].value !== "undefined") {
  24334. let value = padding[p].value + (padding[p].unit || "");
  24335. let pVar = list.createItem({
  24336. type: "Declaration",
  24337. property: "--pagedjs-padding-" + p,
  24338. value: {
  24339. type: "Raw",
  24340. value: value
  24341. }
  24342. });
  24343. list.append(pVar, item);
  24344. }
  24345. }
  24346. }
  24347. addDimensions(width, height, orientation, list, item) {
  24348. let widthString, heightString;
  24349. widthString = CSSValueToString(width);
  24350. heightString = CSSValueToString(height);
  24351. if (orientation && orientation !== "portrait") {
  24352. // reverse for orientation
  24353. [widthString, heightString] = [heightString, widthString];
  24354. }
  24355. // width variable
  24356. let wVar = this.createVariable("--pagedjs-pagebox-width", widthString);
  24357. list.appendData(wVar);
  24358. // height variable
  24359. let hVar = this.createVariable("--pagedjs-pagebox-height", heightString);
  24360. list.appendData(hVar);
  24361. // let w = this.createDimension("width", width);
  24362. // let h = this.createDimension("height", height);
  24363. // list.appendData(w);
  24364. // list.appendData(h);
  24365. }
  24366. addMarginaliaStyles(page, list, item, sheet) {
  24367. for (let loc in page.marginalia) {
  24368. let block = lib.clone(page.marginalia[loc]);
  24369. let hasContent = false;
  24370. if(block.children.isEmpty()) {
  24371. continue;
  24372. }
  24373. lib.walk(block, {
  24374. visit: "Declaration",
  24375. enter: (node, item, list) => {
  24376. if (node.property === "content") {
  24377. if (node.value.children && node.value.children.first().name === "none") {
  24378. hasContent = false;
  24379. } else {
  24380. hasContent = true;
  24381. }
  24382. list.remove(item);
  24383. }
  24384. if (node.property === "vertical-align") {
  24385. lib.walk(node, {
  24386. visit: "Identifier",
  24387. enter: (identNode, identItem, identlist) => {
  24388. let name = identNode.name;
  24389. if (name === "top") {
  24390. identNode.name = "flex-start";
  24391. } else if (name === "middle") {
  24392. identNode.name = "center";
  24393. } else if (name === "bottom") {
  24394. identNode.name = "flex-end";
  24395. }
  24396. }
  24397. });
  24398. node.property = "align-items";
  24399. }
  24400. if (node.property === "width" &&
  24401. (loc === "top-left" ||
  24402. loc === "top-center" ||
  24403. loc === "top-right" ||
  24404. loc === "bottom-left" ||
  24405. loc === "bottom-center" ||
  24406. loc === "bottom-right")) {
  24407. let c = lib.clone(node);
  24408. c.property = "max-width";
  24409. list.appendData(c);
  24410. }
  24411. if (node.property === "height" &&
  24412. (loc === "left-top" ||
  24413. loc === "left-middle" ||
  24414. loc === "left-bottom" ||
  24415. loc === "right-top" ||
  24416. loc === "right-middle" ||
  24417. loc === "right-bottom")) {
  24418. let c = lib.clone(node);
  24419. c.property = "max-height";
  24420. list.appendData(c);
  24421. }
  24422. }
  24423. });
  24424. let marginSelectors = this.selectorsForPageMargin(page, loc);
  24425. let marginRule = this.createRule(marginSelectors, block);
  24426. list.appendData(marginRule);
  24427. let sel = lib.generate({
  24428. type: "Selector",
  24429. children: marginSelectors
  24430. });
  24431. this.marginalia[sel] = {
  24432. page: page,
  24433. selector: sel,
  24434. block: page.marginalia[loc],
  24435. hasContent: hasContent
  24436. };
  24437. }
  24438. }
  24439. addMarginaliaContent(page, list, item, sheet) {
  24440. let displayNone;
  24441. // Just content
  24442. for (let loc in page.marginalia) {
  24443. let content = lib.clone(page.marginalia[loc]);
  24444. lib.walk(content, {
  24445. visit: "Declaration",
  24446. enter: (node, item, list) => {
  24447. if (node.property !== "content") {
  24448. list.remove(item);
  24449. }
  24450. if (node.value.children && node.value.children.first().name === "none") {
  24451. displayNone = true;
  24452. }
  24453. }
  24454. });
  24455. if(content.children.isEmpty()) {
  24456. continue;
  24457. }
  24458. let displaySelectors = this.selectorsForPageMargin(page, loc);
  24459. let displayDeclaration;
  24460. displaySelectors.insertData({
  24461. type: "Combinator",
  24462. name: ">"
  24463. });
  24464. displaySelectors.insertData({
  24465. type: "ClassSelector",
  24466. name: "pagedjs_margin-content"
  24467. });
  24468. displaySelectors.insertData({
  24469. type: "Combinator",
  24470. name: ">"
  24471. });
  24472. displaySelectors.insertData({
  24473. type: "TypeSelector",
  24474. name: "*"
  24475. });
  24476. if (displayNone) {
  24477. displayDeclaration = this.createDeclaration("display", "none");
  24478. } else {
  24479. displayDeclaration = this.createDeclaration("display", "block");
  24480. }
  24481. let displayRule = this.createRule(displaySelectors, [displayDeclaration]);
  24482. sheet.insertRule(displayRule);
  24483. // insert content rule
  24484. let contentSelectors = this.selectorsForPageMargin(page, loc);
  24485. contentSelectors.insertData({
  24486. type: "Combinator",
  24487. name: ">"
  24488. });
  24489. contentSelectors.insertData({
  24490. type: "ClassSelector",
  24491. name: "pagedjs_margin-content"
  24492. });
  24493. contentSelectors.insertData({
  24494. type: "PseudoElementSelector",
  24495. name: "after",
  24496. children: null
  24497. });
  24498. let contentRule = this.createRule(contentSelectors, content);
  24499. sheet.insertRule(contentRule);
  24500. }
  24501. }
  24502. addRootVars(ast, width, height, orientation, bleed, bleedrecto, bleedverso, marks) {
  24503. let rules = [];
  24504. let selectors = new lib.List();
  24505. selectors.insertData({
  24506. type: "PseudoClassSelector",
  24507. name: "root",
  24508. children: null
  24509. });
  24510. let widthString, heightString;
  24511. let widthStringRight, heightStringRight;
  24512. let widthStringLeft, heightStringLeft;
  24513. if (!bleed) {
  24514. widthString = CSSValueToString(width);
  24515. heightString = CSSValueToString(height);
  24516. widthStringRight = CSSValueToString(width);
  24517. heightStringRight = CSSValueToString(height);
  24518. widthStringLeft = CSSValueToString(width);
  24519. heightStringLeft = CSSValueToString(height);
  24520. } else {
  24521. widthString = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
  24522. heightString = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
  24523. widthStringRight = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
  24524. heightStringRight = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
  24525. widthStringLeft = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
  24526. heightStringLeft = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
  24527. let bleedTop = this.createVariable("--pagedjs-bleed-top", CSSValueToString(bleed.top));
  24528. let bleedRight = this.createVariable("--pagedjs-bleed-right", CSSValueToString(bleed.right));
  24529. let bleedBottom = this.createVariable("--pagedjs-bleed-bottom", CSSValueToString(bleed.bottom));
  24530. let bleedLeft = this.createVariable("--pagedjs-bleed-left", CSSValueToString(bleed.left));
  24531. let bleedTopRecto = this.createVariable("--pagedjs-bleed-right-top", CSSValueToString(bleed.top));
  24532. let bleedRightRecto = this.createVariable("--pagedjs-bleed-right-right", CSSValueToString(bleed.right));
  24533. let bleedBottomRecto = this.createVariable("--pagedjs-bleed-right-bottom", CSSValueToString(bleed.bottom));
  24534. let bleedLeftRecto = this.createVariable("--pagedjs-bleed-right-left", CSSValueToString(bleed.left));
  24535. let bleedTopVerso = this.createVariable("--pagedjs-bleed-left-top", CSSValueToString(bleed.top));
  24536. let bleedRightVerso = this.createVariable("--pagedjs-bleed-left-right", CSSValueToString(bleed.right));
  24537. let bleedBottomVerso = this.createVariable("--pagedjs-bleed-left-bottom", CSSValueToString(bleed.bottom));
  24538. let bleedLeftVerso = this.createVariable("--pagedjs-bleed-left-left", CSSValueToString(bleed.left));
  24539. if (bleedrecto) {
  24540. bleedTopRecto = this.createVariable("--pagedjs-bleed-right-top", CSSValueToString(bleedrecto.top));
  24541. bleedRightRecto = this.createVariable("--pagedjs-bleed-right-right", CSSValueToString(bleedrecto.right));
  24542. bleedBottomRecto = this.createVariable("--pagedjs-bleed-right-bottom", CSSValueToString(bleedrecto.bottom));
  24543. bleedLeftRecto = this.createVariable("--pagedjs-bleed-right-left", CSSValueToString(bleedrecto.left));
  24544. widthStringRight = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleedrecto.left)} + ${CSSValueToString(bleedrecto.right)} )`;
  24545. heightStringRight = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleedrecto.top)} + ${CSSValueToString(bleedrecto.bottom)} )`;
  24546. }
  24547. if (bleedverso) {
  24548. bleedTopVerso = this.createVariable("--pagedjs-bleed-left-top", CSSValueToString(bleedverso.top));
  24549. bleedRightVerso = this.createVariable("--pagedjs-bleed-left-right", CSSValueToString(bleedverso.right));
  24550. bleedBottomVerso = this.createVariable("--pagedjs-bleed-left-bottom", CSSValueToString(bleedverso.bottom));
  24551. bleedLeftVerso = this.createVariable("--pagedjs-bleed-left-left", CSSValueToString(bleedverso.left));
  24552. widthStringLeft = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleedverso.left)} + ${CSSValueToString(bleedverso.right)} )`;
  24553. heightStringLeft = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleedverso.top)} + ${CSSValueToString(bleedverso.bottom)} )`;
  24554. }
  24555. let pageWidthVar = this.createVariable("--pagedjs-width", CSSValueToString(width));
  24556. let pageHeightVar = this.createVariable("--pagedjs-height", CSSValueToString(height));
  24557. rules.push(
  24558. bleedTop,
  24559. bleedRight,
  24560. bleedBottom,
  24561. bleedLeft,
  24562. bleedTopRecto,
  24563. bleedRightRecto,
  24564. bleedBottomRecto,
  24565. bleedLeftRecto,
  24566. bleedTopVerso,
  24567. bleedRightVerso,
  24568. bleedBottomVerso,
  24569. bleedLeftVerso,
  24570. pageWidthVar,
  24571. pageHeightVar
  24572. );
  24573. }
  24574. if (marks) {
  24575. marks.forEach((mark) => {
  24576. let markDisplay = this.createVariable("--pagedjs-mark-" + mark + "-display", "block");
  24577. rules.push(markDisplay);
  24578. });
  24579. }
  24580. // orientation variable
  24581. if (orientation) {
  24582. let oVar = this.createVariable("--pagedjs-orientation", orientation);
  24583. rules.push(oVar);
  24584. if (orientation !== "portrait") {
  24585. // reverse for orientation
  24586. [widthString, heightString] = [heightString, widthString];
  24587. [widthStringRight, heightStringRight] = [heightStringRight, widthStringRight];
  24588. [widthStringLeft, heightStringLeft] = [heightStringLeft, widthStringLeft];
  24589. }
  24590. }
  24591. let wVar = this.createVariable("--pagedjs-width", widthString);
  24592. let hVar = this.createVariable("--pagedjs-height", heightString);
  24593. let wVarR = this.createVariable("--pagedjs-width-right", widthStringRight);
  24594. let hVarR = this.createVariable("--pagedjs-height-right", heightStringRight);
  24595. let wVarL = this.createVariable("--pagedjs-width-left", widthStringLeft);
  24596. let hVarL = this.createVariable("--pagedjs-height-left", heightStringLeft);
  24597. rules.push(wVar, hVar, wVarR, hVarR, wVarL, hVarL);
  24598. let rule = this.createRule(selectors, rules);
  24599. ast.children.appendData(rule);
  24600. }
  24601. /*
  24602. @page {
  24603. size: var(--pagedjs-width) var(--pagedjs-height);
  24604. margin: 0;
  24605. padding: 0;
  24606. }
  24607. */
  24608. addRootPage(ast, size, bleed, bleedrecto, bleedverso) {
  24609. let { width, height, orientation, format } = size;
  24610. let children = new lib.List();
  24611. let childrenLeft = new lib.List();
  24612. let childrenRight = new lib.List();
  24613. let dimensions = new lib.List();
  24614. let dimensionsLeft = new lib.List();
  24615. let dimensionsRight = new lib.List();
  24616. if (bleed) {
  24617. let widthCalculations = new lib.List();
  24618. let heightCalculations = new lib.List();
  24619. // width
  24620. widthCalculations.appendData({
  24621. type: "Dimension",
  24622. unit: width.unit,
  24623. value: width.value
  24624. });
  24625. widthCalculations.appendData({
  24626. type: "WhiteSpace",
  24627. value: " "
  24628. });
  24629. widthCalculations.appendData({
  24630. type: "Operator",
  24631. value: "+"
  24632. });
  24633. widthCalculations.appendData({
  24634. type: "WhiteSpace",
  24635. value: " "
  24636. });
  24637. widthCalculations.appendData({
  24638. type: "Dimension",
  24639. unit: bleed.left.unit,
  24640. value: bleed.left.value
  24641. });
  24642. widthCalculations.appendData({
  24643. type: "WhiteSpace",
  24644. value: " "
  24645. });
  24646. widthCalculations.appendData({
  24647. type: "Operator",
  24648. value: "+"
  24649. });
  24650. widthCalculations.appendData({
  24651. type: "WhiteSpace",
  24652. value: " "
  24653. });
  24654. widthCalculations.appendData({
  24655. type: "Dimension",
  24656. unit: bleed.right.unit,
  24657. value: bleed.right.value
  24658. });
  24659. // height
  24660. heightCalculations.appendData({
  24661. type: "Dimension",
  24662. unit: height.unit,
  24663. value: height.value
  24664. });
  24665. heightCalculations.appendData({
  24666. type: "WhiteSpace",
  24667. value: " "
  24668. });
  24669. heightCalculations.appendData({
  24670. type: "Operator",
  24671. value: "+"
  24672. });
  24673. heightCalculations.appendData({
  24674. type: "WhiteSpace",
  24675. value: " "
  24676. });
  24677. heightCalculations.appendData({
  24678. type: "Dimension",
  24679. unit: bleed.top.unit,
  24680. value: bleed.top.value
  24681. });
  24682. heightCalculations.appendData({
  24683. type: "WhiteSpace",
  24684. value: " "
  24685. });
  24686. heightCalculations.appendData({
  24687. type: "Operator",
  24688. value: "+"
  24689. });
  24690. heightCalculations.appendData({
  24691. type: "WhiteSpace",
  24692. value: " "
  24693. });
  24694. heightCalculations.appendData({
  24695. type: "Dimension",
  24696. unit: bleed.bottom.unit,
  24697. value: bleed.bottom.value
  24698. });
  24699. dimensions.appendData({
  24700. type: "Function",
  24701. name: "calc",
  24702. children: widthCalculations
  24703. });
  24704. dimensions.appendData({
  24705. type: "WhiteSpace",
  24706. value: " "
  24707. });
  24708. dimensions.appendData({
  24709. type: "Function",
  24710. name: "calc",
  24711. children: heightCalculations
  24712. });
  24713. } else if (format) {
  24714. dimensions.appendData({
  24715. type: "Identifier",
  24716. name: format
  24717. });
  24718. if (orientation) {
  24719. dimensions.appendData({
  24720. type: "WhiteSpace",
  24721. value: " "
  24722. });
  24723. dimensions.appendData({
  24724. type: "Identifier",
  24725. name: orientation
  24726. });
  24727. }
  24728. } else {
  24729. dimensions.appendData({
  24730. type: "Dimension",
  24731. unit: width.unit,
  24732. value: width.value
  24733. });
  24734. dimensions.appendData({
  24735. type: "WhiteSpace",
  24736. value: " "
  24737. });
  24738. dimensions.appendData({
  24739. type: "Dimension",
  24740. unit: height.unit,
  24741. value: height.value
  24742. });
  24743. }
  24744. children.appendData({
  24745. type: "Declaration",
  24746. property: "size",
  24747. loc: null,
  24748. value: {
  24749. type: "Value",
  24750. children: dimensions
  24751. }
  24752. });
  24753. children.appendData({
  24754. type: "Declaration",
  24755. property: "margin",
  24756. loc: null,
  24757. value: {
  24758. type: "Value",
  24759. children: [{
  24760. type: "Dimension",
  24761. unit: "px",
  24762. value: 0
  24763. }]
  24764. }
  24765. });
  24766. children.appendData({
  24767. type: "Declaration",
  24768. property: "padding",
  24769. loc: null,
  24770. value: {
  24771. type: "Value",
  24772. children: [{
  24773. type: "Dimension",
  24774. unit: "px",
  24775. value: 0
  24776. }]
  24777. }
  24778. });
  24779. children.appendData({
  24780. type: "Declaration",
  24781. property: "padding",
  24782. loc: null,
  24783. value: {
  24784. type: "Value",
  24785. children: [{
  24786. type: "Dimension",
  24787. unit: "px",
  24788. value: 0
  24789. }]
  24790. }
  24791. });
  24792. let rule = ast.children.createItem({
  24793. type: "Atrule",
  24794. prelude: null,
  24795. name: "page",
  24796. block: {
  24797. type: "Block",
  24798. loc: null,
  24799. children: children
  24800. }
  24801. });
  24802. ast.children.append(rule);
  24803. if (bleedverso) {
  24804. let widthCalculationsLeft = new lib.List();
  24805. let heightCalculationsLeft = new lib.List();
  24806. // width
  24807. widthCalculationsLeft.appendData({
  24808. type: "Dimension",
  24809. unit: width.unit,
  24810. value: width.value
  24811. });
  24812. widthCalculationsLeft.appendData({
  24813. type: "WhiteSpace",
  24814. value: " "
  24815. });
  24816. widthCalculationsLeft.appendData({
  24817. type: "Operator",
  24818. value: "+"
  24819. });
  24820. widthCalculationsLeft.appendData({
  24821. type: "WhiteSpace",
  24822. value: " "
  24823. });
  24824. widthCalculationsLeft.appendData({
  24825. type: "Dimension",
  24826. unit: bleedverso.left.unit,
  24827. value: bleedverso.left.value
  24828. });
  24829. widthCalculationsLeft.appendData({
  24830. type: "WhiteSpace",
  24831. value: " "
  24832. });
  24833. widthCalculationsLeft.appendData({
  24834. type: "Operator",
  24835. value: "+"
  24836. });
  24837. widthCalculationsLeft.appendData({
  24838. type: "WhiteSpace",
  24839. value: " "
  24840. });
  24841. widthCalculationsLeft.appendData({
  24842. type: "Dimension",
  24843. unit: bleedverso.right.unit,
  24844. value: bleedverso.right.value
  24845. });
  24846. // height
  24847. heightCalculationsLeft.appendData({
  24848. type: "Dimension",
  24849. unit: height.unit,
  24850. value: height.value
  24851. });
  24852. heightCalculationsLeft.appendData({
  24853. type: "WhiteSpace",
  24854. value: " "
  24855. });
  24856. heightCalculationsLeft.appendData({
  24857. type: "Operator",
  24858. value: "+"
  24859. });
  24860. heightCalculationsLeft.appendData({
  24861. type: "WhiteSpace",
  24862. value: " "
  24863. });
  24864. heightCalculationsLeft.appendData({
  24865. type: "Dimension",
  24866. unit: bleedverso.top.unit,
  24867. value: bleedverso.top.value
  24868. });
  24869. heightCalculationsLeft.appendData({
  24870. type: "WhiteSpace",
  24871. value: " "
  24872. });
  24873. heightCalculationsLeft.appendData({
  24874. type: "Operator",
  24875. value: "+"
  24876. });
  24877. heightCalculationsLeft.appendData({
  24878. type: "WhiteSpace",
  24879. value: " "
  24880. });
  24881. heightCalculationsLeft.appendData({
  24882. type: "Dimension",
  24883. unit: bleedverso.bottom.unit,
  24884. value: bleedverso.bottom.value
  24885. });
  24886. dimensionsLeft.appendData({
  24887. type: "Function",
  24888. name: "calc",
  24889. children: widthCalculationsLeft
  24890. });
  24891. dimensionsLeft.appendData({
  24892. type: "WhiteSpace",
  24893. value: " "
  24894. });
  24895. dimensionsLeft.appendData({
  24896. type: "Function",
  24897. name: "calc",
  24898. children: heightCalculationsLeft
  24899. });
  24900. childrenLeft.appendData({
  24901. type: "Declaration",
  24902. property: "size",
  24903. loc: null,
  24904. value: {
  24905. type: "Value",
  24906. children: dimensionsLeft
  24907. }
  24908. });
  24909. let ruleLeft = ast.children.createItem({
  24910. type: "Atrule",
  24911. prelude: null,
  24912. name: "page :left",
  24913. block: {
  24914. type: "Block",
  24915. loc: null,
  24916. children: childrenLeft
  24917. }
  24918. });
  24919. ast.children.append(ruleLeft);
  24920. }
  24921. if (bleedrecto) {
  24922. let widthCalculationsRight = new lib.List();
  24923. let heightCalculationsRight = new lib.List();
  24924. // width
  24925. widthCalculationsRight.appendData({
  24926. type: "Dimension",
  24927. unit: width.unit,
  24928. value: width.value
  24929. });
  24930. widthCalculationsRight.appendData({
  24931. type: "WhiteSpace",
  24932. value: " "
  24933. });
  24934. widthCalculationsRight.appendData({
  24935. type: "Operator",
  24936. value: "+"
  24937. });
  24938. widthCalculationsRight.appendData({
  24939. type: "WhiteSpace",
  24940. value: " "
  24941. });
  24942. widthCalculationsRight.appendData({
  24943. type: "Dimension",
  24944. unit: bleedrecto.left.unit,
  24945. value: bleedrecto.left.value
  24946. });
  24947. widthCalculationsRight.appendData({
  24948. type: "WhiteSpace",
  24949. value: " "
  24950. });
  24951. widthCalculationsRight.appendData({
  24952. type: "Operator",
  24953. value: "+"
  24954. });
  24955. widthCalculationsRight.appendData({
  24956. type: "WhiteSpace",
  24957. value: " "
  24958. });
  24959. widthCalculationsRight.appendData({
  24960. type: "Dimension",
  24961. unit: bleedrecto.right.unit,
  24962. value: bleedrecto.right.value
  24963. });
  24964. // height
  24965. heightCalculationsRight.appendData({
  24966. type: "Dimension",
  24967. unit: height.unit,
  24968. value: height.value
  24969. });
  24970. heightCalculationsRight.appendData({
  24971. type: "WhiteSpace",
  24972. value: " "
  24973. });
  24974. heightCalculationsRight.appendData({
  24975. type: "Operator",
  24976. value: "+"
  24977. });
  24978. heightCalculationsRight.appendData({
  24979. type: "WhiteSpace",
  24980. value: " "
  24981. });
  24982. heightCalculationsRight.appendData({
  24983. type: "Dimension",
  24984. unit: bleedrecto.top.unit,
  24985. value: bleedrecto.top.value
  24986. });
  24987. heightCalculationsRight.appendData({
  24988. type: "WhiteSpace",
  24989. value: " "
  24990. });
  24991. heightCalculationsRight.appendData({
  24992. type: "Operator",
  24993. value: "+"
  24994. });
  24995. heightCalculationsRight.appendData({
  24996. type: "WhiteSpace",
  24997. value: " "
  24998. });
  24999. heightCalculationsRight.appendData({
  25000. type: "Dimension",
  25001. unit: bleedrecto.bottom.unit,
  25002. value: bleedrecto.bottom.value
  25003. });
  25004. dimensionsRight.appendData({
  25005. type: "Function",
  25006. name: "calc",
  25007. children: widthCalculationsRight
  25008. });
  25009. dimensionsRight.appendData({
  25010. type: "WhiteSpace",
  25011. value: " "
  25012. });
  25013. dimensionsRight.appendData({
  25014. type: "Function",
  25015. name: "calc",
  25016. children: heightCalculationsRight
  25017. });
  25018. childrenRight.appendData({
  25019. type: "Declaration",
  25020. property: "size",
  25021. loc: null,
  25022. value: {
  25023. type: "Value",
  25024. children: dimensionsRight
  25025. }
  25026. });
  25027. let ruleRight = ast.children.createItem({
  25028. type: "Atrule",
  25029. prelude: null,
  25030. name: "page :right",
  25031. block: {
  25032. type: "Block",
  25033. loc: null,
  25034. children: childrenRight
  25035. }
  25036. });
  25037. ast.children.append(ruleRight);
  25038. }
  25039. }
  25040. getNth(nth) {
  25041. let n = nth.indexOf("n");
  25042. let plus = nth.indexOf("+");
  25043. let splitN = nth.split("n");
  25044. let splitP = nth.split("+");
  25045. let a = null;
  25046. let b = null;
  25047. if (n > -1) {
  25048. a = splitN[0];
  25049. if (plus > -1) {
  25050. b = splitP[1];
  25051. }
  25052. } else {
  25053. b = nth;
  25054. }
  25055. return {
  25056. type: "Nth",
  25057. loc: null,
  25058. selector: null,
  25059. nth: {
  25060. type: "AnPlusB",
  25061. loc: null,
  25062. a: a,
  25063. b: b
  25064. }
  25065. };
  25066. }
  25067. addPageAttributes(page, start, pages) {
  25068. let named = start.dataset.page;
  25069. if (named) {
  25070. page.name = named;
  25071. page.element.classList.add("pagedjs_named_page");
  25072. page.element.classList.add("pagedjs_" + named + "_page");
  25073. if (!start.dataset.splitFrom) {
  25074. page.element.classList.add("pagedjs_" + named + "_first_page");
  25075. }
  25076. }
  25077. }
  25078. getStartElement(content, breakToken) {
  25079. let node = breakToken && breakToken.node;
  25080. if (!content && !breakToken) {
  25081. return;
  25082. }
  25083. // No break
  25084. if (!node) {
  25085. return content.children[0];
  25086. }
  25087. // Top level element
  25088. if (node.nodeType === 1 && node.parentNode.nodeType === 11) {
  25089. return node;
  25090. }
  25091. // Named page
  25092. if (node.nodeType === 1 && node.dataset.page) {
  25093. return node;
  25094. }
  25095. // Get top level Named parent
  25096. let fragment = rebuildAncestors(node);
  25097. let pages = fragment.querySelectorAll("[data-page]");
  25098. if (pages.length) {
  25099. return pages[pages.length - 1];
  25100. } else {
  25101. return fragment.children[0];
  25102. }
  25103. }
  25104. beforePageLayout(page, contents, breakToken, chunker) {
  25105. let start = this.getStartElement(contents, breakToken);
  25106. if (start) {
  25107. this.addPageAttributes(page, start, chunker.pages);
  25108. }
  25109. }
  25110. afterPageLayout(fragment, page, breakToken, chunker) {
  25111. for (let m in this.marginalia) {
  25112. let margin = this.marginalia[m];
  25113. let sels = m.split(" ");
  25114. let content;
  25115. if (page.element.matches(sels[0]) && margin.hasContent) {
  25116. content = page.element.querySelector(sels[1]);
  25117. content.classList.add("hasContent");
  25118. }
  25119. }
  25120. // check center
  25121. ["top", "bottom"].forEach((loc) => {
  25122. let marginGroup = page.element.querySelector(".pagedjs_margin-" + loc);
  25123. let center = page.element.querySelector(".pagedjs_margin-" + loc + "-center");
  25124. let left = page.element.querySelector(".pagedjs_margin-" + loc + "-left");
  25125. let right = page.element.querySelector(".pagedjs_margin-" + loc + "-right");
  25126. let centerContent = center.classList.contains("hasContent");
  25127. let leftContent = left.classList.contains("hasContent");
  25128. let rightContent = right.classList.contains("hasContent");
  25129. let centerWidth, leftWidth, rightWidth;
  25130. if (leftContent) {
  25131. leftWidth = window.getComputedStyle(left)["max-width"];
  25132. }
  25133. if (rightContent) {
  25134. rightWidth = window.getComputedStyle(right)["max-width"];
  25135. }
  25136. if (centerContent) {
  25137. centerWidth = window.getComputedStyle(center)["max-width"];
  25138. if(centerWidth === "none" || centerWidth === "auto") {
  25139. if(!leftContent && !rightContent){
  25140. marginGroup.style["grid-template-columns"] = "0 1fr 0";
  25141. }else if(leftContent){
  25142. if(!rightContent){
  25143. if(leftWidth !== "none" && leftWidth !== "auto"){
  25144. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + leftWidth;
  25145. }else {
  25146. marginGroup.style["grid-template-columns"] = "auto auto 1fr";
  25147. left.style["white-space"] = "nowrap";
  25148. center.style["white-space"] = "nowrap";
  25149. let leftOuterWidth = left.offsetWidth;
  25150. let centerOuterWidth = center.offsetWidth;
  25151. let outerwidths = leftOuterWidth + centerOuterWidth;
  25152. let newcenterWidth = centerOuterWidth * 100 / outerwidths;
  25153. marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
  25154. left.style["white-space"] = "normal";
  25155. center.style["white-space"] = "normal";
  25156. }
  25157. }else {
  25158. if(leftWidth !== "none" && leftWidth !== "auto"){
  25159. if(rightWidth !== "none" && rightWidth !== "auto"){
  25160. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + rightWidth;
  25161. }else {
  25162. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + leftWidth;
  25163. }
  25164. }else {
  25165. if(rightWidth !== "none" && rightWidth !== "auto"){
  25166. marginGroup.style["grid-template-columns"] = rightWidth + " 1fr " + rightWidth;
  25167. }else {
  25168. marginGroup.style["grid-template-columns"] = "auto auto 1fr";
  25169. left.style["white-space"] = "nowrap";
  25170. center.style["white-space"] = "nowrap";
  25171. right.style["white-space"] = "nowrap";
  25172. let leftOuterWidth = left.offsetWidth;
  25173. let centerOuterWidth = center.offsetWidth;
  25174. let rightOuterWidth = right.offsetWidth;
  25175. let outerwidths = leftOuterWidth + centerOuterWidth + rightOuterWidth;
  25176. let newcenterWidth = centerOuterWidth * 100 / outerwidths;
  25177. if(newcenterWidth > 40){
  25178. marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
  25179. }else {
  25180. marginGroup.style["grid-template-columns"] = "repeat(3, 1fr)";
  25181. }
  25182. left.style["white-space"] = "normal";
  25183. center.style["white-space"] = "normal";
  25184. right.style["white-space"] = "normal";
  25185. }
  25186. }
  25187. }
  25188. }else {
  25189. if(rightWidth !== "none" && rightWidth !== "auto"){
  25190. marginGroup.style["grid-template-columns"] = rightWidth + " 1fr " + rightWidth;
  25191. }else {
  25192. marginGroup.style["grid-template-columns"] = "auto auto 1fr";
  25193. right.style["white-space"] = "nowrap";
  25194. center.style["white-space"] = "nowrap";
  25195. let rightOuterWidth = right.offsetWidth;
  25196. let centerOuterWidth = center.offsetWidth;
  25197. let outerwidths = rightOuterWidth + centerOuterWidth;
  25198. let newcenterWidth = centerOuterWidth * 100 / outerwidths;
  25199. marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
  25200. right.style["white-space"] = "normal";
  25201. center.style["white-space"] = "normal";
  25202. }
  25203. }
  25204. }else if(centerWidth !== "none" && centerWidth !== "auto"){
  25205. if(leftContent && leftWidth !== "none" && leftWidth !== "auto"){
  25206. marginGroup.style["grid-template-columns"] = leftWidth + " " + centerWidth + " 1fr";
  25207. }else if(rightContent && rightWidth !== "none" && rightWidth !== "auto"){
  25208. marginGroup.style["grid-template-columns"] = "1fr " + centerWidth + " " + rightWidth;
  25209. }else {
  25210. marginGroup.style["grid-template-columns"] = "1fr " + centerWidth + " 1fr";
  25211. }
  25212. }
  25213. }else {
  25214. if(leftContent){
  25215. if(!rightContent){
  25216. marginGroup.style["grid-template-columns"] = "1fr 0 0";
  25217. }else {
  25218. if(leftWidth !== "none" && leftWidth !== "auto"){
  25219. if(rightWidth !== "none" && rightWidth !== "auto"){
  25220. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + rightWidth;
  25221. }else {
  25222. marginGroup.style["grid-template-columns"] = leftWidth + " 0 1fr";
  25223. }
  25224. }else {
  25225. if(rightWidth !== "none" && rightWidth !== "auto"){
  25226. marginGroup.style["grid-template-columns"] = "1fr 0 " + rightWidth;
  25227. }else {
  25228. marginGroup.style["grid-template-columns"] = "auto 1fr auto";
  25229. left.style["white-space"] = "nowrap";
  25230. right.style["white-space"] = "nowrap";
  25231. let leftOuterWidth = left.offsetWidth;
  25232. let rightOuterWidth = right.offsetWidth;
  25233. let outerwidths = leftOuterWidth + rightOuterWidth;
  25234. let newLeftWidth = leftOuterWidth * 100 / outerwidths;
  25235. marginGroup.style["grid-template-columns"] = "minmax(16.66%, " + newLeftWidth + "%) 0 1fr";
  25236. left.style["white-space"] = "normal";
  25237. right.style["white-space"] = "normal";
  25238. }
  25239. }
  25240. }
  25241. }else {
  25242. if(rightWidth !== "none" && rightWidth !== "auto"){
  25243. marginGroup.style["grid-template-columns"] = "1fr 0 " + rightWidth;
  25244. }else {
  25245. marginGroup.style["grid-template-columns"] = "0 0 1fr";
  25246. }
  25247. }
  25248. }
  25249. });
  25250. // check middle
  25251. ["left", "right"].forEach((loc) => {
  25252. let middle = page.element.querySelector(".pagedjs_margin-" + loc + "-middle.hasContent");
  25253. let marginGroup = page.element.querySelector(".pagedjs_margin-" + loc);
  25254. let top = page.element.querySelector(".pagedjs_margin-" + loc + "-top");
  25255. let bottom = page.element.querySelector(".pagedjs_margin-" + loc + "-bottom");
  25256. let topContent = top.classList.contains("hasContent");
  25257. let bottomContent = bottom.classList.contains("hasContent");
  25258. let middleHeight, topHeight, bottomHeight;
  25259. if (topContent) {
  25260. topHeight = window.getComputedStyle(top)["max-height"];
  25261. }
  25262. if (bottomContent) {
  25263. bottomHeight = window.getComputedStyle(bottom)["max-height"];
  25264. }
  25265. if (middle) {
  25266. middleHeight = window.getComputedStyle(middle)["max-height"];
  25267. if(middleHeight === "none" || middleHeight === "auto") {
  25268. if(!topContent && !bottomContent){
  25269. marginGroup.style["grid-template-rows"] = "0 1fr 0";
  25270. }else if(topContent){
  25271. if(!bottomContent){
  25272. if(topHeight !== "none" && topHeight !== "auto"){
  25273. marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + "*2) " + topHeight;
  25274. }
  25275. }else {
  25276. if(topHeight !== "none" && topHeight !== "auto"){
  25277. if(bottomHeight !== "none" && bottomHeight !== "auto"){
  25278. marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + " - " + bottomHeight + ") " + bottomHeight;
  25279. }else {
  25280. marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + "*2) " + topHeight;
  25281. }
  25282. }else {
  25283. if(bottomHeight !== "none" && bottomHeight !== "auto"){
  25284. marginGroup.style["grid-template-rows"] = bottomHeight + " calc(100% - " + bottomHeight + "*2) " + bottomHeight;
  25285. }
  25286. }
  25287. }
  25288. }else {
  25289. if(bottomHeight !== "none" && bottomHeight !== "auto"){
  25290. marginGroup.style["grid-template-rows"] = bottomHeight + " calc(100% - " + bottomHeight + "*2) " + bottomHeight;
  25291. }
  25292. }
  25293. }else {
  25294. if(topContent && topHeight !== "none" && topHeight !== "auto"){
  25295. marginGroup.style["grid-template-rows"] = topHeight +" " + middleHeight + " calc(100% - (" + topHeight + " + " + middleHeight + "))";
  25296. }else if(bottomContent && bottomHeight !== "none" && bottomHeight !== "auto"){
  25297. marginGroup.style["grid-template-rows"] = "1fr " + middleHeight + " " + bottomHeight;
  25298. }else {
  25299. marginGroup.style["grid-template-rows"] = "calc((100% - " + middleHeight + ")/2) " + middleHeight + " calc((100% - " + middleHeight + ")/2)";
  25300. }
  25301. }
  25302. }else {
  25303. if(topContent){
  25304. if(!bottomContent){
  25305. marginGroup.style["grid-template-rows"] = "1fr 0 0";
  25306. }else {
  25307. if(topHeight !== "none" && topHeight !== "auto"){
  25308. if(bottomHeight !== "none" && bottomHeight !== "auto"){
  25309. marginGroup.style["grid-template-rows"] = topHeight + " 1fr " + bottomHeight;
  25310. }else {
  25311. marginGroup.style["grid-template-rows"] = topHeight + " 0 1fr";
  25312. }
  25313. }else {
  25314. if(bottomHeight !== "none" && bottomHeight !== "auto"){
  25315. marginGroup.style["grid-template-rows"] = "1fr 0 " + bottomHeight;
  25316. }else {
  25317. marginGroup.style["grid-template-rows"] = "1fr 0 1fr";
  25318. }
  25319. }
  25320. }
  25321. }else {
  25322. if(bottomHeight !== "none" && bottomHeight !== "auto"){
  25323. marginGroup.style["grid-template-rows"] = "1fr 0 " + bottomHeight;
  25324. }else {
  25325. marginGroup.style["grid-template-rows"] = "0 0 1fr";
  25326. }
  25327. }
  25328. }
  25329. });
  25330. }
  25331. // CSS Tree Helpers
  25332. selectorsForPage(page) {
  25333. let nthlist;
  25334. let nth;
  25335. let selectors = new lib.List();
  25336. selectors.insertData({
  25337. type: "ClassSelector",
  25338. name: "pagedjs_page"
  25339. });
  25340. // Named page
  25341. if (page.name) {
  25342. selectors.insertData({
  25343. type: "ClassSelector",
  25344. name: "pagedjs_named_page"
  25345. });
  25346. selectors.insertData({
  25347. type: "ClassSelector",
  25348. name: "pagedjs_" + page.name + "_page"
  25349. });
  25350. }
  25351. // PsuedoSelector
  25352. if (page.psuedo && !(page.name && page.psuedo === "first")) {
  25353. selectors.insertData({
  25354. type: "ClassSelector",
  25355. name: "pagedjs_" + page.psuedo + "_page"
  25356. });
  25357. }
  25358. if (page.name && page.psuedo === "first") {
  25359. selectors.insertData({
  25360. type: "ClassSelector",
  25361. name: "pagedjs_" + page.name + "_" + page.psuedo + "_page"
  25362. });
  25363. }
  25364. // Nth
  25365. if (page.nth) {
  25366. nthlist = new lib.List();
  25367. nth = this.getNth(page.nth);
  25368. nthlist.insertData(nth);
  25369. selectors.insertData({
  25370. type: "PseudoClassSelector",
  25371. name: "nth-of-type",
  25372. children: nthlist
  25373. });
  25374. }
  25375. return selectors;
  25376. }
  25377. selectorsForPageMargin(page, margin) {
  25378. let selectors = this.selectorsForPage(page);
  25379. selectors.insertData({
  25380. type: "Combinator",
  25381. name: " "
  25382. });
  25383. selectors.insertData({
  25384. type: "ClassSelector",
  25385. name: "pagedjs_margin-" + margin
  25386. });
  25387. return selectors;
  25388. }
  25389. createDeclaration(property, value, important) {
  25390. let children = new lib.List();
  25391. children.insertData({
  25392. type: "Identifier",
  25393. loc: null,
  25394. name: value
  25395. });
  25396. return {
  25397. type: "Declaration",
  25398. loc: null,
  25399. important: important,
  25400. property: property,
  25401. value: {
  25402. type: "Value",
  25403. loc: null,
  25404. children: children
  25405. }
  25406. };
  25407. }
  25408. createVariable(property, value) {
  25409. return {
  25410. type: "Declaration",
  25411. loc: null,
  25412. property: property,
  25413. value: {
  25414. type: "Raw",
  25415. value: value
  25416. }
  25417. };
  25418. }
  25419. createCalculatedDimension(property, items, important, operator="+") {
  25420. let children = new lib.List();
  25421. let calculations = new lib.List();
  25422. items.forEach((item, index) => {
  25423. calculations.appendData({
  25424. type: "Dimension",
  25425. unit: item.unit,
  25426. value: item.value
  25427. });
  25428. calculations.appendData({
  25429. type: "WhiteSpace",
  25430. value: " "
  25431. });
  25432. if (index + 1 < items.length) {
  25433. calculations.appendData({
  25434. type: "Operator",
  25435. value: operator
  25436. });
  25437. calculations.appendData({
  25438. type: "WhiteSpace",
  25439. value: " "
  25440. });
  25441. }
  25442. });
  25443. children.insertData({
  25444. type: "Function",
  25445. loc: null,
  25446. name: "calc",
  25447. children: calculations
  25448. });
  25449. return {
  25450. type: "Declaration",
  25451. loc: null,
  25452. important: important,
  25453. property: property,
  25454. value: {
  25455. type: "Value",
  25456. loc: null,
  25457. children: children
  25458. }
  25459. };
  25460. }
  25461. createDimension(property, cssValue, important) {
  25462. let children = new lib.List();
  25463. children.insertData({
  25464. type: "Dimension",
  25465. loc: null,
  25466. value: cssValue.value,
  25467. unit: cssValue.unit
  25468. });
  25469. return {
  25470. type: "Declaration",
  25471. loc: null,
  25472. important: important,
  25473. property: property,
  25474. value: {
  25475. type: "Value",
  25476. loc: null,
  25477. children: children
  25478. }
  25479. };
  25480. }
  25481. createBlock(declarations) {
  25482. let block = new lib.List();
  25483. declarations.forEach((declaration) => {
  25484. block.insertData(declaration);
  25485. });
  25486. return {
  25487. type: "Block",
  25488. loc: null,
  25489. children: block
  25490. };
  25491. }
  25492. createRule(selectors, block) {
  25493. let selectorList = new lib.List();
  25494. selectorList.insertData({
  25495. type: "Selector",
  25496. children: selectors
  25497. });
  25498. if (Array.isArray(block)) {
  25499. block = this.createBlock(block);
  25500. }
  25501. return {
  25502. type: "Rule",
  25503. prelude: {
  25504. type: "SelectorList",
  25505. children: selectorList
  25506. },
  25507. block: block
  25508. };
  25509. }
  25510. }
  25511. class Breaks extends Handler {
  25512. constructor(chunker, polisher, caller) {
  25513. super(chunker, polisher, caller);
  25514. this.breaks = {};
  25515. }
  25516. onDeclaration(declaration, dItem, dList, rule) {
  25517. let property = declaration.property;
  25518. if (property === "page") {
  25519. let children = declaration.value.children.first();
  25520. let value = children.name;
  25521. let selector = lib.generate(rule.ruleNode.prelude);
  25522. let name = value;
  25523. let breaker = {
  25524. property: property,
  25525. value: value,
  25526. selector: selector,
  25527. name: name
  25528. };
  25529. selector.split(",").forEach((s) => {
  25530. if (!this.breaks[s]) {
  25531. this.breaks[s] = [breaker];
  25532. } else {
  25533. this.breaks[s].push(breaker);
  25534. }
  25535. });
  25536. dList.remove(dItem);
  25537. }
  25538. if (property === "break-before" ||
  25539. property === "break-after" ||
  25540. property === "page-break-before" ||
  25541. property === "page-break-after"
  25542. ) {
  25543. let child = declaration.value.children.first();
  25544. let value = child.name;
  25545. let selector = lib.generate(rule.ruleNode.prelude);
  25546. if (property === "page-break-before") {
  25547. property = "break-before";
  25548. } else if (property === "page-break-after") {
  25549. property = "break-after";
  25550. }
  25551. let breaker = {
  25552. property: property,
  25553. value: value,
  25554. selector: selector
  25555. };
  25556. selector.split(",").forEach((s) => {
  25557. if (!this.breaks[s]) {
  25558. this.breaks[s] = [breaker];
  25559. } else {
  25560. this.breaks[s].push(breaker);
  25561. }
  25562. });
  25563. // Remove from CSS -- handle right / left in module
  25564. dList.remove(dItem);
  25565. }
  25566. }
  25567. afterParsed(parsed) {
  25568. this.processBreaks(parsed, this.breaks);
  25569. }
  25570. processBreaks(parsed, breaks) {
  25571. for (let b in breaks) {
  25572. // Find elements
  25573. let elements = parsed.querySelectorAll(b);
  25574. // Add break data
  25575. for (var i = 0; i < elements.length; i++) {
  25576. for (let prop of breaks[b]) {
  25577. if (prop.property === "break-after") {
  25578. let nodeAfter = elementAfter(elements[i]);
  25579. elements[i].setAttribute("data-break-after", prop.value);
  25580. if (nodeAfter) {
  25581. nodeAfter.setAttribute("data-previous-break-after", prop.value);
  25582. }
  25583. } else if (prop.property === "page") {
  25584. elements[i].setAttribute("data-page", prop.value);
  25585. let nodeAfter = elementAfter(elements[i]);
  25586. if (nodeAfter) {
  25587. nodeAfter.setAttribute("data-after-page", prop.value);
  25588. }
  25589. } else {
  25590. elements[i].setAttribute("data-" + prop.property, prop.value);
  25591. }
  25592. }
  25593. }
  25594. }
  25595. }
  25596. mergeBreaks(pageBreaks, newBreaks) {
  25597. for (let b in newBreaks) {
  25598. if (b in pageBreaks) {
  25599. pageBreaks[b] = pageBreaks[b].concat(newBreaks[b]);
  25600. } else {
  25601. pageBreaks[b] = newBreaks[b];
  25602. }
  25603. }
  25604. return pageBreaks;
  25605. }
  25606. addBreakAttributes(pageElement, page) {
  25607. let before = pageElement.querySelector("[data-break-before]");
  25608. let after = pageElement.querySelector("[data-break-after]");
  25609. let previousBreakAfter = pageElement.querySelector("[data-previous-break-after]");
  25610. if (before) {
  25611. if (before.dataset.splitFrom) {
  25612. page.splitFrom = before.dataset.splitFrom;
  25613. pageElement.setAttribute("data-split-from", before.dataset.splitFrom);
  25614. } else if (before.dataset.breakBefore && before.dataset.breakBefore !== "avoid") {
  25615. page.breakBefore = before.dataset.breakBefore;
  25616. pageElement.setAttribute("data-break-before", before.dataset.breakBefore);
  25617. }
  25618. }
  25619. if (after && after.dataset) {
  25620. if (after.dataset.splitTo) {
  25621. page.splitTo = after.dataset.splitTo;
  25622. pageElement.setAttribute("data-split-to", after.dataset.splitTo);
  25623. } else if (after.dataset.breakAfter && after.dataset.breakAfter !== "avoid") {
  25624. page.breakAfter = after.dataset.breakAfter;
  25625. pageElement.setAttribute("data-break-after", after.dataset.breakAfter);
  25626. }
  25627. }
  25628. if (previousBreakAfter && previousBreakAfter.dataset) {
  25629. if (previousBreakAfter.dataset.previousBreakAfter && previousBreakAfter.dataset.previousBreakAfter !== "avoid") {
  25630. page.previousBreakAfter = previousBreakAfter.dataset.previousBreakAfter;
  25631. }
  25632. }
  25633. }
  25634. afterPageLayout(pageElement, page) {
  25635. this.addBreakAttributes(pageElement, page);
  25636. }
  25637. }
  25638. class PrintMedia extends Handler {
  25639. constructor(chunker, polisher, caller) {
  25640. super(chunker, polisher, caller);
  25641. }
  25642. onAtMedia(node, item, list) {
  25643. let media = this.getMediaName(node);
  25644. let rules;
  25645. if (media === "print") {
  25646. rules = node.block.children;
  25647. // Remove rules from the @media block
  25648. node.block.children = new lib.List();
  25649. // Append rules to the end of main rules list
  25650. list.appendList(rules);
  25651. }
  25652. }
  25653. getMediaName(node) {
  25654. let media = "";
  25655. if (typeof node.prelude === "undefined" ||
  25656. node.prelude.type !== "AtrulePrelude" ) {
  25657. return;
  25658. }
  25659. lib.walk(node.prelude, {
  25660. visit: "Identifier",
  25661. enter: (identNode, iItem, iList) => {
  25662. media = identNode.name;
  25663. }
  25664. });
  25665. return media;
  25666. }
  25667. }
  25668. class Splits extends Handler {
  25669. constructor(chunker, polisher, caller) {
  25670. super(chunker, polisher, caller);
  25671. }
  25672. afterPageLayout(pageElement, page, breakToken, chunker) {
  25673. let splits = Array.from(pageElement.querySelectorAll("[data-split-from]"));
  25674. let pages = pageElement.parentNode;
  25675. let index = Array.prototype.indexOf.call(pages.children, pageElement);
  25676. let prevPage;
  25677. if (index === 0) {
  25678. return;
  25679. }
  25680. prevPage = pages.children[index - 1];
  25681. let from; // Capture the last from element
  25682. splits.forEach((split) => {
  25683. let ref = split.dataset.ref;
  25684. from = prevPage.querySelector("[data-ref='"+ ref +"']:not([data-split-to])");
  25685. if (from) {
  25686. from.dataset.splitTo = ref;
  25687. if (!from.dataset.splitFrom) {
  25688. from.dataset.splitOriginal = true;
  25689. }
  25690. }
  25691. });
  25692. // Fix alignment on the deepest split element
  25693. if (from) {
  25694. this.handleAlignment(from);
  25695. }
  25696. }
  25697. handleAlignment(node) {
  25698. let styles = window.getComputedStyle(node);
  25699. let align = styles["text-align"];
  25700. let alignLast = styles["text-align-last"];
  25701. node.dataset.lastSplitElement = "true";
  25702. if (align === "justify" && alignLast === "auto") {
  25703. node.dataset.alignLastSplitElement = "justify";
  25704. } else {
  25705. node.dataset.alignLastSplitElement = alignLast;
  25706. }
  25707. }
  25708. }
  25709. class Counters extends Handler {
  25710. constructor(chunker, polisher, caller) {
  25711. super(chunker, polisher, caller);
  25712. this.styleSheet = polisher.styleSheet;
  25713. this.counters = {};
  25714. }
  25715. onDeclaration(declaration, dItem, dList, rule) {
  25716. let property = declaration.property;
  25717. if (property === "counter-increment") {
  25718. let inc = this.handleIncrement(declaration, rule);
  25719. if (inc) {
  25720. dList.remove(dItem);
  25721. }
  25722. } else if (property === "counter-reset") {
  25723. let reset = this.handleReset(declaration, rule);
  25724. if (reset) {
  25725. dList.remove(dItem);
  25726. }
  25727. }
  25728. }
  25729. onContent(funcNode, fItem, fList, declaration, rule) {
  25730. if (funcNode.name === "counter") ;
  25731. }
  25732. afterParsed(parsed) {
  25733. this.processCounters(parsed, this.counters);
  25734. this.scopeCounters(this.counters);
  25735. }
  25736. addCounter(name) {
  25737. if (name in this.counters) {
  25738. return this.counters[name];
  25739. }
  25740. this.counters[name] = {
  25741. name: name,
  25742. increments: {},
  25743. resets: {}
  25744. };
  25745. return this.counters[name];
  25746. }
  25747. handleIncrement(declaration, rule) {
  25748. let identifier = declaration.value.children.first();
  25749. let number = declaration.value.children.getSize() > 1
  25750. && declaration.value.children.last().value;
  25751. let name = identifier && identifier.name;
  25752. if (name === "page" || name.indexOf("target-counter-") === 0) {
  25753. return;
  25754. }
  25755. let selector = lib.generate(rule.ruleNode.prelude);
  25756. let counter;
  25757. if (!(name in this.counters)) {
  25758. counter = this.addCounter(name);
  25759. } else {
  25760. counter = this.counters[name];
  25761. }
  25762. return counter.increments[selector] = {
  25763. selector: selector,
  25764. number: number || 1
  25765. };
  25766. }
  25767. handleReset(declaration, rule) {
  25768. let identifier = declaration.value.children.first();
  25769. let number = declaration.value.children.getSize() > 1
  25770. && declaration.value.children.last().value;
  25771. let name = identifier && identifier.name;
  25772. let selector = lib.generate(rule.ruleNode.prelude);
  25773. let counter;
  25774. if (!(name in this.counters)) {
  25775. counter = this.addCounter(name);
  25776. } else {
  25777. counter = this.counters[name];
  25778. }
  25779. return counter.resets[selector] = {
  25780. selector: selector,
  25781. number: number || 0
  25782. };
  25783. }
  25784. processCounters(parsed, counters) {
  25785. let counter;
  25786. for (let c in counters) {
  25787. counter = this.counters[c];
  25788. this.processCounterIncrements(parsed, counter);
  25789. this.processCounterResets(parsed, counter);
  25790. this.addCounterValues(parsed, counter);
  25791. }
  25792. }
  25793. scopeCounters(counters) {
  25794. let countersArray = [];
  25795. for (let c in counters) {
  25796. countersArray.push(`${counters[c].name} 0`);
  25797. }
  25798. // Add to pages to allow cross page scope
  25799. this.insertRule(`.pagedjs_pages { counter-reset: ${countersArray.join(" ")}}`);
  25800. }
  25801. insertRule(rule) {
  25802. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  25803. }
  25804. processCounterIncrements(parsed, counter) {
  25805. let increment;
  25806. for (let inc in counter.increments) {
  25807. increment = counter.increments[inc];
  25808. // Find elements for increments
  25809. let incrementElements = parsed.querySelectorAll(increment.selector);
  25810. // Add counter data
  25811. for (var i = 0; i < incrementElements.length; i++) {
  25812. incrementElements[i].setAttribute("data-counter-"+ counter.name +"-increment", increment.number);
  25813. incrementElements[i].setAttribute("data-counter-increment", counter.name);
  25814. }
  25815. }
  25816. }
  25817. processCounterResets(parsed, counter) {
  25818. let reset;
  25819. for (let r in counter.resets) {
  25820. reset = counter.resets[r];
  25821. // Find elements for resets
  25822. let resetElements = parsed.querySelectorAll(reset.selector);
  25823. // Add counter data
  25824. for (var i = 0; i < resetElements.length; i++) {
  25825. resetElements[i].setAttribute("data-counter-"+ counter.name +"-reset", reset.number);
  25826. resetElements[i].setAttribute("data-counter-reset", counter.name);
  25827. }
  25828. }
  25829. }
  25830. addCounterValues(parsed, counter) {
  25831. let counterName = counter.name;
  25832. let elements = parsed.querySelectorAll("[data-counter-"+ counterName +"-reset], [data-counter-"+ counterName +"-increment]");
  25833. let count = 0;
  25834. let element;
  25835. let increment, reset;
  25836. let resetValue, incrementValue, resetDelta;
  25837. let incrementArray;
  25838. for (var i = 0; i < elements.length; i++) {
  25839. element = elements[i];
  25840. resetDelta = 0;
  25841. incrementArray = [];
  25842. if (element.hasAttribute("data-counter-"+ counterName +"-reset")) {
  25843. reset = element.getAttribute("data-counter-"+ counterName +"-reset");
  25844. resetValue = parseInt(reset);
  25845. // Use negative increment value inplace of reset
  25846. resetDelta = resetValue - count;
  25847. incrementArray.push(`${counterName} ${resetDelta}`);
  25848. count = resetValue;
  25849. }
  25850. if (element.hasAttribute("data-counter-"+ counterName +"-increment")) {
  25851. increment = element.getAttribute("data-counter-"+ counterName +"-increment");
  25852. incrementValue = parseInt(increment);
  25853. count += incrementValue;
  25854. element.setAttribute("data-counter-"+counterName+"-value", count);
  25855. incrementArray.push(`${counterName} ${incrementValue}`);
  25856. }
  25857. if (incrementArray.length > 0) {
  25858. this.incrementCounterForElement(element, incrementArray);
  25859. }
  25860. }
  25861. }
  25862. incrementCounterForElement(element, incrementArray) {
  25863. if (!element || !incrementArray || incrementArray.length === 0) return;
  25864. let ref = element.dataset.ref;
  25865. let prevIncrements = Array.from(this.styleSheet.cssRules).filter((rule) => {
  25866. return rule.selectorText === `[data-ref="${element.dataset.ref}"]:not([data-split-from])`
  25867. && rule.style[0] === "counter-increment";
  25868. });
  25869. let increments = [];
  25870. for (let styleRule of prevIncrements) {
  25871. let values = styleRule.style.counterIncrement.split(" ");
  25872. for (var i = 0; i < values.length; i+=2) {
  25873. increments.push(values[i] + " " + values[i+1]);
  25874. }
  25875. }
  25876. Array.prototype.push.apply(increments, incrementArray);
  25877. this.insertRule(`[data-ref="${ref}"]:not([data-split-from]) { counter-increment: ${increments.join(" ")} }`);
  25878. }
  25879. afterPageLayout(pageElement, page) {
  25880. let pgreset = pageElement.querySelectorAll("[data-counter-page-reset]");
  25881. pgreset.forEach((reset) => {
  25882. let value = reset.datasetCounterPageReset;
  25883. this.styleSheet.insertRule(`[data-page-number="${pageElement.dataset.pageNumber}"] { counter-reset: page ${value} }`, this.styleSheet.cssRules.length);
  25884. });
  25885. }
  25886. }
  25887. class Lists extends Handler {
  25888. constructor(chunker, polisher, caller) {
  25889. super(chunker, polisher, caller);
  25890. }
  25891. afterParsed(content) {
  25892. const orderedLists = content.querySelectorAll("ol");
  25893. for (var list of orderedLists) {
  25894. this.addDataNumbers(list);
  25895. }
  25896. }
  25897. afterPageLayout(pageElement, page, breakToken, chunker) {
  25898. var orderedLists = pageElement.getElementsByTagName("ol");
  25899. for (var list of orderedLists) {
  25900. if (list.hasChildNodes()) {
  25901. list.start = list.firstElementChild.dataset.itemNum;
  25902. }
  25903. else {
  25904. list.parentNode.removeChild(list);
  25905. }
  25906. }
  25907. }
  25908. addDataNumbers(list) {
  25909. let items = list.children;
  25910. for (var i = 0; i < items.length; i++) {
  25911. items[i].setAttribute("data-item-num", i + 1);
  25912. }
  25913. }
  25914. }
  25915. class PositionFixed extends Handler {
  25916. constructor(chunker, polisher, caller) {
  25917. super(chunker, polisher, caller);
  25918. this.styleSheet = polisher.styleSheet;
  25919. this.fixedElementsSelector = [];
  25920. this.fixedElements = [];
  25921. }
  25922. onDeclaration(declaration, dItem, dList, rule) {
  25923. if (declaration.property === "position" && declaration.value.children.first().name === "fixed") {
  25924. let selector = lib.generate(rule.ruleNode.prelude);
  25925. this.fixedElementsSelector.push(selector);
  25926. dList.remove(dItem);
  25927. }
  25928. }
  25929. afterParsed(fragment) {
  25930. this.fixedElementsSelector.forEach(fixedEl => {
  25931. fragment.querySelectorAll(`${fixedEl}`).forEach(el => {
  25932. el.style.setProperty("position", "absolute");
  25933. this.fixedElements.push(el);
  25934. el.remove();
  25935. });
  25936. });
  25937. }
  25938. afterPageLayout(pageElement, page, breakToken) {
  25939. this.fixedElements.forEach(el => {
  25940. const clone = el.cloneNode(true);
  25941. pageElement.querySelector(".pagedjs_pagebox").insertAdjacentElement("afterbegin", clone);
  25942. });
  25943. }
  25944. }
  25945. var pagedMediaHandlers = [
  25946. AtPage,
  25947. Breaks,
  25948. PrintMedia,
  25949. Splits,
  25950. Counters,
  25951. Lists,
  25952. PositionFixed
  25953. ];
  25954. class RunningHeaders extends Handler {
  25955. constructor(chunker, polisher, caller) {
  25956. super(chunker, polisher, caller);
  25957. this.runningSelectors = {};
  25958. this.elements = {};
  25959. }
  25960. onDeclaration(declaration, dItem, dList, rule) {
  25961. if (declaration.property === "position") {
  25962. let selector = lib.generate(rule.ruleNode.prelude);
  25963. let identifier = declaration.value.children.first().name;
  25964. if (identifier === "running") {
  25965. let value;
  25966. lib.walk(declaration, {
  25967. visit: "Function",
  25968. enter: (node, item, list) => {
  25969. value = node.children.first().name;
  25970. }
  25971. });
  25972. this.runningSelectors[value] = {
  25973. identifier: identifier,
  25974. value: value,
  25975. selector: selector
  25976. };
  25977. }
  25978. }
  25979. if (declaration.property === "content") {
  25980. lib.walk(declaration, {
  25981. visit: "Function",
  25982. enter: (funcNode, fItem, fList) => {
  25983. if (funcNode.name.indexOf("element") > -1) {
  25984. let selector = lib.generate(rule.ruleNode.prelude);
  25985. let func = funcNode.name;
  25986. let value = funcNode.children.first().name;
  25987. let args = [value];
  25988. // we only handle first for now
  25989. let style = "first";
  25990. selector.split(",").forEach((s) => {
  25991. // remove before / after
  25992. s = s.replace(/::after|::before/, "");
  25993. this.elements[s] = {
  25994. func: func,
  25995. args: args,
  25996. value: value,
  25997. style: style ,
  25998. selector: s,
  25999. fullSelector: selector
  26000. };
  26001. });
  26002. }
  26003. }
  26004. });
  26005. }
  26006. }
  26007. afterParsed(fragment) {
  26008. for (let name of Object.keys(this.runningSelectors)) {
  26009. let set = this.runningSelectors[name];
  26010. let selected = Array.from(fragment.querySelectorAll(set.selector));
  26011. if (set.identifier === "running") {
  26012. for (let header of selected) {
  26013. header.style.display = "none";
  26014. }
  26015. }
  26016. }
  26017. }
  26018. afterPageLayout(fragment) {
  26019. for (let name of Object.keys(this.runningSelectors)) {
  26020. let set = this.runningSelectors[name];
  26021. let selected = fragment.querySelector(set.selector);
  26022. if (selected) {
  26023. // let cssVar;
  26024. if (set.identifier === "running") {
  26025. // cssVar = selected.textContent.replace(/\\([\s\S])|(["|'])/g,"\\$1$2");
  26026. // this.styleSheet.insertRule(`:root { --string-${name}: "${cssVar}"; }`, this.styleSheet.cssRules.length);
  26027. // fragment.style.setProperty(`--string-${name}`, `"${cssVar}"`);
  26028. set.first = selected;
  26029. } else {
  26030. console.warn(set.value + "needs css replacement");
  26031. }
  26032. }
  26033. }
  26034. // move elements
  26035. if (!this.orderedSelectors) {
  26036. this.orderedSelectors = this.orderSelectors(this.elements);
  26037. }
  26038. for (let selector of this.orderedSelectors) {
  26039. if (selector) {
  26040. let el = this.elements[selector];
  26041. let selected = fragment.querySelector(selector);
  26042. if (selected) {
  26043. let running = this.runningSelectors[el.args[0]];
  26044. if (running && running.first) {
  26045. selected.innerHTML = ""; // Clear node
  26046. // selected.classList.add("pagedjs_clear-after"); // Clear ::after
  26047. let clone = running.first.cloneNode(true);
  26048. clone.style.display = null;
  26049. selected.appendChild(clone);
  26050. }
  26051. }
  26052. }
  26053. }
  26054. }
  26055. /**
  26056. * Assign a weight to @page selector classes
  26057. * 1) page
  26058. * 2) left & right
  26059. * 3) blank
  26060. * 4) first & nth
  26061. * 5) named page
  26062. * 6) named left & right
  26063. * 7) named first & nth
  26064. * @param {string} [s] selector string
  26065. * @return {int} weight
  26066. */
  26067. pageWeight(s) {
  26068. let weight = 1;
  26069. let selector = s.split(" ");
  26070. let parts = selector.length && selector[0].split(".");
  26071. parts.shift(); // remove empty first part
  26072. switch (parts.length) {
  26073. case 4:
  26074. if (parts[3] === "pagedjs_first_page") {
  26075. weight = 7;
  26076. } else if (parts[3] === "pagedjs_left_page" || parts[3] === "pagedjs_right_page") {
  26077. weight = 6;
  26078. }
  26079. break;
  26080. case 3:
  26081. if (parts[1] === "pagedjs_named_page") {
  26082. if (parts[2].indexOf(":nth-of-type") > -1) {
  26083. weight = 7;
  26084. } else {
  26085. weight = 5;
  26086. }
  26087. }
  26088. break;
  26089. case 2:
  26090. if (parts[1] === "pagedjs_first_page") {
  26091. weight = 4;
  26092. } else if (parts[1] === "pagedjs_blank_page") {
  26093. weight = 3;
  26094. } else if (parts[1] === "pagedjs_left_page" || parts[1] === "pagedjs_right_page") {
  26095. weight = 2;
  26096. }
  26097. break;
  26098. default:
  26099. if (parts[0].indexOf(":nth-of-type") > -1) {
  26100. weight = 4;
  26101. } else {
  26102. weight = 1;
  26103. }
  26104. }
  26105. return weight;
  26106. }
  26107. /**
  26108. * Orders the selectors based on weight
  26109. *
  26110. * Does not try to deduplicate base on specifity of the selector
  26111. * Previous matched selector will just be overwritten
  26112. * @param {obj} [obj] selectors object
  26113. * @return {Array} orderedSelectors
  26114. */
  26115. orderSelectors(obj) {
  26116. let selectors = Object.keys(obj);
  26117. let weighted = {
  26118. 1: [],
  26119. 2: [],
  26120. 3: [],
  26121. 4: [],
  26122. 5: [],
  26123. 6: [],
  26124. 7: []
  26125. };
  26126. let orderedSelectors = [];
  26127. for (let s of selectors) {
  26128. let w = this.pageWeight(s);
  26129. weighted[w].unshift(s);
  26130. }
  26131. for (var i = 1; i <= 7; i++) {
  26132. orderedSelectors = orderedSelectors.concat(weighted[i]);
  26133. }
  26134. return orderedSelectors;
  26135. }
  26136. beforeTreeParse(text, sheet) {
  26137. // element(x) is parsed as image element selector, so update element to element-ident
  26138. sheet.text = text.replace(/element[\s]*\(([^|^#)]*)\)/g, "element-ident($1)");
  26139. }
  26140. }
  26141. function cleanPseudoContent(el, trim = "\"' ") {
  26142. if(el == null) return;
  26143. return el
  26144. .replace(new RegExp(`^[${trim}]+`), "")
  26145. .replace(new RegExp(`[${trim}]+$`), "")
  26146. .replace(/["']/g, match => {
  26147. return "\\" + match;
  26148. })
  26149. .replace(/[\n]/g, match => {
  26150. return "\\00000A";
  26151. });
  26152. }
  26153. class StringSets extends Handler {
  26154. constructor(chunker, polisher, caller) {
  26155. super(chunker, polisher, caller);
  26156. this.stringSetSelectors = {};
  26157. this.type;
  26158. // pageLastString = last string variable defined on the page
  26159. this.pageLastString;
  26160. }
  26161. onDeclaration(declaration, dItem, dList, rule) {
  26162. if (declaration.property === "string-set") {
  26163. let selector = lib.generate(rule.ruleNode.prelude);
  26164. let identifier = declaration.value.children.first().name;
  26165. let value;
  26166. lib.walk(declaration, {
  26167. visit: "Function",
  26168. enter: (node, item, list) => {
  26169. value = lib.generate(node);
  26170. }
  26171. });
  26172. this.stringSetSelectors[identifier] = {
  26173. identifier,
  26174. value,
  26175. selector
  26176. };
  26177. }
  26178. }
  26179. onContent(funcNode, fItem, fList, declaration, rule) {
  26180. if (funcNode.name === "string") {
  26181. let identifier = funcNode.children && funcNode.children.first().name;
  26182. this.type = funcNode.children.last().name;
  26183. funcNode.name = "var";
  26184. funcNode.children = new lib.List();
  26185. funcNode.children.append(
  26186. funcNode.children.createItem({
  26187. type: "Identifier",
  26188. loc: null,
  26189. name: "--pagedjs-string-" + identifier
  26190. })
  26191. );
  26192. }
  26193. }
  26194. afterPageLayout(fragment) {
  26195. if ( this.pageLastString === undefined )
  26196. {
  26197. this.pageLastString = {};
  26198. }
  26199. // get the value of the previous last string
  26200. for (let name of Object.keys(this.stringSetSelectors)) {
  26201. let set = this.stringSetSelectors[name];
  26202. let selected = fragment.querySelectorAll(set.selector);
  26203. // let cssVar = previousPageLastString;
  26204. // Get the last found string for the current identifier
  26205. let cssVar = ( name in this.pageLastString ) ? this.pageLastString[name] : "";
  26206. selected.forEach((sel) => {
  26207. // push each content into the array to define in the variable the first and the last element of the page.
  26208. //this.pageLastString = selected[selected.length - 1].textContent;
  26209. // Index by identifier
  26210. this.pageLastString[name] = selected[selected.length - 1].textContent;
  26211. if (this.type === "first") {
  26212. cssVar = selected[0].textContent;
  26213. }
  26214. else if (this.type === "last") {
  26215. cssVar = selected[selected.length - 1].textContent;
  26216. }
  26217. else if (this.type === "start") {
  26218. if (sel.parentElement.firstChild === sel) {
  26219. cssVar = sel.textContent;
  26220. }
  26221. }
  26222. else if (this.type === "first-except") {
  26223. cssVar = "";
  26224. }
  26225. else {
  26226. cssVar = selected[0].textContent;
  26227. }
  26228. });
  26229. fragment.setAttribute("data-string", `string-type-${this.type}-${name}`);
  26230. // fragment.style.setProperty(`--pagedjs-string-${name}`, `"${cssVar.replace(/\\([\s\S])|(["|'])/g, "\\$1$2")}"`);
  26231. fragment.style.setProperty(`--pagedjs-string-${name}`, `"${cleanPseudoContent(cssVar)}`);
  26232. // if there is no new string on the page
  26233. if (!fragment.hasAttribute("data-string")) {
  26234. fragment.style.setProperty(`--pagedjs-string-${name}`, `"${this.pageLastString}"`);
  26235. }
  26236. }
  26237. }
  26238. }
  26239. class TargetCounters extends Handler {
  26240. constructor(chunker, polisher, caller) {
  26241. super(chunker, polisher, caller);
  26242. this.styleSheet = polisher.styleSheet;
  26243. this.counterTargets = {};
  26244. }
  26245. onContent(funcNode, fItem, fList, declaration, rule) {
  26246. if (funcNode.name === "target-counter") {
  26247. let selector = lib.generate(rule.ruleNode.prelude);
  26248. let first = funcNode.children.first();
  26249. let func = first.name;
  26250. let value = lib.generate(funcNode);
  26251. let args = [];
  26252. first.children.forEach((child) => {
  26253. if (child.type === "Identifier") {
  26254. args.push(child.name);
  26255. }
  26256. });
  26257. let counter;
  26258. let style;
  26259. let styleIdentifier;
  26260. funcNode.children.forEach((child) => {
  26261. if (child.type === "Identifier") {
  26262. if (!counter) {
  26263. counter = child.name;
  26264. } else if (!style) {
  26265. styleIdentifier = lib.clone(child);
  26266. style = child.name;
  26267. }
  26268. }
  26269. });
  26270. let variable = "target-counter-" + UUID();
  26271. selector.split(",").forEach((s) => {
  26272. this.counterTargets[s] = {
  26273. func: func,
  26274. args: args,
  26275. value: value,
  26276. counter: counter,
  26277. style: style,
  26278. selector: s,
  26279. fullSelector: selector,
  26280. variable: variable
  26281. };
  26282. });
  26283. // Replace with counter
  26284. funcNode.name = "counter";
  26285. funcNode.children = new lib.List();
  26286. funcNode.children.appendData({
  26287. type: "Identifier",
  26288. loc: 0,
  26289. name: variable
  26290. });
  26291. if (styleIdentifier) {
  26292. funcNode.children.appendData({type: "Operator", loc: null, value: ","});
  26293. funcNode.children.appendData(styleIdentifier);
  26294. }
  26295. }
  26296. }
  26297. afterPageLayout(fragment, page, breakToken, chunker) {
  26298. Object.keys(this.counterTargets).forEach((name) => {
  26299. let target = this.counterTargets[name];
  26300. let split = target.selector.split("::");
  26301. let query = split[0];
  26302. let queried = chunker.pagesArea.querySelectorAll(query + ":not([data-" + target.variable + "])");
  26303. queried.forEach((selected, index) => {
  26304. // TODO: handle func other than attr
  26305. if (target.func !== "attr") {
  26306. return;
  26307. }
  26308. let val = attr(selected, target.args);
  26309. let element = chunker.pagesArea.querySelector(querySelectorEscape(val));
  26310. if (element) {
  26311. let selector = UUID();
  26312. selected.setAttribute("data-" + target.variable, selector);
  26313. // TODO: handle other counter types (by query)
  26314. let pseudo = "";
  26315. if (split.length > 1) {
  26316. pseudo += "::" + split[1];
  26317. }
  26318. if (target.counter === "page") {
  26319. let pages = chunker.pagesArea.querySelectorAll(".pagedjs_page");
  26320. let pg = 0;
  26321. for (var i = 0; i < pages.length; i++) {
  26322. let styles = window.getComputedStyle(pages[i]);
  26323. let reset = styles["counter-reset"].replace("page", "").trim();
  26324. if (reset !== "none") {
  26325. pg = parseInt(reset);
  26326. }
  26327. pg += 1;
  26328. if (pages[i].contains( element )){
  26329. break;
  26330. }
  26331. }
  26332. this.styleSheet.insertRule(`[data-${target.variable}="${selector}"]${pseudo} { counter-reset: ${target.variable} ${pg}; }`, this.styleSheet.cssRules.length);
  26333. } else {
  26334. let value = element.getAttribute(`data-counter-${target.counter}-value`);
  26335. if (value) {
  26336. this.styleSheet.insertRule(`[data-${target.variable}="${selector}"]${pseudo} { counter-reset: ${target.variable} ${target.variable} ${parseInt(value)}; }`, this.styleSheet.cssRules.length);
  26337. }
  26338. }
  26339. }
  26340. });
  26341. });
  26342. }
  26343. }
  26344. // import { nodeAfter } from "../../utils/dom";
  26345. class TargetText extends Handler {
  26346. constructor(chunker, polisher, caller) {
  26347. super(chunker, polisher, caller);
  26348. this.styleSheet = polisher.styleSheet;
  26349. this.textTargets = {};
  26350. this.beforeContent = "";
  26351. this.afterContent = "";
  26352. this.selector = {};
  26353. }
  26354. onContent(funcNode, fItem, fList, declaration, rule) {
  26355. if (funcNode.name === "target-text") {
  26356. this.selector = lib.generate(rule.ruleNode.prelude);
  26357. let first = funcNode.children.first();
  26358. let last = funcNode.children.last();
  26359. let func = first.name;
  26360. let value = lib.generate(funcNode);
  26361. let args = [];
  26362. first.children.forEach(child => {
  26363. if (child.type === "Identifier") {
  26364. args.push(child.name);
  26365. }
  26366. });
  26367. let style;
  26368. if (last !== first) {
  26369. style = last.name;
  26370. }
  26371. let variable = "--pagedjs-" + UUID();
  26372. this.selector.split(",").forEach(s => {
  26373. this.textTargets[s] = {
  26374. func: func,
  26375. args: args,
  26376. value: value,
  26377. style: style || "content",
  26378. selector: s,
  26379. fullSelector: this.selector,
  26380. variable: variable
  26381. };
  26382. });
  26383. // Replace with variable
  26384. funcNode.name = "var";
  26385. funcNode.children = new lib.List();
  26386. funcNode.children.appendData({
  26387. type: "Identifier",
  26388. loc: 0,
  26389. name: variable
  26390. });
  26391. }
  26392. }
  26393. // parse this on the ONCONTENT : get all before and after and replace the value with a variable
  26394. onPseudoSelector(pseudoNode, pItem, pList, selector, rule) {
  26395. // console.log(pseudoNode);
  26396. // console.log(rule);
  26397. rule.ruleNode.block.children.forEach(properties => {
  26398. if (pseudoNode.name === "before" && properties.property === "content") {
  26399. // let beforeVariable = "--pagedjs-" + UUID();
  26400. let contenu = properties.value.children;
  26401. contenu.forEach(prop => {
  26402. if (prop.type === "String") {
  26403. this.beforeContent = prop.value;
  26404. }
  26405. });
  26406. } else if (pseudoNode.name === "after" && properties.property === "content") {
  26407. properties.value.children.forEach(prop => {
  26408. if (prop.type === "String") {
  26409. this.afterContent = prop.value;
  26410. }
  26411. });
  26412. }
  26413. });
  26414. }
  26415. afterParsed(fragment) {
  26416. Object.keys(this.textTargets).forEach(name => {
  26417. let target = this.textTargets[name];
  26418. let split = target.selector.split("::");
  26419. let query = split[0];
  26420. let queried = fragment.querySelectorAll(query);
  26421. let textContent;
  26422. queried.forEach((selected, index) => {
  26423. let val = attr(selected, target.args);
  26424. let element = fragment.querySelector(querySelectorEscape(val));
  26425. if (element) {
  26426. // content & first-letter & before & after refactorized
  26427. if (target.style) {
  26428. this.selector = UUID();
  26429. selected.setAttribute("data-target-text", this.selector);
  26430. let psuedo = "";
  26431. if (split.length > 1) {
  26432. psuedo += "::" + split[1];
  26433. }
  26434. if (target.style === "before" || target.style === "after") {
  26435. const pseudoType = `${target.style}Content`;
  26436. textContent = cleanPseudoContent(this[pseudoType]);
  26437. } else {
  26438. textContent = cleanPseudoContent(element.textContent, " ");
  26439. }
  26440. textContent = target.style === "first-letter" ? textContent.charAt(0) : textContent;
  26441. this.styleSheet.insertRule(`[data-target-text="${this.selector}"]${psuedo} { ${target.variable}: "${textContent}" }`);
  26442. } else {
  26443. console.warn("missed target", val);
  26444. }
  26445. }
  26446. });
  26447. });
  26448. }
  26449. }
  26450. var generatedContentHandlers = [
  26451. RunningHeaders,
  26452. StringSets,
  26453. TargetCounters,
  26454. TargetText
  26455. ];
  26456. var isImplemented$3 = function () {
  26457. var from = Array.from, arr, result;
  26458. if (typeof from !== "function") return false;
  26459. arr = ["raz", "dwa"];
  26460. result = from(arr);
  26461. return Boolean(result && (result !== arr) && (result[1] === "dwa"));
  26462. };
  26463. var validTypes = { object: true, symbol: true };
  26464. var isImplemented$4 = function () {
  26465. var symbol;
  26466. if (typeof Symbol !== 'function') return false;
  26467. symbol = Symbol('test symbol');
  26468. try { String(symbol); } catch (e) { return false; }
  26469. // Return 'true' also for polyfills
  26470. if (!validTypes[typeof Symbol.iterator]) return false;
  26471. if (!validTypes[typeof Symbol.toPrimitive]) return false;
  26472. if (!validTypes[typeof Symbol.toStringTag]) return false;
  26473. return true;
  26474. };
  26475. var isSymbol = function (x) {
  26476. if (!x) return false;
  26477. if (typeof x === 'symbol') return true;
  26478. if (!x.constructor) return false;
  26479. if (x.constructor.name !== 'Symbol') return false;
  26480. return (x[x.constructor.toStringTag] === 'Symbol');
  26481. };
  26482. var validateSymbol = function (value) {
  26483. if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
  26484. return value;
  26485. };
  26486. var create$6 = Object.create, defineProperties = Object.defineProperties
  26487. , defineProperty = Object.defineProperty, objPrototype = Object.prototype
  26488. , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create$6(null)
  26489. , isNativeSafe;
  26490. if (typeof Symbol === 'function') {
  26491. NativeSymbol = Symbol;
  26492. try {
  26493. String(NativeSymbol());
  26494. isNativeSafe = true;
  26495. } catch (ignore) {}
  26496. }
  26497. var generateName = (function () {
  26498. var created = create$6(null);
  26499. return function (desc) {
  26500. var postfix = 0, name, ie11BugWorkaround;
  26501. while (created[desc + (postfix || '')]) ++postfix;
  26502. desc += (postfix || '');
  26503. created[desc] = true;
  26504. name = '@@' + desc;
  26505. defineProperty(objPrototype, name, d_1.gs(null, function (value) {
  26506. // For IE11 issue see:
  26507. // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
  26508. // ie11-broken-getters-on-dom-objects
  26509. // https://github.com/medikoo/es6-symbol/issues/12
  26510. if (ie11BugWorkaround) return;
  26511. ie11BugWorkaround = true;
  26512. defineProperty(this, name, d_1(value));
  26513. ie11BugWorkaround = false;
  26514. }));
  26515. return name;
  26516. };
  26517. }());
  26518. // Internal constructor (not one exposed) for creating Symbol instances.
  26519. // This one is used to ensure that `someSymbol instanceof Symbol` always return false
  26520. HiddenSymbol = function Symbol(description) {
  26521. if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');
  26522. return SymbolPolyfill(description);
  26523. };
  26524. // Exposed `Symbol` constructor
  26525. // (returns instances of HiddenSymbol)
  26526. var polyfill = SymbolPolyfill = function Symbol(description) {
  26527. var symbol;
  26528. if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');
  26529. if (isNativeSafe) return NativeSymbol(description);
  26530. symbol = create$6(HiddenSymbol.prototype);
  26531. description = (description === undefined ? '' : String(description));
  26532. return defineProperties(symbol, {
  26533. __description__: d_1('', description),
  26534. __name__: d_1('', generateName(description))
  26535. });
  26536. };
  26537. defineProperties(SymbolPolyfill, {
  26538. for: d_1(function (key) {
  26539. if (globalSymbols[key]) return globalSymbols[key];
  26540. return (globalSymbols[key] = SymbolPolyfill(String(key)));
  26541. }),
  26542. keyFor: d_1(function (s) {
  26543. var key;
  26544. validateSymbol(s);
  26545. for (key in globalSymbols) if (globalSymbols[key] === s) return key;
  26546. }),
  26547. // To ensure proper interoperability with other native functions (e.g. Array.from)
  26548. // fallback to eventual native implementation of given symbol
  26549. hasInstance: d_1('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),
  26550. isConcatSpreadable: d_1('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||
  26551. SymbolPolyfill('isConcatSpreadable')),
  26552. iterator: d_1('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),
  26553. match: d_1('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),
  26554. replace: d_1('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),
  26555. search: d_1('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),
  26556. species: d_1('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),
  26557. split: d_1('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),
  26558. toPrimitive: d_1('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),
  26559. toStringTag: d_1('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),
  26560. unscopables: d_1('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))
  26561. });
  26562. // Internal tweaks for real symbol producer
  26563. defineProperties(HiddenSymbol.prototype, {
  26564. constructor: d_1(SymbolPolyfill),
  26565. toString: d_1('', function () { return this.__name__; })
  26566. });
  26567. // Proper implementation of methods exposed on Symbol.prototype
  26568. // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
  26569. defineProperties(SymbolPolyfill.prototype, {
  26570. toString: d_1(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
  26571. valueOf: d_1(function () { return validateSymbol(this); })
  26572. });
  26573. defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d_1('', function () {
  26574. var symbol = validateSymbol(this);
  26575. if (typeof symbol === 'symbol') return symbol;
  26576. return symbol.toString();
  26577. }));
  26578. defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d_1('c', 'Symbol'));
  26579. // Proper implementaton of toPrimitive and toStringTag for returned symbol instances
  26580. defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
  26581. d_1('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
  26582. // Note: It's important to define `toPrimitive` as last one, as some implementations
  26583. // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
  26584. // And that may invoke error in definition flow:
  26585. // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
  26586. defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
  26587. d_1('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
  26588. var es6Symbol = isImplemented$4() ? Symbol : polyfill;
  26589. var objToString = Object.prototype.toString
  26590. , id = objToString.call(
  26591. (function () {
  26592. return arguments;
  26593. })()
  26594. );
  26595. var isArguments = function (value) {
  26596. return objToString.call(value) === id;
  26597. };
  26598. var objToString$1 = Object.prototype.toString, id$1 = objToString$1.call(noop);
  26599. var isFunction = function (value) {
  26600. return typeof value === "function" && objToString$1.call(value) === id$1;
  26601. };
  26602. var isImplemented$5 = function () {
  26603. var sign = Math.sign;
  26604. if (typeof sign !== "function") return false;
  26605. return (sign(10) === 1) && (sign(-20) === -1);
  26606. };
  26607. var shim$3 = function (value) {
  26608. value = Number(value);
  26609. if (isNaN(value) || (value === 0)) return value;
  26610. return value > 0 ? 1 : -1;
  26611. };
  26612. var sign = isImplemented$5()
  26613. ? Math.sign
  26614. : shim$3;
  26615. var abs = Math.abs, floor = Math.floor;
  26616. var toInteger = function (value) {
  26617. if (isNaN(value)) return 0;
  26618. value = Number(value);
  26619. if ((value === 0) || !isFinite(value)) return value;
  26620. return sign(value) * floor(abs(value));
  26621. };
  26622. var max$1 = Math.max;
  26623. var toPosInteger = function (value) {
  26624. return max$1(0, toInteger(value));
  26625. };
  26626. var objToString$2 = Object.prototype.toString, id$2 = objToString$2.call("");
  26627. var isString = function (value) {
  26628. return (
  26629. typeof value === "string" ||
  26630. (value &&
  26631. typeof value === "object" &&
  26632. (value instanceof String || objToString$2.call(value) === id$2)) ||
  26633. false
  26634. );
  26635. };
  26636. var iteratorSymbol = es6Symbol.iterator
  26637. , isArray = Array.isArray
  26638. , call = Function.prototype.call
  26639. , desc = { configurable: true, enumerable: true, writable: true, value: null }
  26640. , defineProperty$1 = Object.defineProperty;
  26641. // eslint-disable-next-line complexity
  26642. var shim$4 = function (arrayLike /*, mapFn, thisArg*/) {
  26643. var mapFn = arguments[1]
  26644. , thisArg = arguments[2]
  26645. , Context
  26646. , i
  26647. , j
  26648. , arr
  26649. , length
  26650. , code
  26651. , iterator
  26652. , result
  26653. , getIterator
  26654. , value;
  26655. arrayLike = Object(validValue(arrayLike));
  26656. if (isValue(mapFn)) validCallable(mapFn);
  26657. if (!this || this === Array || !isFunction(this)) {
  26658. // Result: Plain array
  26659. if (!mapFn) {
  26660. if (isArguments(arrayLike)) {
  26661. // Source: Arguments
  26662. length = arrayLike.length;
  26663. if (length !== 1) return Array.apply(null, arrayLike);
  26664. arr = new Array(1);
  26665. arr[0] = arrayLike[0];
  26666. return arr;
  26667. }
  26668. if (isArray(arrayLike)) {
  26669. // Source: Array
  26670. arr = new Array(length = arrayLike.length);
  26671. for (i = 0; i < length; ++i) arr[i] = arrayLike[i];
  26672. return arr;
  26673. }
  26674. }
  26675. arr = [];
  26676. } else {
  26677. // Result: Non plain array
  26678. Context = this;
  26679. }
  26680. if (!isArray(arrayLike)) {
  26681. if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
  26682. // Source: Iterator
  26683. iterator = validCallable(getIterator).call(arrayLike);
  26684. if (Context) arr = new Context();
  26685. result = iterator.next();
  26686. i = 0;
  26687. while (!result.done) {
  26688. value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
  26689. if (Context) {
  26690. desc.value = value;
  26691. defineProperty$1(arr, i, desc);
  26692. } else {
  26693. arr[i] = value;
  26694. }
  26695. result = iterator.next();
  26696. ++i;
  26697. }
  26698. length = i;
  26699. } else if (isString(arrayLike)) {
  26700. // Source: String
  26701. length = arrayLike.length;
  26702. if (Context) arr = new Context();
  26703. for (i = 0, j = 0; i < length; ++i) {
  26704. value = arrayLike[i];
  26705. if (i + 1 < length) {
  26706. code = value.charCodeAt(0);
  26707. // eslint-disable-next-line max-depth
  26708. if (code >= 0xd800 && code <= 0xdbff) value += arrayLike[++i];
  26709. }
  26710. value = mapFn ? call.call(mapFn, thisArg, value, j) : value;
  26711. if (Context) {
  26712. desc.value = value;
  26713. defineProperty$1(arr, j, desc);
  26714. } else {
  26715. arr[j] = value;
  26716. }
  26717. ++j;
  26718. }
  26719. length = j;
  26720. }
  26721. }
  26722. if (length === undefined) {
  26723. // Source: array or array-like
  26724. length = toPosInteger(arrayLike.length);
  26725. if (Context) arr = new Context(length);
  26726. for (i = 0; i < length; ++i) {
  26727. value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
  26728. if (Context) {
  26729. desc.value = value;
  26730. defineProperty$1(arr, i, desc);
  26731. } else {
  26732. arr[i] = value;
  26733. }
  26734. }
  26735. }
  26736. if (Context) {
  26737. desc.value = null;
  26738. arr.length = length;
  26739. }
  26740. return arr;
  26741. };
  26742. var from_1 = isImplemented$3()
  26743. ? Array.from
  26744. : shim$4;
  26745. var isImplemented$6 = function () {
  26746. var numberIsNaN = Number.isNaN;
  26747. if (typeof numberIsNaN !== "function") return false;
  26748. return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34);
  26749. };
  26750. var shim$5 = function (value) {
  26751. // eslint-disable-next-line no-self-compare
  26752. return value !== value;
  26753. };
  26754. var isNan = isImplemented$6()
  26755. ? Number.isNaN
  26756. : shim$5;
  26757. var indexOf$2 = Array.prototype.indexOf
  26758. , objHasOwnProperty = Object.prototype.hasOwnProperty
  26759. , abs$1 = Math.abs
  26760. , floor$1 = Math.floor;
  26761. var eIndexOf = function (searchElement /*, fromIndex*/) {
  26762. var i, length, fromIndex, val;
  26763. if (!isNan(searchElement)) return indexOf$2.apply(this, arguments);
  26764. length = toPosInteger(validValue(this).length);
  26765. fromIndex = arguments[1];
  26766. if (isNaN(fromIndex)) fromIndex = 0;
  26767. else if (fromIndex >= 0) fromIndex = floor$1(fromIndex);
  26768. else fromIndex = toPosInteger(this.length) - floor$1(abs$1(fromIndex));
  26769. for (i = fromIndex; i < length; ++i) {
  26770. if (objHasOwnProperty.call(this, i)) {
  26771. val = this[i];
  26772. if (isNan(val)) return i; // Jslint: ignore
  26773. }
  26774. }
  26775. return -1;
  26776. };
  26777. var forEach$1 = Array.prototype.forEach
  26778. , splice = Array.prototype.splice;
  26779. // eslint-disable-next-line no-unused-vars
  26780. var remove = function (itemToRemove /*, …item*/) {
  26781. forEach$1.call(
  26782. arguments,
  26783. function (item) {
  26784. var index = eIndexOf.call(this, item);
  26785. if (index !== -1) splice.call(this, index, 1);
  26786. },
  26787. this
  26788. );
  26789. };
  26790. var map = { function: true, object: true };
  26791. var isObject$1 = function (value) {
  26792. return (isValue(value) && map[typeof value]) || false;
  26793. };
  26794. var validObject = function (value) {
  26795. if (!isObject$1(value)) throw new TypeError(value + " is not an Object");
  26796. return value;
  26797. };
  26798. var emit = eventEmitter.methods.emit
  26799. , defineProperty$2 = Object.defineProperty
  26800. , hasOwnProperty$6 = Object.prototype.hasOwnProperty
  26801. , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  26802. var pipe = function (e1, e2/*, name*/) {
  26803. var pipes, pipe, desc, name;
  26804. (validObject(e1) && validObject(e2));
  26805. name = arguments[2];
  26806. if (name === undefined) name = 'emit';
  26807. pipe = {
  26808. close: function () { remove.call(pipes, e2); }
  26809. };
  26810. if (hasOwnProperty$6.call(e1, '__eePipes__')) {
  26811. (pipes = e1.__eePipes__).push(e2);
  26812. return pipe;
  26813. }
  26814. defineProperty$2(e1, '__eePipes__', d_1('c', pipes = [e2]));
  26815. desc = getOwnPropertyDescriptor(e1, name);
  26816. if (!desc) {
  26817. desc = d_1('c', undefined);
  26818. } else {
  26819. delete desc.get;
  26820. delete desc.set;
  26821. }
  26822. desc.value = function () {
  26823. var i, emitter, data = from_1(pipes);
  26824. emit.apply(this, arguments);
  26825. for (i = 0; (emitter = data[i]); ++i) emit.apply(emitter, arguments);
  26826. };
  26827. defineProperty$2(e1, name, desc);
  26828. return pipe;
  26829. };
  26830. let registeredHandlers = [...pagedMediaHandlers, ...generatedContentHandlers];
  26831. class Handlers {
  26832. constructor(chunker, polisher, caller) {
  26833. registeredHandlers.forEach((Handler) => {
  26834. let handler = new Handler(chunker, polisher, caller);
  26835. pipe(handler, this);
  26836. });
  26837. }
  26838. }
  26839. eventEmitter(Handlers.prototype);
  26840. function registerHandlers() {
  26841. for (var i = 0; i < arguments.length; i++) {
  26842. registeredHandlers.push(arguments[i]);
  26843. }
  26844. }
  26845. function initializeHandlers(chunker, polisher, caller) {
  26846. let handlers = new Handlers(chunker, polisher, caller);
  26847. return handlers;
  26848. }
  26849. class Previewer {
  26850. constructor(options) {
  26851. // this.preview = this.getParams("preview") !== "false";
  26852. this.settings = options || {};
  26853. // Process styles
  26854. this.polisher = new Polisher(false);
  26855. // Chunk contents
  26856. this.chunker = new Chunker(undefined, undefined, this.settings);
  26857. // Hooks
  26858. this.hooks = {};
  26859. this.hooks.beforePreview = new Hook(this);
  26860. this.hooks.afterPreview = new Hook(this);
  26861. // default size
  26862. this.size = {
  26863. width: {
  26864. value: 8.5,
  26865. unit: "in"
  26866. },
  26867. height: {
  26868. value: 11,
  26869. unit: "in"
  26870. },
  26871. format: undefined,
  26872. orientation: undefined
  26873. };
  26874. this.chunker.on("page", (page) => {
  26875. this.emit("page", page);
  26876. });
  26877. this.chunker.on("rendering", () => {
  26878. this.emit("rendering", this.chunker);
  26879. });
  26880. }
  26881. initializeHandlers() {
  26882. let handlers = initializeHandlers(this.chunker, this.polisher, this);
  26883. handlers.on("size", (size) => {
  26884. this.size = size;
  26885. this.emit("size", size);
  26886. });
  26887. handlers.on("atpages", (pages) => {
  26888. this.atpages = pages;
  26889. this.emit("atpages", pages);
  26890. });
  26891. return handlers;
  26892. }
  26893. registerHandlers() {
  26894. return registerHandlers.apply(registerHandlers, arguments);
  26895. }
  26896. getParams(name) {
  26897. let param;
  26898. let url = new URL(window.location);
  26899. let params = new URLSearchParams(url.search);
  26900. for(var pair of params.entries()) {
  26901. if(pair[0] === name) {
  26902. param = pair[1];
  26903. }
  26904. }
  26905. return param;
  26906. }
  26907. wrapContent() {
  26908. // Wrap body in template tag
  26909. let body = document.querySelector("body");
  26910. // Check if a template exists
  26911. let template;
  26912. template = body.querySelector(":scope > template[data-ref='pagedjs-content']");
  26913. if (!template) {
  26914. // Otherwise create one
  26915. template = document.createElement("template");
  26916. template.dataset.ref = "pagedjs-content";
  26917. template.innerHTML = body.innerHTML;
  26918. body.innerHTML = "";
  26919. body.appendChild(template);
  26920. }
  26921. return template.content;
  26922. }
  26923. removeStyles(doc=document) {
  26924. // Get all stylesheets
  26925. let stylesheets = Array.from(doc.querySelectorAll("link[rel='stylesheet']"));
  26926. let hrefs = stylesheets.map((sheet) => {
  26927. sheet.remove();
  26928. return sheet.href;
  26929. });
  26930. // Get inline styles
  26931. let inlineStyles = Array.from(doc.querySelectorAll("style:not([data-pagedjs-inserted-styles])"));
  26932. inlineStyles.forEach((inlineStyle) => {
  26933. let obj = {};
  26934. obj[window.location.href] = inlineStyle.textContent;
  26935. hrefs.push(obj);
  26936. inlineStyle.remove();
  26937. });
  26938. return hrefs;
  26939. }
  26940. async preview(content, stylesheets, renderTo) {
  26941. await this.hooks.beforePreview.trigger(content, renderTo);
  26942. if (!content) {
  26943. content = this.wrapContent();
  26944. }
  26945. if (!stylesheets) {
  26946. stylesheets = this.removeStyles();
  26947. }
  26948. this.polisher.setup();
  26949. this.handlers = this.initializeHandlers();
  26950. await this.polisher.add(...stylesheets);
  26951. let startTime = performance.now();
  26952. // Render flow
  26953. let flow = await this.chunker.flow(content, renderTo);
  26954. let endTime = performance.now();
  26955. flow.performance = (endTime - startTime);
  26956. flow.size = this.size;
  26957. this.emit("rendered", flow);
  26958. await this.hooks.afterPreview.trigger(flow.pages);
  26959. return flow;
  26960. }
  26961. }
  26962. eventEmitter(Previewer.prototype);
  26963. var Paged = /*#__PURE__*/Object.freeze({
  26964. __proto__: null,
  26965. Chunker: Chunker,
  26966. Polisher: Polisher,
  26967. Previewer: Previewer,
  26968. Handler: Handler,
  26969. registerHandlers: registerHandlers,
  26970. initializeHandlers: initializeHandlers
  26971. });
  26972. window.Paged = Paged;
  26973. let ready = new Promise(function(resolve, reject){
  26974. if (document.readyState === "interactive" || document.readyState === "complete") {
  26975. resolve(document.readyState);
  26976. return;
  26977. }
  26978. document.onreadystatechange = function ($) {
  26979. if (document.readyState === "interactive") {
  26980. resolve(document.readyState);
  26981. }
  26982. };
  26983. });
  26984. let config = window.PagedConfig || {
  26985. auto: true,
  26986. before: undefined,
  26987. after: undefined,
  26988. content: undefined,
  26989. stylesheets: undefined,
  26990. renderTo: undefined,
  26991. settings: undefined
  26992. };
  26993. let previewer = new Previewer(config.settings);
  26994. ready.then(async function () {
  26995. let done;
  26996. if (config.before) {
  26997. await config.before();
  26998. }
  26999. if(config.auto !== false) {
  27000. done = await previewer.preview(config.content, config.stylesheets, config.renderTo);
  27001. }
  27002. if (config.after) {
  27003. await config.after(done);
  27004. }
  27005. });
  27006. return previewer;
  27007. })));