You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2022/01/20 14:57:03 UTC
[myfaces-tobago] branch tobago-5.x updated: build: rebuild
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch tobago-5.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
The following commit(s) were added to refs/heads/tobago-5.x by this push:
new c8d853e build: rebuild
c8d853e is described below
commit c8d853e0c870899afd74649283ffc69d7b352479
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Thu Jan 20 15:56:20 2022 +0100
build: rebuild
---
.../tobago-example-demo/src/main/webapp/js/demo.js | 226 ++++++++++++++++-----
.../src/main/webapp/js/demo.js.map | 2 +-
.../tobago-theme-standard/src/main/js/tobago.js | 4 +-
.../src/main/js/tobago.js.map | 2 +-
4 files changed, 182 insertions(+), 52 deletions(-)
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/js/demo.js b/tobago-example/tobago-example-demo/src/main/webapp/js/demo.js
index 592e1d5..d7a5076 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/js/demo.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/js/demo.js
@@ -119,7 +119,7 @@
var Prism = (function (_self) {
// Private helper vars
- var lang = /\blang(?:uage)?-([\w-]+)\b/i;
+ var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
var uniqueId = 0;
// The grammar object for plaintext
@@ -149,6 +149,27 @@
* @public
*/
manual: _self.Prism && _self.Prism.manual,
+ /**
+ * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
+ * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
+ * own worker, you don't want it to do this.
+ *
+ * By setting this value to `true`, Prism will not add its own listeners to the worker.
+ *
+ * You obviously have to change this value before Prism executes. To do this, you can add an
+ * empty Prism object into the global scope before loading the Prism script like this:
+ *
+ * ```js
+ * window.Prism = window.Prism || {};
+ * Prism.disableWorkerMessageHandler = true;
+ * // Load Prism's script
+ * ```
+ *
+ * @default false
+ * @type {boolean}
+ * @memberof Prism
+ * @public
+ */
disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
/**
@@ -263,16 +284,34 @@
* @returns {string}
*/
getLanguage: function (element) {
- while (element && !lang.test(element.className)) {
+ while (element) {
+ var m = lang.exec(element.className);
+ if (m) {
+ return m[1].toLowerCase();
+ }
element = element.parentElement;
}
- if (element) {
- return (element.className.match(lang) || [, 'none'])[1].toLowerCase();
- }
return 'none';
},
/**
+ * Sets the Prism `language-xxxx` class of the given element.
+ *
+ * @param {Element} element
+ * @param {string} language
+ * @returns {void}
+ */
+ setLanguage: function (element, language) {
+ // remove all `language-xxxx` classes
+ // (this might leave behind a leading space)
+ element.className = element.className.replace(RegExp(lang, 'gi'), '');
+
+ // add the new `language-xxxx` class
+ // (using `classList` will automatically clean up spaces for us)
+ element.classList.add('language-' + language);
+ },
+
+ /**
* Returns the script element that is currently executing.
*
* This does __not__ work for line script element.
@@ -626,12 +665,12 @@
var grammar = _.languages[language];
// Set language on the element, if not present
- element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
+ _.util.setLanguage(element, language);
// Set language on the parent, for styling
var parent = element.parentElement;
if (parent && parent.nodeName.toLowerCase() === 'pre') {
- parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
+ _.util.setLanguage(parent, language);
}
var code = element.textContent;
@@ -1026,7 +1065,7 @@
if (greedy) {
match = matchPattern(pattern, pos, text, lookbehind);
- if (!match) {
+ if (!match || match.index >= text.length) {
break;
}
@@ -1602,14 +1641,14 @@
greedy: true
},
'class-name': {
- pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
lookbehind: true,
inside: {
'punctuation': /[.\\]/
}
},
- 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
- 'boolean': /\b(?:true|false)\b/,
+ 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
+ 'boolean': /\b(?:false|true)\b/,
'function': /\b\w+(?=\()/,
'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
@@ -1625,7 +1664,7 @@
'class-name': [
Prism.languages.clike['class-name'],
{
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
lookbehind: true
}
],
@@ -1641,11 +1680,38 @@
],
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
- 'number': /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,
+ 'number': {
+ pattern: RegExp(
+ /(^|[^\w$])/.source +
+ '(?:' +
+ (
+ // constant
+ /NaN|Infinity/.source +
+ '|' +
+ // binary integer
+ /0[bB][01]+(?:_[01]+)*n?/.source +
+ '|' +
+ // octal integer
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source +
+ '|' +
+ // hexadecimal integer
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
+ '|' +
+ // decimal bigint
+ /\d+(?:_\d+)*n/.source +
+ '|' +
+ // decimal number (integer or float) but no bigint
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
+ ) +
+ ')' +
+ /(?![\w$])/.source
+ ),
+ lookbehind: true
+ },
'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
});
- Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;
+ Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
Prism.languages.insertBefore('javascript', 'keyword', {
'regex': {
@@ -1721,9 +1787,23 @@
},
'string': /[\s\S]+/
}
+ },
+ 'string-property': {
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
+ lookbehind: true,
+ greedy: true,
+ alias: 'property'
}
});
+ Prism.languages.insertBefore('javascript', 'operator', {
+ 'literal-property': {
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
+ lookbehind: true,
+ alias: 'property'
+ },
+ });
+
if (Prism.languages.markup) {
Prism.languages.markup.tag.addInlined('script', 'javascript');
@@ -1779,21 +1859,57 @@
var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
+ ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
- var lang = /\blang(?:uage)?-([\w-]+)\b/i;
-
/**
- * Sets the Prism `language-xxxx` or `lang-xxxx` class to the given language.
+ * Loads the given file.
*
- * @param {HTMLElement} element
- * @param {string} language
- * @returns {void}
+ * @param {string} src The URL or path of the source file to load.
+ * @param {(result: string) => void} success
+ * @param {(reason: string) => void} error
*/
- function setLanguageClass(element, language) {
- var className = element.className;
- className = className.replace(lang, ' ') + ' language-' + language;
- element.className = className.replace(/\s+/g, ' ').trim();
+ function loadFile(src, success, error) {
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', src, true);
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState == 4) {
+ if (xhr.status < 400 && xhr.responseText) {
+ success(xhr.responseText);
+ } else {
+ if (xhr.status >= 400) {
+ error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
+ } else {
+ error(FAILURE_EMPTY_MESSAGE);
+ }
+ }
+ }
+ };
+ xhr.send(null);
}
+ /**
+ * Parses the given range.
+ *
+ * This returns a range with inclusive ends.
+ *
+ * @param {string | null | undefined} range
+ * @returns {[number, number | undefined] | undefined}
+ */
+ function parseRange(range) {
+ var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
+ if (m) {
+ var start = Number(m[1]);
+ var comma = m[2];
+ var end = m[3];
+
+ if (!comma) {
+ return [start, start];
+ }
+ if (!end) {
+ return [start, undefined];
+ }
+ return [start, Number(end)];
+ }
+ return undefined;
+ }
Prism.hooks.add('before-highlightall', function (env) {
env.selector += ', ' + SELECTOR;
@@ -1821,8 +1937,8 @@
}
// set language classes
- setLanguageClass(code, language);
- setLanguageClass(pre, language);
+ Prism.util.setLanguage(code, language);
+ Prism.util.setLanguage(pre, language);
// preload the language
var autoloader = Prism.plugins.autoloader;
@@ -1831,31 +1947,45 @@
}
// load file
- var xhr = new XMLHttpRequest();
- xhr.open('GET', src, true);
- xhr.onreadystatechange = function () {
- if (xhr.readyState == 4) {
- if (xhr.status < 400 && xhr.responseText) {
- // mark as loaded
- pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
-
- // highlight code
- code.textContent = xhr.responseText;
- Prism.highlightElement(code);
-
- } else {
- // mark as failed
- pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
-
- if (xhr.status >= 400) {
- code.textContent = FAILURE_MESSAGE(xhr.status, xhr.statusText);
- } else {
- code.textContent = FAILURE_EMPTY_MESSAGE;
+ loadFile(
+ src,
+ function (text) {
+ // mark as loaded
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
+
+ // handle data-range
+ var range = parseRange(pre.getAttribute('data-range'));
+ if (range) {
+ var lines = text.split(/\r\n?|\n/g);
+
+ // the range is one-based and inclusive on both ends
+ var start = range[0];
+ var end = range[1] == null ? lines.length : range[1];
+
+ if (start < 0) { start += lines.length; }
+ start = Math.max(0, Math.min(start - 1, lines.length));
+ if (end < 0) { end += lines.length; }
+ end = Math.max(0, Math.min(end, lines.length));
+
+ text = lines.slice(start, end).join('\n');
+
+ // add data-start for line numbers
+ if (!pre.hasAttribute('data-start')) {
+ pre.setAttribute('data-start', String(start + 1));
}
}
+
+ // highlight code
+ code.textContent = text;
+ Prism.highlightElement(code);
+ },
+ function (error) {
+ // mark as failed
+ pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
+
+ code.textContent = error;
}
- };
- xhr.send(null);
+ );
}
});
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/js/demo.js.map b/tobago-example/tobago-example-demo/src/main/webapp/js/demo.js.map
index a632d64..cc8e8e1 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/js/demo.js.map
+++ b/tobago-example/tobago-example-demo/src/main/webapp/js/demo.js.map
@@ -1 +1 @@
-{"version":3,"file":"demo.js","sources":["demo-alert.js","demo-copy-to-clipboard.js","../../../../node_modules/prismjs/prism.js","demo-highlight.js","demo-inspect.js","demo-login.js","demo-search.js","demo-test.js"],"sourcesContent":["/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You [...]
\ No newline at end of file
+{"version":3,"file":"demo.js","sources":["demo-alert.js","demo-copy-to-clipboard.js","../../../../node_modules/prismjs/prism.js","demo-highlight.js","demo-inspect.js","demo-login.js","demo-search.js","demo-test.js"],"sourcesContent":["/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You [...]
\ No newline at end of file
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
index 6048341..cc2737e 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
@@ -1,8 +1,8 @@
-!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";class e extends HTMLElement{constructor(){super(),this.CssClass={SHOW:"show",COLLAPSE:"collapse",COLLAPSING:"collapsing"},this.toggleButton.addEventListener("click",this.toggleCollapse.bind(this))}connectedCallback(){this.expanded="true"===this.toggleButton.ariaExpanded}toggleCollapse(e){window.clearTimeout(this.timeout),this.expanded?(this.expanded=!1,this.navbarContent.style.height=`${this.navbar [...]
+!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";class e extends HTMLElement{constructor(){super(),this.CssClass={SHOW:"show",COLLAPSE:"collapse",COLLAPSING:"collapsing"},this.toggleButton.addEventListener("click",this.toggleCollapse.bind(this))}connectedCallback(){this.expanded="true"===this.toggleButton.ariaExpanded}toggleCollapse(e){window.clearTimeout(this.timeout),this.expanded?(this.expanded=!1,this.navbarContent.style.height=`${this.navbar [...]
/*!
* Bootstrap v5.1.3 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
-const Ne="transitionend",Re=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let s=e.getAttribute("href");if(!s||!s.includes("#")&&!s.startsWith("."))return null;s.includes("#")&&!s.startsWith("#")&&(s=`#${s.split("#")[1]}`),t=s&&"#"!==s?s.trim():null}return t},De=e=>{const t=Re(e);return t&&document.querySelector(t)?t:null},Me=e=>{const t=Re(e);return t?document.querySelector(t):null},je=e=>{e.dispatchEvent(new Event(Ne))},He=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&( [...]
+const Ne="transitionend",Re=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let s=e.getAttribute("href");if(!s||!s.includes("#")&&!s.startsWith("."))return null;s.includes("#")&&!s.startsWith("#")&&(s=`#${s.split("#")[1]}`),t=s&&"#"!==s?s.trim():null}return t},De=e=>{const t=Re(e);return t&&document.querySelector(t)?t:null},Me=e=>{const t=Re(e);return t?document.querySelector(t):null},je=e=>{e.dispatchEvent(new Event(Ne))},He=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&( [...]
//# sourceMappingURL=tobago.js.map
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
index 5fd09a1..ec77d20 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
@@ -1 +1 @@
-{"version":3,"file":"tobago.js","sources":["../ts/tobago-bar.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../../node_m [...]
\ No newline at end of file
+{"version":3,"file":"tobago.js","sources":["../ts/tobago-bar.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../../node_m [...]
\ No newline at end of file