jsf.js_next_gen 4.0.0-beta-19 → 4.0.0-beta-21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/docs/functions/faces.ajax.addOnError.html +1 -1
  2. package/dist/docs/functions/faces.ajax.addOnEvent.html +1 -1
  3. package/dist/docs/functions/faces.ajax.request.html +1 -1
  4. package/dist/docs/functions/faces.ajax.response.html +1 -1
  5. package/dist/docs/functions/faces.getClientWindow.html +1 -1
  6. package/dist/docs/functions/faces.getProjectStage.html +1 -1
  7. package/dist/docs/functions/faces.getViewState.html +1 -1
  8. package/dist/docs/functions/faces.push.close.html +1 -1
  9. package/dist/docs/functions/faces.push.init.html +1 -1
  10. package/dist/docs/functions/faces.push.open.html +1 -1
  11. package/dist/docs/functions/faces.util.chain.html +1 -1
  12. package/dist/docs/functions/myfaces.ab.html +1 -1
  13. package/dist/docs/index.html +1 -1
  14. package/dist/docs/modules/faces.ajax.html +1 -1
  15. package/dist/docs/modules/faces.html +1 -1
  16. package/dist/docs/modules/faces.push.html +1 -1
  17. package/dist/docs/modules/faces.util.html +1 -1
  18. package/dist/docs/modules/myfaces.html +1 -1
  19. package/dist/docs/modules.html +1 -1
  20. package/dist/docs/variables/faces.contextpath.html +1 -1
  21. package/dist/docs/variables/faces.implversion.html +1 -1
  22. package/dist/docs/variables/faces.separatorchar.html +1 -1
  23. package/dist/docs/variables/faces.specversion.html +1 -1
  24. package/dist/docs/variables/myfaces.oam.html +1 -1
  25. package/dist/window/faces-development.js +282 -47
  26. package/dist/window/faces-development.js.br +0 -0
  27. package/dist/window/faces-development.js.gz +0 -0
  28. package/dist/window/faces-development.js.map +1 -1
  29. package/dist/window/faces.js +1 -1
  30. package/dist/window/faces.js.br +0 -0
  31. package/dist/window/faces.js.gz +0 -0
  32. package/dist/window/faces.js.map +1 -1
  33. package/dist/window/jsf-development.js +282 -47
  34. package/dist/window/jsf-development.js.br +0 -0
  35. package/dist/window/jsf-development.js.gz +0 -0
  36. package/dist/window/jsf-development.js.map +1 -1
  37. package/dist/window/jsf.js +1 -1
  38. package/dist/window/jsf.js.br +0 -0
  39. package/dist/window/jsf.js.gz +0 -0
  40. package/dist/window/jsf.js.map +1 -1
  41. package/package.json +6 -6
  42. package/src/main/typescript/impl/core/Const.ts +6 -0
  43. package/src/main/typescript/impl/util/ExtDomQuery.ts +61 -3
  44. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +8 -0
  45. package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +3 -1
  46. package/src/main/typescript/impl/xhrCore/Response.ts +6 -2
  47. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +26 -4
  48. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +283 -68
  49. package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/test.js +1 -0
  50. package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/test2.js +1 -0
  51. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +15 -2
  52. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +34 -0
  53. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +47 -2
  54. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +1 -1
  55. package/src/main/typescript/test/xhrCore/fixtures/addedViewHead1.js +1 -0
  56. package/src/main/typescript/test/xhrCore/fixtures/addedViewHead2.css +3 -0
  57. package/src/main/typescript/test/xhrCore/fixtures/addedViewHead2.js +1 -0
  58. package/src/main/typescript/test/xhrCore/fixtures/addedViewHead3.js +3 -0
  59. package/src/test.html +75 -0
  60. package/target/impl/core/Const.js +7 -3
  61. package/target/impl/core/Const.js.map +1 -1
  62. package/target/impl/util/ExtDomQuery.js +49 -2
  63. package/target/impl/util/ExtDomQuery.js.map +1 -1
  64. package/target/impl/xhrCore/ResonseDataResolver.js +1 -0
  65. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
  66. package/target/impl/xhrCore/Response.js +3 -0
  67. package/target/impl/xhrCore/Response.js.map +1 -1
  68. package/target/impl/xhrCore/ResponseProcessor.js +18 -3
  69. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  70. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +243 -83
  71. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  72. package/target/test/frameworkBase/_ext/shared/StandardInits.js +15 -2
  73. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  74. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +32 -0
  75. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  76. package/target/test/xhrCore/ResponseTest.spec.js +38 -2
  77. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  78. package/target/test/xhrCore/ResponseTest23.spec.js +0 -1
  79. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
@@ -44,6 +44,7 @@ var trim = Lang_1.Lang.trim;
44
44
  var objToArray = Lang_1.Lang.objToArray;
45
45
  var isString = Lang_1.Lang.isString;
46
46
  var equalsIgnoreCase = Lang_1.Lang.equalsIgnoreCase;
