jsf.js_next_gen 4.0.0-beta-18 → 4.0.0-beta-20

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 (101) 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 +208 -19
  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 +208 -19
  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/@types/definitions/index.d.ts +14 -40
  43. package/src/main/typescript/impl/core/Const.ts +6 -0
  44. package/src/main/typescript/impl/util/ExtDomQuery.ts +11 -2
  45. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +8 -0
  46. package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +3 -1
  47. package/src/main/typescript/impl/xhrCore/Response.ts +6 -2
  48. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +48 -4
  49. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +6 -0
  50. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +32 -0
  51. package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -8
  52. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -9
  53. package/src/main/typescript/test/impl/SeparatorCharsTest.spec.ts +0 -2
  54. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +8 -16
  55. package/src/main/typescript/test/xhrCore/FakeWebsocket.ts +2 -2
  56. package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +0 -25
  57. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +1 -22
  58. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +4 -5
  59. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +29 -17
  60. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +7 -17
  61. package/src/main/typescript/test/xhrCore/ShadowDomTest.spec.ts +0 -1
  62. package/src/main/typescript/test/xhrCore/WebsocketTest.ts +4 -4
  63. package/src/test.html +75 -0
  64. package/target/impl/core/Const.js +7 -3
  65. package/target/impl/core/Const.js.map +1 -1
  66. package/target/impl/util/ExtDomQuery.js +5 -2
  67. package/target/impl/util/ExtDomQuery.js.map +1 -1
  68. package/target/impl/xhrCore/ResonseDataResolver.js +1 -0
  69. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
  70. package/target/impl/xhrCore/Response.js +3 -0
  71. package/target/impl/xhrCore/Response.js.map +1 -1
  72. package/target/impl/xhrCore/ResponseProcessor.js +40 -3
  73. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  74. package/target/test/frameworkBase/_ext/shared/StandardInits.js +6 -0
  75. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  76. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +30 -0
  77. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  78. package/target/test/impl/ImplTest.spec.js +3 -5
  79. package/target/test/impl/ImplTest.spec.js.map +1 -1
  80. package/target/test/impl/ImplTest_23.spec.js +3 -6
  81. package/target/test/impl/ImplTest_23.spec.js.map +1 -1
  82. package/target/test/impl/SeparatorCharsTest.spec.js +0 -2
  83. package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
  84. package/target/test/xhrCore/EventTests.spec.js +7 -12
  85. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  86. package/target/test/xhrCore/FakeWebsocket.js +2 -2
  87. package/target/test/xhrCore/FakeWebsocket.js.map +1 -1
  88. package/target/test/xhrCore/FileUploadTest.spec.js +0 -10
  89. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  90. package/target/test/xhrCore/RequestParamsTest.spec.js +0 -18
  91. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  92. package/target/test/xhrCore/RequestTest_23.spec.js +2 -3
  93. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  94. package/target/test/xhrCore/ResponseTest.spec.js +27 -9
  95. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  96. package/target/test/xhrCore/ResponseTest23.spec.js +6 -8
  97. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
  98. package/target/test/xhrCore/ShadowDomTest.spec.js +0 -1
  99. package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
  100. package/target/test/xhrCore/WebsocketTest.js +4 -4
  101. package/target/test/xhrCore/WebsocketTest.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
@@ -108,7 +109,7 @@ function waitUntilDom(root, condition, options = { attributes: true, childList:
108
109
  success(new DomQuery(found || root));
109
110
  }
110
111
  };
111
- observer = new window.MutationObserver(callback);
112
+ observer = new MutationObserver(callback);
112
113
  // browsers might ignore it, but we cannot break the api in the case
113
114
  // hence no timeout is passed
114
115
  let observableOpts = Object.assign({}, options);