47
+ const Global_1 = __webpack_require__(/*! ./Global */ "./node_modules/mona-dish/src/main/typescript/Global.ts");
47
48
  /**
48
49
  *
49
50
  * // - submit checkboxes and radio inputs only if checked
@@ -68,7 +69,13 @@ var Submittables;
68
69
  * @param condition the condition lambda to be fulfilled
69
70
  * @param options options for the search
70
71
  */
71
- function waitUntilDom(root, condition, options = { attributes: true, childList: true, subtree: true, timeout: 500, interval: 100 }) {
72
+ function waitUntilDom(root, condition, options = {
73
+ attributes: true,
74
+ childList: true,
75
+ subtree: true,
76
+ timeout: 500,
77
+ interval: 100
78
+ }) {
72
79
  return new Promise((success, error) => {
73
80
  let observer = null;
74
81
  const MUT_ERROR = new Error("Mutation observer timeout");
@@ -108,7 +115,7 @@ function waitUntilDom(root, condition, options = { attributes: true, childList:
108
115
  success(new DomQuery(found || root));
109
116
  }
110
117
  };
111
- observer = new window.MutationObserver(callback);
118
+ observer = new MutationObserver(callback);
112
119
  // browsers might ignore it, but we cannot break the api in the case
113
120
  // hence no timeout is passed
114
121
  let observableOpts = Object.assign({}, options);
@@ -263,6 +270,9 @@ class DomQuery {
263
270
  get values() {
264
271
  return this.allElems();
265
272
  }
273
+ get global() {
274
+ return Global_1._global$;
275
+ }
266
276
  /**
267
277
  * returns the id of the first element
268
278
  */
@@ -493,6 +503,9 @@ class DomQuery {
493
503
  static globalEval(code, nonce) {
494
504
  return new DomQuery(document).globalEval(code, nonce);
495
505
  }
506
+ static globalEvalSticky(code, nonce) {
507
+ return new DomQuery(document).globalEvalSticky(code, nonce);
508
+ }
496
509
  /**
497
510
  * builds the ie nodes properly in a placeholder
498
511
  * and bypasses a non script insert bug that way
@@ -816,7 +829,7 @@ class DomQuery {
816
829
  prot.oMatchesSelector ||
817
830
  prot.webkitMatchesSelector ||
818
831
  function (s) {
819
- let matches = (document || window.ownerDocument).querySelectorAll(s), i = matches.length;
832
+ let matches = (document || ownerDocument).querySelectorAll(s), i = matches.length;
820
833
  while (--i >= 0 && matches.item(i) !== toMatch) {
821
834
  }
822
835
  return i > -1;
@@ -961,6 +974,28 @@ class DomQuery {
961
974
  head.removeChild(newScriptElement);
962
975
  return this;
963
976
  }
977
+ /**
978
+ * global eval head appendix method
979
+ * no other methods are supported anymore
980
+ * @param code the code to be evaled
981
+ * @param nonce optional nonce key for higher security
982
+ */
983
+ globalEvalSticky(code, nonce) {
984
+ let head = document.getElementsByTagName("head")[0] || document.documentElement;
985
+ let script = document.createElement("script");
986
+ if (nonce) {
987
+ if ('undefined' != typeof (script === null || script === void 0 ? void 0 : script.nonce)) {
988
+ script.nonce = nonce;
989
+ }
990
+ else {
991
+ script.setAttribute("nonce", nonce);
992
+ }
993
+ }
994
+ script.type = "text/javascript";
995
+ script.innerHTML = code;
996
+ head.appendChild(script);
997
+ return this;
998
+ }
964
999
  /**
965
1000
  * detaches a set of nodes from their parent elements
966
1001
  * in a browser independend manner
@@ -1001,32 +1036,37 @@ class DomQuery {
1001
1036
  * @param charSet
1002
1037
  */
1003
1038
  loadScriptEval(src, defer = 0, charSet = "utf-8", nonce) {
1004
- let xhr = new XMLHttpRequest();
1005
- xhr.open("GET", src, false);
1006
- if (charSet) {
1007
- xhr.setRequestHeader("Content-Type", "application/x-javascript; charset:" + charSet);
1008
- }
1009
- xhr.onload = () => {
1010
- //defer also means we have to process after the ajax response
1011
- //has been processed
1012
- //we can achieve that with a small timeout, the timeout
1013
- //triggers after the processing is done!
1014
- if (!defer) {
1015
- this.globalEval(xhr.responseText.replace(/\n/g, "\r\n") + "\r\n//@ sourceURL=" + src, nonce);
1016
- }
1017
- else {
1018
- //TODO not ideal we maybe ought to move to something else here
1019
- //but since it is not in use yet, it is ok
1020
- setTimeout(() => {
1021
- this.globalEval(xhr.responseText + "\r\n//@ sourceURL=" + src, nonce);
1022
- }, defer);
1023
- }
1024
- };
1025
- xhr.onerror = (data) => {
1026
- throw Error(data);
1027
- };
1028
- //since we are synchronous we do it after not with onReadyStateChange
1029
- xhr.send(null);
1039
+ let srcNode = this.createSourceNode(src, nonce);
1040
+ let head = document.head;
1041
+ if (!defer) {
1042
+ head.appendChild(srcNode);
1043
+ head.removeChild(srcNode);
1044
+ }
1045
+ else {
1046
+ setTimeout(() => {
1047
+ head.appendChild(srcNode);
1048
+ head.removeChild(srcNode);
1049
+ }, defer);
1050
+ }
1051
+ return this;
1052
+ }
1053
+ /**
1054
+ * loads and evals a script from a source uri
1055
+ *
1056
+ * @param src the source to be loaded and evaled
1057
+ * @param defer in miliseconds execution default (0 == no defer)
1058
+ * @param charSet
1059
+ */
1060
+ loadScriptEvalSticky(src, defer = 0, charSet = "utf-8", nonce) {
1061
+ let srcNode = this.createSourceNode(src, nonce);
1062
+ if (!defer) {
1063
+ document.head.appendChild(srcNode);
1064
+ }
1065
+ else {
1066
+ setTimeout(() => {
1067
+ document.head.appendChild(srcNode);
1068
+ }, defer);
1069
+ }
1030
1070
  return this;
1031
1071
  }
1032
1072
  insertAfter(...toInsertParams) {
@@ -1189,10 +1229,11 @@ class DomQuery {
1189
1229
  }
1190
1230
  /**
1191
1231
  * Run through the given nodes in the DomQuery execute the inline scripts
1232
+ * @param sticky if set to true the evaled elements will stick to the head, default false
1192
1233
  * @param whilteListed: optional whitelist function which can filter out script tags which are not processed
1193
1234
  * defaults to the standard jsf.js exclusion (we use this code for myfaces)
1194
1235
  */
1195
- runScripts(whilteListed = DEFAULT_WHITELIST) {
1236
+ runScripts(sticky = false, whilteListed = DEFAULT_WHITELIST) {
1196
1237
  const evalCollectedScripts = (scriptsToProcess) => {
1197
1238
  if (scriptsToProcess.length) {
1198
1239
  //script source means we have to eval the existing
@@ -1208,11 +1249,14 @@ class DomQuery {
1208
1249
  this.globalEval(joinedScripts.join("\n"));
1209
1250
  joinedScripts.length = 0;
1210
1251
  }
1211
- this.globalEval(item.evalText, item.nonce);
1252
+ (!sticky) ?
1253
+ this.globalEval(item.evalText, item.nonce) :
1254
+ this.globalEvalSticky(item.evalText, item.nonce);
1212
1255
  }
1213
1256
  });
1214
1257
  if (joinedScripts.length) {
1215
- this.globalEval(joinedScripts.join("\n"));
1258
+ (!sticky) ? this.globalEval(joinedScripts.join("\n")) :
1259
+ this.globalEvalSticky(joinedScripts.join("\n"));
1216
1260
  joinedScripts.length = 0;
1217
1261
  }
1218
1262
  scriptsToProcess = [];
@@ -1239,9 +1283,16 @@ class DomQuery {
1239
1283
  if (whilteListed(src)) {
1240
1284
  //we run the collected scripts before running, the include
1241
1285
  finalScripts = evalCollectedScripts(finalScripts);
1242
- (!!nonce) ? this.loadScriptEval(src, 0, "UTF-8", nonce) :
1243
- //if no nonce is set we do not pass any once
1244
- this.loadScriptEval(src, 0, "UTF-8");
1286
+ if (!sticky) {
1287
+ (!!nonce) ? this.loadScriptEval(src, 0, "UTF-8", nonce) :
1288
+ //if no nonce is set we do not pass any once
1289
+ this.loadScriptEval(src, 0, "UTF-8");
1290
+ }
1291
+ else {
1292
+ (!!nonce) ? this.loadScriptEvalSticky(src, 0, "UTF-8", nonce) :
1293
+ //if no nonce is set we do not pass any once
1294
+ this.loadScriptEvalSticky(src, 0, "UTF-8");
1295
+ }
1245
1296
  }
1246
1297
  }
1247
1298
  else {
@@ -1589,7 +1640,13 @@ class DomQuery {
1589
1640
  * @param condition
1590
1641
  * @param options
1591
1642
  */
1592
- waitUntilDom(condition, options = { attributes: true, childList: true, subtree: true, timeout: 500, interval: 100 }) {
1643
+ waitUntilDom(condition, options = {
1644
+ attributes: true,
1645
+ childList: true,
1646
+ subtree: true,
1647
+ timeout: 500,
1648
+ interval: 100
1649
+ }) {
1593
1650
  return __awaiter(this, void 0, void 0, function* () {
1594
1651
  return waitUntilDom(this, condition, options);
1595
1652
  });
@@ -1705,9 +1762,56 @@ class DomQuery {
1705
1762
  });
1706
1763
  return this;
1707
1764
  }
1765
+ /*[observable](): Observable<DomQuery> {
1766
+ return this.observable;
1767
+ }
1768
+
1769
+ get observable(): Observable<DomQuery> {
1770
+ let observerFunc = (observer:Subscriber<DomQuery>) => {
1771
+ try {
1772
+ this.each(dqNode => {
1773
+ observer.next(dqNode);
1774
+ });
1775
+ } catch (e) {
1776
+ observer.error(e);
1777
+ }
1778
+ };
1779
+ return new Observable(observerFunc);
1780
+ }
1781
+
1782
+ get observableElem(): Observable<Element> {
1783
+ let observerFunc = (observer:Subscriber<Element>) => {
1784
+ try {
1785
+ this.eachElem(node => {
1786
+ observer.next(node);
1787
+ });
1788
+ } catch (e) {
1789
+ observer.error(e);
1790
+ }
1791
+ };
1792
+ return new Observable(observerFunc);
1793
+ }*/
1794
+ createSourceNode(src, nonce) {
1795
+ let srcNode = document.createElement("script");
1796
+ srcNode.type = "text/javascript";
1797
+ if (!!nonce) {
1798
+ if ('undefined' != typeof (srcNode === null || srcNode === void 0 ? void 0 : srcNode.nonce)) {
1799
+ srcNode.nonce = nonce;
1800
+ }
1801
+ else {
1802
+ srcNode.setAttribute("nonce", nonce);
1803
+ }
1804
+ }
1805
+ srcNode.src = src;
1806
+ return srcNode;
1807
+ }
1708
1808
  }
1709
1809
  exports.DomQuery = DomQuery;
1710
1810
  DomQuery.absent = new DomQuery();
1811
+ /**
1812
+ * reference to the environmental global object
1813
+ */
1814
+ DomQuery.global = Global_1._global$;
1711
1815
  /**
1712
1816
  * Various collectors
1713
1817
  * which can be used in conjunction with Streams
@@ -1740,6 +1844,53 @@ exports.DQ = DomQuery;
1740
1844
  exports.DQ$ = DomQuery.querySelectorAll;
1741
1845
 
1742
1846
 
1847
+ /***/ }),
1848
+
1849
+ /***/ "./node_modules/mona-dish/src/main/typescript/Global.ts":
1850
+ /*!**************************************************************!*\
1851
+ !*** ./node_modules/mona-dish/src/main/typescript/Global.ts ***!
1852
+ \**************************************************************/
1853
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1854
+
1855
+
1856
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1857
+ exports._global$ = void 0;
1858
+ /*!
1859
+ * Licensed to the Apache Software Foundation (ASF) under one
1860
+ * or more contributor license agreements. See the NOTICE file
1861
+ * distributed with this work for additional information
1862
+ * regarding copyright ownership. The ASF licenses this file
1863
+ * to you under the Apache License, Version 2.0 (the
1864
+ * "License"); you may not use this file except in compliance
1865
+ * with the License. You may obtain a copy of the License at
1866
+ *
1867
+ * http://www.apache.org/licenses/LICENSE-2.0
1868
+ *
1869
+ * Unless required by applicable law or agreed to in writing,
1870
+ * software distributed under the License is distributed on an
1871
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1872
+ * KIND, either express or implied. See the License for the
1873
+ * specific language governing permissions and limitations
1874
+ * under the License.
1875
+ */
1876
+ /**
1877
+ * various environments handle the global variable different
1878
+ * we have to deal with this.
1879
+ */
1880
+ function _global$() {
1881
+ var _a;
1882
+ let _global$ = ('undefined' != typeof globalThis && globalThis.window) ? globalThis.window :
1883
+ ('undefined' != typeof window) ? window :
1884
+ ('undefined' != typeof globalThis) ? globalThis :
1885
+ ('undefined' != typeof __webpack_require__.g && (__webpack_require__.g === null || __webpack_require__.g === void 0 ? void 0 : __webpack_require__.g.window)) ? __webpack_require__.g.window :
1886
+ ('undefined' != typeof __webpack_require__.g) ? __webpack_require__.g : null;
1887
+ //under test systems we often have a lazy init of the window object under global.window, but we
1888
+ //want the window object
1889
+ return (_a = _global$ === null || _global$ === void 0 ? void 0 : _global$.window) !== null && _a !== void 0 ? _a : _global$;
1890
+ }
1891
+ exports._global$ = _global$;
1892
+
1893
+
1743
1894
  /***/ }),
1744
1895
 
1745
1896
  /***/ "./node_modules/mona-dish/src/main/typescript/Lang.ts":
@@ -3392,6 +3543,7 @@ exports.XQ = exports.XMLQuery = void 0;
3392
3543
  const Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
3393
3544
  const DomQuery_1 = __webpack_require__(/*! ./DomQuery */ "./node_modules/mona-dish/src/main/typescript/DomQuery.ts");
3394
3545
  var isString = Lang_1.Lang.isString;
3546
+ const Global_1 = __webpack_require__(/*! ./Global */ "./node_modules/mona-dish/src/main/typescript/Global.ts");
3395
3547
  /**
3396
3548
  * xml query as specialized case for DomQuery
3397
3549
  */
@@ -3413,7 +3565,7 @@ class XMLQuery extends DomQuery_1.DomQuery {
3413
3565
  if (xml == null) {
3414
3566
  return null;
3415
3567
  }
3416
- let domParser = Lang_1.Lang.saveResolveLazy(() => new window.DOMParser(), () => createIe11DomQueryShim()).value;
3568
+ let domParser = Lang_1.Lang.saveResolveLazy(() => new ((0, Global_1._global$)()).DOMParser(), () => createIe11DomQueryShim()).value;
3417
3569
  return domParser.parseFromString(xml, docType);
3418
3570
  };
3419
3571
  if (isString(rootNode)) {
@@ -3429,8 +3581,8 @@ class XMLQuery extends DomQuery_1.DomQuery {
3429
3581
  toString() {
3430
3582
  let ret = [];
3431
3583
  this.eachElem((node) => {
3432
- var _a, _b, _c;
3433
- let serialized = (_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.XMLSerializer) === null || _a === void 0 ? void 0 : _a.constructor()) === null || _b === void 0 ? void 0 : _b.serializeToString(node)) !== null && _c !== void 0 ? _c : node === null || node === void 0 ? void 0 : node.xml;
3584
+ var _a, _b, _c, _d;
3585
+ let serialized = (_d = (_c = (_b = (_a = ((0, Global_1._global$)())) === null || _a === void 0 ? void 0 : _a.XMLSerializer) === null || _b === void 0 ? void 0 : _b.constructor()) === null || _c === void 0 ? void 0 : _c.serializeToString(node)) !== null && _d !== void 0 ? _d : node === null || node === void 0 ? void 0 : node.xml;
3434
3586
  if (!!serialized) {
3435
3587
  ret.push(serialized);
3436
3588
  }
@@ -4673,9 +4825,9 @@ var PushImpl;
4673
4825
  * limitations under the License.
4674
4826
  */
4675
4827
  Object.defineProperty(exports, "__esModule", ({ value: true }));
4676
- exports.CTX_PARAM_TIMEOUT = exports.CTX_PARAM_DELAY = exports.CTX_PARAM_PASS_THR = exports.CTX_PARAM_TR_TYPE = exports.CTX_PARAM_SRC_CTL_ID = exports.CTX_PARAM_SRC_FRM_ID = exports.CTX_PARAM_MF_INTERNAL = exports.TIMEOUT_EVENT = exports.CLIENT_ERROR = exports.SERVER_ERROR = exports.MALFORMEDXML = exports.EMPTY_RESPONSE = exports.HTTPERROR = exports.RESPONSE_XML = exports.RESPONSE_TEXT = exports.ERROR_MESSAGE = exports.ERROR_NAME = exports.STATUS = exports.SOURCE = exports.SUCCESS = exports.COMPLETE = exports.BEGIN = exports.ON_EVENT = exports.ON_ERROR = exports.EVENT = exports.ERROR = exports.WINDOW_ID = exports.CTX_PARAM_RENDER = exports.P_BEHAVIOR_EVENT = exports.P_WINDOW_ID = exports.P_RESET_VALUES = exports.P_CLIENT_WINDOW = exports.P_EVT = exports.P_RENDER = exports.P_EXECUTE = exports.P_AJAX = exports.IDENT_FORM = exports.IDENT_THIS = exports.IDENT_NONE = exports.IDENT_ALL = exports.HTML_VIEWSTATE = exports.EMPTY_MAP = exports.EMPTY_STR = exports.EMPTY_FUNC = exports.P_VIEWBODY = exports.P_VIEWHEAD = exports.P_VIEWROOT = exports.P_VIEWSTATE = exports.PARTIAL_ID = exports.P_PARTIAL_SOURCE = void 0;
4677
- exports.APPLIED_CLIENT_WINDOW = exports.APPLIED_VST = exports.REASON_EXPIRED = exports.MF_NONE = exports.SEL_SCRIPTS_STYLES = exports.MYFACES = exports.UPDATE_ELEMS = exports.UPDATE_FORMS = exports.CMD_REDIRECT = exports.CMD_EXTENSION = exports.CMD_ATTRIBUTES = exports.CMD_ERROR = exports.CMD_EVAL = exports.CMD_INSERT = exports.CMD_DELETE = exports.CMD_UPDATE = exports.CMD_CHANGES = exports.RESP_PARTIAL = exports.ATTR_ID = exports.ATTR_VALUE = exports.ATTR_NAME = exports.ATTR_URL = exports.ERR_NO_PARTIAL_RESPONSE = exports.PHASE_PROCESS_RESPONSE = exports.SEL_RESPONSE_XML = exports.SEL_CLIENT_WINDOW_ELEM = exports.SEL_VIEWSTATE_ELEM = exports.TAG_ATTR = exports.TAG_AFTER = exports.TAG_BEFORE = exports.TAG_BODY = exports.TAG_FORM = exports.TAG_HEAD = exports.STD_ACCEPT = exports.NO_TIMEOUT = exports.MULTIPART = exports.URL_ENCODED = exports.STATE_EVT_COMPLETE = exports.STATE_EVT_TIMEOUT = exports.STATE_EVT_BEGIN = exports.REQ_TYPE_POST = exports.REQ_TYPE_GET = exports.ENCODED_URL = exports.VAL_AJAX = exports.REQ_ACCEPT = exports.HEAD_FACES_REQ = exports.CONTENT_TYPE = exports.STAGE_DEVELOPMENT = exports.CTX_PARAM_EXECUTE = exports.CTX_PARAM_RST = void 0;
4678
- exports.$nsp = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS = exports.RECONNECT_INTERVAL = void 0;
4828
+ exports.CTX_PARAM_DELAY = exports.CTX_PARAM_PASS_THR = exports.CTX_PARAM_TR_TYPE = exports.CTX_PARAM_SRC_CTL_ID = exports.CTX_PARAM_SRC_FRM_ID = exports.CTX_PARAM_MF_INTERNAL = exports.TIMEOUT_EVENT = exports.CLIENT_ERROR = exports.SERVER_ERROR = exports.MALFORMEDXML = exports.EMPTY_RESPONSE = exports.HTTPERROR = exports.RESPONSE_XML = exports.RESPONSE_TEXT = exports.ERROR_MESSAGE = exports.ERROR_NAME = exports.STATUS = exports.SOURCE = exports.SUCCESS = exports.COMPLETE = exports.BEGIN = exports.ON_EVENT = exports.ON_ERROR = exports.EVENT = exports.ERROR = exports.WINDOW_ID = exports.CTX_PARAM_RENDER = exports.P_BEHAVIOR_EVENT = exports.P_WINDOW_ID = exports.P_RESET_VALUES = exports.P_CLIENT_WINDOW = exports.P_EVT = exports.P_RENDER = exports.P_EXECUTE = exports.P_AJAX = exports.IDENT_FORM = exports.IDENT_THIS = exports.IDENT_NONE = exports.IDENT_ALL = exports.HTML_VIEWSTATE = exports.EMPTY_MAP = exports.EMPTY_STR = exports.EMPTY_FUNC = exports.P_RESOURCE = exports.P_VIEWBODY = exports.P_VIEWHEAD = exports.P_VIEWROOT = exports.P_VIEWSTATE = exports.PARTIAL_ID = exports.P_PARTIAL_SOURCE = void 0;
4829
+ exports.REASON_EXPIRED = exports.MF_NONE = exports.SEL_SCRIPTS_STYLES = exports.MYFACES = exports.DEFERRED_HEAD_INSERTS = exports.UPDATE_ELEMS = exports.UPDATE_FORMS = exports.CMD_REDIRECT = exports.CMD_EXTENSION = exports.CMD_ATTRIBUTES = exports.CMD_ERROR = exports.CMD_EVAL = exports.CMD_INSERT = exports.CMD_DELETE = exports.CMD_UPDATE = exports.CMD_CHANGES = exports.RESP_PARTIAL = exports.ATTR_ID = exports.ATTR_VALUE = exports.ATTR_NAME = exports.ATTR_URL = exports.ERR_NO_PARTIAL_RESPONSE = exports.PHASE_PROCESS_RESPONSE = exports.SEL_RESPONSE_XML = exports.SEL_CLIENT_WINDOW_ELEM = exports.SEL_VIEWSTATE_ELEM = exports.TAG_ATTR = exports.TAG_AFTER = exports.TAG_BEFORE = exports.TAG_BODY = exports.TAG_FORM = exports.TAG_HEAD = exports.STD_ACCEPT = exports.NO_TIMEOUT = exports.MULTIPART = exports.URL_ENCODED = exports.STATE_EVT_COMPLETE = exports.STATE_EVT_TIMEOUT = exports.STATE_EVT_BEGIN = exports.REQ_TYPE_POST = exports.REQ_TYPE_GET = exports.ENCODED_URL = exports.VAL_AJAX = exports.REQ_ACCEPT = exports.HEAD_FACES_REQ = exports.CONTENT_TYPE = exports.STAGE_DEVELOPMENT = exports.CTX_PARAM_EXECUTE = exports.CTX_PARAM_RST = exports.CTX_PARAM_TIMEOUT = void 0;
4830
+ exports.$nsp = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS = exports.RECONNECT_INTERVAL = exports.APPLIED_CLIENT_WINDOW = exports.APPLIED_VST = void 0;
4679
4831
  /*
4680
4832
  * [export const] constants
4681
4833
  */
@@ -4685,6 +4837,7 @@ exports.P_VIEWSTATE = "jakarta.faces.ViewState";
4685
4837
  exports.P_VIEWROOT = "jakarta.faces.ViewRoot";
4686
4838
  exports.P_VIEWHEAD = "jakarta.faces.ViewHead";
4687
4839
  exports.P_VIEWBODY = "jakarta.faces.ViewBody";
4840
+ exports.P_RESOURCE = "jakarta.faces.Resource";
4688
4841
  /*some useful definitions*/
4689
4842
  exports.EMPTY_FUNC = Object.freeze(() => {
4690
4843
  });
@@ -4782,6 +4935,9 @@ exports.CMD_REDIRECT = "redirect";
4782
4935
  /*other constants*/
4783
4936
  exports.UPDATE_FORMS = "_updateForms";
4784
4937
  exports.UPDATE_ELEMS = "_updateElems";
4938
+ //we want the head elements to be processed before we process the body
4939
+ //but after the inner html is done
4940
+ exports.DEFERRED_HEAD_INSERTS = "_headElems";
4785
4941
  exports.MYFACES = "myfaces";
4786
4942
  exports.SEL_SCRIPTS_STYLES = "script, style, link";
4787
4943
  exports.MF_NONE = "__mf_none__";
@@ -5352,17 +5508,64 @@ class ExtDomquery extends mona_dish_1.DQ {
5352
5508
  globalEval(code, nonce) {
5353
5509
  return new ExtDomquery(super.globalEval(code, nonce !== null && nonce !== void 0 ? nonce : this.nonce));
5354
5510
  }
5511
+ globalEvalSticky(code, nonce) {
5512
+ return new ExtDomquery(super.globalEvalSticky(code, nonce !== null && nonce !== void 0 ? nonce : this.nonce));
5513
+ }
5355
5514
  /**
5356
5515
  * decorated run scripts which takes our jsf extensions into consideration
5357
5516
  * (standard DomQuery will let you pass anything)
5358
5517
  * @param whilteListed
5359
5518
  */
5360
- runScripts(whilteListed) {
5519
+ runScripts(sticky = false, whilteListed) {
5361
5520
  const whitelistFunc = (src) => {
5362
5521
  var _a;
5363
5522
  return ((_a = whilteListed === null || whilteListed === void 0 ? void 0 : whilteListed(src)) !== null && _a !== void 0 ? _a : true) && !IS_FACES_SOURCE(src) && !IS_INTERNAL_SOURCE(src);
5364
5523
  };
5365
- return super.runScripts(whitelistFunc);
5524
+ return super.runScripts(sticky, whitelistFunc);
5525
+ }
5526
+ /**
5527
+ * adds the elements in this ExtDomQuery to the head
5528
+ *
5529
+ * @param newElements the elements which need addition
5530
+ */
5531
+ runHeadInserts(suppressDoubleIncludes = true) {
5532
+ let head = ExtDomquery.byId(document.head);
5533
+ //automated nonce handling
5534
+ let processedScripts = [];
5535
+ // the idea is only to run head inserts on resources
5536
+ // which do not exist already, that way
5537
+ // we can avoid double includes on subsequent resource
5538
+ // requests.
5539
+ function resourceIsNew(element) {
5540
+ if (!suppressDoubleIncludes) {
5541
+ return true;
5542
+ }
5543
+ const tagName = element.tagName.value;
5544
+ if (!tagName) {
5545
+ // textnode
5546
+ return true;
5547
+ }
5548
+ let href = element.attr("href").orElse(element.attr("src").value);
5549
+ if (!href.isPresent()) {
5550
+ return true;
5551
+ }
5552
+ return !head.querySelectorAll(`${tagName}[href='${href.value}']`).length &&
5553
+ !head.querySelectorAll(`${tagName}[src='${href.value}']`).length;
5554
+ }
5555
+ this
5556
+ .filter(resourceIsNew)
5557
+ .each(element => {
5558
+ if (element.tagName.value != "SCRIPT") {
5559
+ //we need to run runScripts properly to deal with the rest
5560
+ new ExtDomquery(...processedScripts).runScripts(true);
5561
+ processedScripts = [];
5562
+ head.append(element);
5563
+ }
5564
+ else {
5565
+ processedScripts.push(element);
5566
+ }
5567
+ });
5568
+ new ExtDomquery(...processedScripts).runScripts(true);
5366
5569
  }
5367
5570
  /**
5368
5571
  * byId producer
@@ -6021,6 +6224,7 @@ function resolveContexts(context) {
6021
6224
  /**
6022
6225
  * prepare storage for some deferred operations
6023
6226
  */
6227
+ internalContext.assign(Const_1.DEFERRED_HEAD_INSERTS).value = [];
6024
6228
  internalContext.assign(Const_1.UPDATE_FORMS).value = [];
6025
6229
  internalContext.assign(Const_1.UPDATE_ELEMS).value = [];
6026
6230
  return { externalContext, internalContext };
@@ -6231,6 +6435,9 @@ var Response;
6231
6435
  case (0, Const_1.$nsp)(Const_1.P_VIEWBODY):
6232
6436
  responseProcessor.replaceBody(mona_dish_1.DQ.fromMarkup(cdataBlock));
6233
6437
  break;
6438
+ case (0, Const_1.$nsp)(Const_1.P_RESOURCE):
6439
+ responseProcessor.addToHead(mona_dish_1.DQ.fromMarkup(cdataBlock));
6440
+ break;
6234
6441
  default: //htmlItem replacement
6235
6442
  responseProcessor.update(node, cdataBlock);
6236
6443
  break;
@@ -6303,13 +6510,19 @@ class ResponseProcessor {
6303
6510
  if (!shadowHead.isPresent()) {
6304
6511
  return;
6305
6512
  }
6306
- let oldHead = mona_dish_1.DQ.querySelectorAll(Const_1.TAG_HEAD);
6513
+ let oldHead = ExtDomQuery_1.ExtDomquery.querySelectorAll(Const_1.TAG_HEAD);
6307
6514
  //delete all to avoid script and style overlays
6308
6515
  oldHead.querySelectorAll(Const_1.SEL_SCRIPTS_STYLES).delete();
6309
6516
  // we cannot replace new elements in the head, but we can eval the elements
6310
6517
  // eval means the scripts will get attached (eval script attach method)
6311
6518
  // but this is done by DomQuery not in this code
6312
6519
  this.storeForEval(shadowHead);
6520
+ //incoming either the outer head tag or its childs
6521
+ //shadowHead = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
6522
+ //this.addToHead(shadowHead);
6523
+ }
6524
+ addToHead(newElements) {
6525
+ this.internalContext.assign(Const_1.DEFERRED_HEAD_INSERTS).value.push(newElements);
6313
6526
  }
6314
6527
  /**
6315
6528
  * replaces the body in the expected manner
@@ -6325,7 +6538,7 @@ class ResponseProcessor {
6325
6538
  return;
6326
6539
  }
6327
6540
  let shadowInnerHTML = shadowBody.html().value;
6328
- let resultingBody = mona_dish_1.DQ.querySelectorAll(Const_1.TAG_BODY).html(shadowInnerHTML);
6541
+ let resultingBody = ExtDomQuery_1.ExtDomquery.querySelectorAll(Const_1.TAG_BODY).html(shadowInnerHTML);
6329
6542
  let updateForms = resultingBody.querySelectorAll(Const_1.TAG_FORM);
6330
6543
  // main difference, we cannot replace the body itself, but only its content
6331
6544
  // we need a separate step for post processing the incoming attributes, like classes, styles etc...
@@ -6338,7 +6551,7 @@ class ResponseProcessor {
6338
6551
  * @param node the node to eval
6339
6552
  */
6340
6553
  eval(node) {
6341
- mona_dish_1.DQ.globalEval(node.cDATAAsString);
6554
+ ExtDomQuery_1.ExtDomquery.globalEval(node.cDATAAsString);
6342
6555
  }
6343
6556
  /**
6344
6557
  * processes an incoming error from the response
@@ -6486,8 +6699,13 @@ class ResponseProcessor {
6486
6699
  * generic global eval which runs the embedded css and scripts
6487
6700
  */
6488
6701
  globalEval() {
6702
+ // phase one, if we have head inserts, we build up those before going into the script eval phase
6703
+ let insertHeadElems = new ExtDomQuery_1.ExtDomquery(...this.internalContext.getIf(Const_1.DEFERRED_HEAD_INSERTS).value);
6704
+ insertHeadElems.runHeadInserts(true);
6705
+ // phase 2 we run a script eval on all updated elements in the body
6489
6706
  let updateElems = new ExtDomQuery_1.ExtDomquery(...this.internalContext.getIf(Const_1.UPDATE_ELEMS).value);
6490
6707
  updateElems.runCss();
6708
+ // phase 3, we do the same for the css
6491
6709
  updateElems.runScripts();
6492
6710
  }
6493
6711
  /**
@@ -6600,6 +6818,10 @@ class ResponseProcessor {
6600
6818
  storeForEval(toBeEvaled) {
6601
6819
  this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(toBeEvaled);
6602
6820
  }
6821
+ // head eval is always sticky
6822
+ storeForHeadEval(toBeEvaled, sticky) {
6823
+ this.internalContext.assign(Const_1.DEFERRED_HEAD_INSERTS).value.push(toBeEvaled);
6824
+ }
6603
6825
  /**
6604
6826
  * check whether a given XMLQuery node is an explicit viewstate node
6605
6827
  *
@@ -7347,6 +7569,19 @@ var oam;
7347
7569
  /******/ }
7348
7570
  /******/
7349
7571
  /************************************************************************/
7572
+ /******/ /* webpack/runtime/global */
7573
+ /******/ (() => {
7574
+ /******/ __webpack_require__.g = (function() {
7575
+ /******/ if (typeof globalThis === 'object') return globalThis;
7576
+ /******/ try {
7577
+ /******/ return this || new Function('return this')();
7578
+ /******/ } catch (e) {
7579
+ /******/ if (typeof window === 'object') return window;
7580
+ /******/ }
7581
+ /******/ })();
7582
+ /******/ })();
7583
+ /******/
7584
+ /************************************************************************/
7350
7585
  var __webpack_exports__ = {};
7351
7586
  // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
7352
7587
  (() => {
Binary file
Binary file