@@ -263,6 +264,9 @@ class DomQuery {
263
264
  get values() {
264
265
  return this.allElems();
265
266
  }
267
+ get global() {
268
+ return Global_1._global$;
269
+ }
266
270
  /**
267
271
  * returns the id of the first element
268
272
  */
@@ -493,6 +497,9 @@ class DomQuery {
493
497
  static globalEval(code, nonce) {
494
498
  return new DomQuery(document).globalEval(code, nonce);
495
499
  }
500
+ static globalEvalSticky(code, nonce) {
501
+ return new DomQuery(document).globalEvalSticky(code, nonce);
502
+ }
496
503
  /**
497
504
  * builds the ie nodes properly in a placeholder
498
505
  * and bypasses a non script insert bug that way
@@ -816,7 +823,7 @@ class DomQuery {
816
823
  prot.oMatchesSelector ||
817
824
  prot.webkitMatchesSelector ||
818
825
  function (s) {
819
- let matches = (document || window.ownerDocument).querySelectorAll(s), i = matches.length;
826
+ let matches = (document || ownerDocument).querySelectorAll(s), i = matches.length;
820
827
  while (--i >= 0 && matches.item(i) !== toMatch) {
821
828
  }
822
829
  return i > -1;
@@ -961,6 +968,28 @@ class DomQuery {
961
968
  head.removeChild(newScriptElement);
962
969
  return this;
963
970
  }
971
+ /**
972
+ * global eval head appendix method
973
+ * no other methods are supported anymore
974
+ * @param code the code to be evaled
975
+ * @param nonce optional nonce key for higher security
976
+ */
977
+ globalEvalSticky(code, nonce) {
978
+ let head = document.getElementsByTagName("head")[0] || document.documentElement;
979
+ let script = document.createElement("script");
980
+ if (nonce) {
981
+ if ('undefined' != typeof (script === null || script === void 0 ? void 0 : script.nonce)) {
982
+ script.nonce = nonce;
983
+ }
984
+ else {
985
+ script.setAttribute("nonce", nonce);
986
+ }
987
+ }
988
+ script.type = "text/javascript";
989
+ script.innerHTML = code;
990
+ head.appendChild(script);
991
+ return this;
992
+ }
964
993
  /**
965
994
  * detaches a set of nodes from their parent elements
966
995
  * in a browser independend manner
@@ -1029,6 +1058,42 @@ class DomQuery {
1029
1058
  xhr.send(null);
1030
1059
  return this;
1031
1060
  }
1061
+ /**
1062
+ * loads and evals a script from a source uri
1063
+ *
1064
+ * @param src the source to be loaded and evaled
1065
+ * @param defer in miliseconds execution default (0 == no defer)
1066
+ * @param charSet
1067
+ */
1068
+ loadScriptEvalSticky(src, defer = 0, charSet = "utf-8", nonce) {
1069
+ let xhr = new XMLHttpRequest();
1070
+ xhr.open("GET", src, false);
1071
+ if (charSet) {
1072
+ xhr.setRequestHeader("Content-Type", "application/x-javascript; charset:" + charSet);
1073
+ }
1074
+ xhr.onload = () => {
1075
+ //defer also means we have to process after the ajax response
1076
+ //has been processed
1077
+ //we can achieve that with a small timeout, the timeout
1078
+ //triggers after the processing is done!
1079
+ if (!defer) {
1080
+ this.globalEvalSticky(xhr.responseText.replace(/\n/g, "\r\n") + "\r\n//@ sourceURL=" + src, nonce);
1081
+ }
1082
+ else {
1083
+ //TODO not ideal we maybe ought to move to something else here
1084
+ //but since it is not in use yet, it is ok
1085
+ setTimeout(() => {
1086
+ this.globalEvalSticky(xhr.responseText + "\r\n//@ sourceURL=" + src, nonce);
1087
+ }, defer);
1088
+ }
1089
+ };
1090
+ xhr.onerror = (data) => {
1091
+ throw Error(data);
1092
+ };
1093
+ //since we are synchronous we do it after not with onReadyStateChange
1094
+ xhr.send(null);
1095
+ return this;
1096
+ }
1032
1097
  insertAfter(...toInsertParams) {
1033
1098
  this.each(existingItem => {
1034
1099
  let existingElement = existingItem.getAsElem(0).value;
@@ -1189,10 +1254,11 @@ class DomQuery {
1189
1254
  }
1190
1255
  /**
1191
1256
  * Run through the given nodes in the DomQuery execute the inline scripts
1257
+ * @param sticky if set to true the evaled elements will stick to the head, default false
1192
1258
  * @param whilteListed: optional whitelist function which can filter out script tags which are not processed
1193
1259
  * defaults to the standard jsf.js exclusion (we use this code for myfaces)
1194
1260
  */
1195
- runScripts(whilteListed = DEFAULT_WHITELIST) {
1261
+ runScripts(sticky = false, whilteListed = DEFAULT_WHITELIST) {
1196
1262
  const evalCollectedScripts = (scriptsToProcess) => {
1197
1263
  if (scriptsToProcess.length) {
1198
1264
  //script source means we have to eval the existing
@@ -1208,11 +1274,14 @@ class DomQuery {
1208
1274
  this.globalEval(joinedScripts.join("\n"));
1209
1275
  joinedScripts.length = 0;
1210
1276
  }
1211
- this.globalEval(item.evalText, item.nonce);
1277
+ (!sticky) ?
1278
+ this.globalEval(item.evalText, item.nonce) :
1279
+ this.globalEvalSticky(item.evalText, item.nonce);
1212
1280
  }
1213
1281
  });
1214
1282
  if (joinedScripts.length) {
1215
- this.globalEval(joinedScripts.join("\n"));
1283
+ (!sticky) ? this.globalEval(joinedScripts.join("\n")) :
1284
+ this.globalEvalSticky(joinedScripts.join("\n"));
1216
1285
  joinedScripts.length = 0;
1217
1286
  }
1218
1287
  scriptsToProcess = [];
@@ -1239,9 +1308,16 @@ class DomQuery {
1239
1308
  if (whilteListed(src)) {
1240
1309
  //we run the collected scripts before running, the include
1241
1310
  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");
1311
+ if (!sticky) {
1312
+ (!!nonce) ? this.loadScriptEval(src, 0, "UTF-8", nonce) :
1313
+ //if no nonce is set we do not pass any once
1314
+ this.loadScriptEval(src, 0, "UTF-8");
1315
+ }
1316
+ else {
1317
+ (!!nonce) ? this.loadScriptEvalSticky(src, 0, "UTF-8", nonce) :
1318
+ //if no nonce is set we do not pass any once
1319
+ this.loadScriptEvalSticky(src, 0, "UTF-8");
1320
+ }
1245
1321
  }
1246
1322
  }
1247
1323
  else {
@@ -1708,6 +1784,10 @@ class DomQuery {
1708
1784
  }
1709
1785
  exports.DomQuery = DomQuery;
1710
1786
  DomQuery.absent = new DomQuery();
1787
+ /**
1788
+ * reference to the environmental global object
1789
+ */
1790
+ DomQuery.global = Global_1._global$;
1711
1791
  /**
1712
1792
  * Various collectors
1713
1793
  * which can be used in conjunction with Streams
@@ -1740,6 +1820,53 @@ exports.DQ = DomQuery;
1740
1820
  exports.DQ$ = DomQuery.querySelectorAll;
1741
1821
 
1742
1822
 
1823
+ /***/ }),
1824
+
1825
+ /***/ "./node_modules/mona-dish/src/main/typescript/Global.ts":
1826
+ /*!**************************************************************!*\
1827
+ !*** ./node_modules/mona-dish/src/main/typescript/Global.ts ***!
1828
+ \**************************************************************/
1829
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1830
+
1831
+
1832
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1833
+ exports._global$ = void 0;
1834
+ /*!
1835
+ * Licensed to the Apache Software Foundation (ASF) under one
1836
+ * or more contributor license agreements. See the NOTICE file
1837
+ * distributed with this work for additional information
1838
+ * regarding copyright ownership. The ASF licenses this file
1839
+ * to you under the Apache License, Version 2.0 (the
1840
+ * "License"); you may not use this file except in compliance
1841
+ * with the License. You may obtain a copy of the License at
1842
+ *
1843
+ * http://www.apache.org/licenses/LICENSE-2.0
1844
+ *
1845
+ * Unless required by applicable law or agreed to in writing,
1846
+ * software distributed under the License is distributed on an
1847
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1848
+ * KIND, either express or implied. See the License for the
1849
+ * specific language governing permissions and limitations
1850
+ * under the License.
1851
+ */
1852
+ /**
1853
+ * various environments handle the global variable different
1854
+ * we have to deal with this.
1855
+ */
1856
+ function _global$() {
1857
+ var _a;
1858
+ let _global$ = ('undefined' != typeof globalThis && globalThis.window) ? globalThis.window :
1859
+ ('undefined' != typeof window) ? window :
1860
+ ('undefined' != typeof globalThis) ? globalThis :
1861
+ ('undefined' != typeof __webpack_require__.g && (__webpack_require__.g === null || __webpack_require__.g === void 0 ? void 0 : __webpack_require__.g.window)) ? __webpack_require__.g.window :
1862
+ ('undefined' != typeof __webpack_require__.g) ? __webpack_require__.g : null;
1863
+ //under test systems we often have a lazy init of the window object under global.window, but we
1864
+ //want the window object
1865
+ return (_a = _global$ === null || _global$ === void 0 ? void 0 : _global$.window) !== null && _a !== void 0 ? _a : _global$;
1866
+ }
1867
+ exports._global$ = _global$;
1868
+
1869
+
1743
1870
  /***/ }),
1744
1871
 
1745
1872
  /***/ "./node_modules/mona-dish/src/main/typescript/Lang.ts":
@@ -3392,6 +3519,7 @@ exports.XQ = exports.XMLQuery = void 0;
3392
3519
  const Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
3393
3520
  const DomQuery_1 = __webpack_require__(/*! ./DomQuery */ "./node_modules/mona-dish/src/main/typescript/DomQuery.ts");
3394
3521
  var isString = Lang_1.Lang.isString;
3522
+ const Global_1 = __webpack_require__(/*! ./Global */ "./node_modules/mona-dish/src/main/typescript/Global.ts");
3395
3523
  /**
3396
3524
  * xml query as specialized case for DomQuery
3397
3525
  */
@@ -3413,7 +3541,7 @@ class XMLQuery extends DomQuery_1.DomQuery {
3413
3541
  if (xml == null) {
3414
3542
  return null;
3415
3543
  }
3416
- let domParser = Lang_1.Lang.saveResolveLazy(() => new window.DOMParser(), () => createIe11DomQueryShim()).value;
3544
+ let domParser = Lang_1.Lang.saveResolveLazy(() => new ((0, Global_1._global$)()).DOMParser(), () => createIe11DomQueryShim()).value;
3417
3545
  return domParser.parseFromString(xml, docType);
3418
3546
  };
3419
3547
  if (isString(rootNode)) {
@@ -3429,8 +3557,8 @@ class XMLQuery extends DomQuery_1.DomQuery {
3429
3557
  toString() {
3430
3558
  let ret = [];
3431
3559
  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;
3560
+ var _a, _b, _c, _d;
3561
+ 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
3562
  if (!!serialized) {
3435
3563
  ret.push(serialized);
3436
3564
  }
@@ -4673,9 +4801,9 @@ var PushImpl;
4673
4801
  * limitations under the License.
4674
4802
  */
4675
4803
  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;
4804
+ 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;
4805
+ 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;
4806
+ exports.$nsp = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS = exports.RECONNECT_INTERVAL = exports.APPLIED_CLIENT_WINDOW = exports.APPLIED_VST = void 0;
4679
4807
  /*
4680
4808
  * [export const] constants
4681
4809
  */
@@ -4685,6 +4813,7 @@ exports.P_VIEWSTATE = "jakarta.faces.ViewState";
4685
4813
  exports.P_VIEWROOT = "jakarta.faces.ViewRoot";
4686
4814
  exports.P_VIEWHEAD = "jakarta.faces.ViewHead";
4687
4815
  exports.P_VIEWBODY = "jakarta.faces.ViewBody";
4816
+ exports.P_RESOURCE = "jakarta.faces.Resource";
4688
4817
  /*some useful definitions*/
4689
4818
  exports.EMPTY_FUNC = Object.freeze(() => {
4690
4819
  });
@@ -4782,6 +4911,9 @@ exports.CMD_REDIRECT = "redirect";
4782
4911
  /*other constants*/
4783
4912
  exports.UPDATE_FORMS = "_updateForms";
4784
4913
  exports.UPDATE_ELEMS = "_updateElems";
4914
+ //we want the head elements to be processed before we process the body
4915
+ //but after the inner html is done
4916
+ exports.DEFERRED_HEAD_INSERTS = "_headElems";
4785
4917
  exports.MYFACES = "myfaces";
4786
4918
  exports.SEL_SCRIPTS_STYLES = "script, style, link";
4787
4919
  exports.MF_NONE = "__mf_none__";
@@ -5352,17 +5484,20 @@ class ExtDomquery extends mona_dish_1.DQ {
5352
5484
  globalEval(code, nonce) {
5353
5485
  return new ExtDomquery(super.globalEval(code, nonce !== null && nonce !== void 0 ? nonce : this.nonce));
5354
5486
  }
5487
+ globalEvalSticky(code, nonce) {
5488
+ return new ExtDomquery(super.globalEvalSticky(code, nonce !== null && nonce !== void 0 ? nonce : this.nonce));
5489
+ }
5355
5490
  /**
5356
5491
  * decorated run scripts which takes our jsf extensions into consideration
5357
5492
  * (standard DomQuery will let you pass anything)
5358
5493
  * @param whilteListed
5359
5494
  */
5360
- runScripts(whilteListed) {
5495
+ runScripts(sticky = false, whilteListed) {
5361
5496
  const whitelistFunc = (src) => {
5362
5497
  var _a;
5363
5498
  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
5499
  };
5365
- return super.runScripts(whitelistFunc);
5500
+ return super.runScripts(false, whitelistFunc);
5366
5501
  }
5367
5502
  /**
5368
5503
  * byId producer
@@ -6021,6 +6156,7 @@ function resolveContexts(context) {
6021
6156
  /**
6022
6157
  * prepare storage for some deferred operations
6023
6158
  */
6159
+ internalContext.assign(Const_1.DEFERRED_HEAD_INSERTS).value = [];
6024
6160
  internalContext.assign(Const_1.UPDATE_FORMS).value = [];
6025
6161
  internalContext.assign(Const_1.UPDATE_ELEMS).value = [];
6026
6162
  return { externalContext, internalContext };
@@ -6231,6 +6367,9 @@ var Response;
6231
6367
  case (0, Const_1.$nsp)(Const_1.P_VIEWBODY):
6232
6368
  responseProcessor.replaceBody(mona_dish_1.DQ.fromMarkup(cdataBlock));
6233
6369
  break;
6370
+ case (0, Const_1.$nsp)(Const_1.P_RESOURCE):
6371
+ responseProcessor.addToHead(mona_dish_1.DQ.fromMarkup(cdataBlock));
6372
+ break;
6234
6373
  default: //htmlItem replacement
6235
6374
  responseProcessor.update(node, cdataBlock);
6236
6375
  break;
@@ -6303,13 +6442,19 @@ class ResponseProcessor {
6303
6442
  if (!shadowHead.isPresent()) {
6304
6443
  return;
6305
6444
  }
6306
- let oldHead = mona_dish_1.DQ.querySelectorAll(Const_1.TAG_HEAD);
6445
+ let oldHead = ExtDomQuery_1.ExtDomquery.querySelectorAll(Const_1.TAG_HEAD);
6307
6446
  //delete all to avoid script and style overlays
6308
6447
  oldHead.querySelectorAll(Const_1.SEL_SCRIPTS_STYLES).delete();
6309
6448
  // we cannot replace new elements in the head, but we can eval the elements
6310
6449
  // eval means the scripts will get attached (eval script attach method)
6311
6450
  // but this is done by DomQuery not in this code
6312
6451
  this.storeForEval(shadowHead);
6452
+ //incoming either the outer head tag or its childs
6453
+ //shadowHead = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
6454
+ //this.addToHead(shadowHead);
6455
+ }
6456
+ addToHead(newElements) {
6457
+ this.internalContext.assign(Const_1.DEFERRED_HEAD_INSERTS).value.push(newElements);
6313
6458
  }
6314
6459
  /**
6315
6460
  * replaces the body in the expected manner
@@ -6325,7 +6470,7 @@ class ResponseProcessor {
6325
6470
  return;
6326
6471
  }
6327
6472
  let shadowInnerHTML = shadowBody.html().value;
6328
- let resultingBody = mona_dish_1.DQ.querySelectorAll(Const_1.TAG_BODY).html(shadowInnerHTML);
6473
+ let resultingBody = ExtDomQuery_1.ExtDomquery.querySelectorAll(Const_1.TAG_BODY).html(shadowInnerHTML);
6329
6474
  let updateForms = resultingBody.querySelectorAll(Const_1.TAG_FORM);
6330
6475
  // main difference, we cannot replace the body itself, but only its content
6331
6476
  // we need a separate step for post processing the incoming attributes, like classes, styles etc...
@@ -6338,7 +6483,7 @@ class ResponseProcessor {
6338
6483
  * @param node the node to eval
6339
6484
  */
6340
6485
  eval(node) {
6341
- mona_dish_1.DQ.globalEval(node.cDATAAsString);
6486
+ ExtDomQuery_1.ExtDomquery.globalEval(node.cDATAAsString);
6342
6487
  }
6343
6488
  /**
6344
6489
  * processes an incoming error from the response
@@ -6486,8 +6631,13 @@ class ResponseProcessor {
6486
6631
  * generic global eval which runs the embedded css and scripts
6487
6632
  */
6488
6633
  globalEval() {
6634
+ // phase one, if we have head inserts, we build up those before going into the script eval phase
6635
+ let insertHeadElems = new ExtDomQuery_1.ExtDomquery(...this.internalContext.getIf(Const_1.DEFERRED_HEAD_INSERTS).value);
6636
+ this.runHeadInserts(insertHeadElems);
6637
+ // phase 2 we run a script eval on all updated elements in the body
6489
6638
  let updateElems = new ExtDomQuery_1.ExtDomquery(...this.internalContext.getIf(Const_1.UPDATE_ELEMS).value);
6490
6639
  updateElems.runCss();
6640
+ // phase 3, we do the same for the css
6491
6641
  updateElems.runScripts();
6492
6642
  }
6493
6643
  /**
@@ -6600,6 +6750,10 @@ class ResponseProcessor {
6600
6750
  storeForEval(toBeEvaled) {
6601
6751
  this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(toBeEvaled);
6602
6752
  }
6753
+ // head eval is always sticky
6754
+ storeForHeadEval(toBeEvaled, sticky) {
6755
+ this.internalContext.assign(Const_1.DEFERRED_HEAD_INSERTS).value.push(toBeEvaled);
6756
+ }
6603
6757
  /**
6604
6758
  * check whether a given XMLQuery node is an explicit viewstate node
6605
6759
  *
@@ -6629,6 +6783,28 @@ class ResponseProcessor {
6629
6783
  triggerOnError(errorData) {
6630
6784
  this.externalContext.getIf(Const_1.ON_ERROR).orElse(this.internalContext.getIf(Const_1.ON_ERROR).value).orElse(Const_1.EMPTY_FUNC).value(errorData);
6631
6785
  }
6786
+ /**
6787
+ * adds new elements to the head as per spec, we use it in a deferred way
6788
+ * to have the html buildup first then the head inserts which run the head evals
6789
+ * and then the body and css evals from the markup
6790
+ *
6791
+ * This is only performed upon a head replacement or resource insert
6792
+ *
6793
+ * @param newElements the elements which need addition
6794
+ */
6795
+ runHeadInserts(newElements) {
6796
+ let head = ExtDomQuery_1.ExtDomquery.byId(document.head);
6797
+ //automated nonce handling
6798
+ newElements.each(element => {
6799
+ if (element.tagName.value != "SCRIPT" || element.attr("src").isPresent()) {
6800
+ head.append(element);
6801
+ return;
6802
+ }
6803
+ // special corner case
6804
+ // embedded script code,
6805
+ element.globalEvalSticky(element.innerHTML);
6806
+ });
6807
+ }
6632
6808
  }
6633
6809
  exports.ResponseProcessor = ResponseProcessor;
6634
6810
 
@@ -7347,6 +7523,19 @@ var oam;
7347
7523
  /******/ }
7348
7524
  /******/
7349
7525
  /************************************************************************/
7526
+ /******/ /* webpack/runtime/global */
7527
+ /******/ (() => {
7528
+ /******/ __webpack_require__.g = (function() {
7529
+ /******/ if (typeof globalThis === 'object') return globalThis;
7530
+ /******/ try {
7531
+ /******/ return this || new Function('return this')();
7532
+ /******/ } catch (e) {
7533
+ /******/ if (typeof window === 'object') return window;
7534
+ /******/ }
7535
+ /******/ })();
7536
+ /******/ })();
7537
+ /******/
7538
+ /************************************************************************/
7350
7539
  var __webpack_exports__ = {};
7351
7540
  // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
7352
7541
  (() => {
Binary file
Binary file