jsf.js_next_gen 4.0.0-RC.7 → 4.0.0-RC.9

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 (36) hide show
  1. package/dist/docs/assets/main.js +1 -1
  2. package/dist/window/faces-development.js +108 -55
  3. package/dist/window/faces-development.js.br +0 -0
  4. package/dist/window/faces-development.js.gz +0 -0
  5. package/dist/window/faces-development.js.map +1 -1
  6. package/dist/window/faces.js +1 -1
  7. package/dist/window/faces.js.br +0 -0
  8. package/dist/window/faces.js.gz +0 -0
  9. package/dist/window/faces.js.map +1 -1
  10. package/dist/window/jsf-development.js +108 -55
  11. package/dist/window/jsf-development.js.br +0 -0
  12. package/dist/window/jsf-development.js.gz +0 -0
  13. package/dist/window/jsf-development.js.map +1 -1
  14. package/dist/window/jsf.js +1 -1
  15. package/dist/window/jsf.js.br +0 -0
  16. package/dist/window/jsf.js.gz +0 -0
  17. package/dist/window/jsf.js.map +1 -1
  18. package/package.json +7 -7
  19. package/src/main/typescript/impl/util/Assertions.ts +14 -6
  20. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +11 -1
  21. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +14 -8
  22. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
  23. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +65 -0
  24. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +49 -2
  25. package/target/impl/util/Assertions.js +11 -6
  26. package/target/impl/util/Assertions.js.map +1 -1
  27. package/target/impl/xhrCore/RequestDataResolver.js +11 -1
  28. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
  29. package/target/impl/xhrCore/ResponseProcessor.js +13 -8
  30. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  31. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
  32. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  33. package/target/test/xhrCore/RequestTest.spec.js +63 -0
  34. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  35. package/target/test/xhrCore/ResponseTest.spec.js +36 -1
  36. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
@@ -42,7 +42,7 @@ const SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./no
42
42
  const Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
43
43
  var trim = Lang_1.Lang.trim;
44
44
  var isString = Lang_1.Lang.isString;
45
- var eIgnoreC = Lang_1.Lang.equalsIgnoreCase;
45
+ var eqi = Lang_1.Lang.equalsIgnoreCase;
46
46
  const Global_1 = __webpack_require__(/*! ./Global */ "./node_modules/mona-dish/src/main/typescript/Global.ts");
47
47
  var objToArray = Lang_1.Lang.objToArray;
48
48
  /**
@@ -866,6 +866,30 @@ class DomQuery {
866
866
  });
867
867
  return this;
868
868
  }
869
+ /**
870
+ * replace convenience function, replaces one or more elements with
871
+ * a set of elements passed as DomQuery
872
+ * @param toReplace the replaced nodes as reference (original node has been replaced)
873
+ */
874
+ replace(toReplace) {
875
+ this.each(item => {
876
+ let asElem = item.getAsElem(0).value;
877
+ let parent = asElem.parentElement;
878
+ let nextElement = asElem.nextElementSibling;
879
+ let previousElement = asElem.previousElementSibling;
880
+ if (nextElement != null) {
881
+ new DomQuery(nextElement).insertBefore(toReplace);
882
+ }
883
+ else if (previousElement) {
884
+ new DomQuery(previousElement).insertAfter(toReplace);
885
+ }
886
+ else {
887
+ new DomQuery(parent).append(toReplace);
888
+ }
889
+ item.delete();
890
+ });
891
+ return toReplace;
892
+ }
869
893
  /**
870
894
  * returns a new dom query containing only the first element max
871
895
  *
@@ -1184,7 +1208,7 @@ class DomQuery {
1184
1208
  let tagName = item.tagName;
1185
1209
  let itemType = ((_a = item === null || item === void 0 ? void 0 : item.type) !== null && _a !== void 0 ? _a : '').toLowerCase();
1186
1210
  if (tagName &&
1187
- eIgnoreC(tagName, "script") &&
1211
+ eqi(tagName, "script") &&
1188
1212
  allowedItemTypes.indexOf(itemType) != -1) {
1189
1213
  let src = item.getAttribute('src');
1190
1214
  if ('undefined' != typeof src
@@ -1270,36 +1294,30 @@ class DomQuery {
1270
1294
  return this;
1271
1295
  }
1272
1296
  runCss() {
1273
- const applyStyle = (item, style) => {
1274
- var _a, _b, _c, _d;
1275
- let newSS = document.createElement("style");
1276
- document.getElementsByTagName("head")[0].appendChild(newSS);
1277
- let styleSheet = (_a = newSS.sheet) !== null && _a !== void 0 ? _a : newSS.styleSheet;
1278
- newSS.setAttribute("rel", (_b = item.getAttribute("rel")) !== null && _b !== void 0 ? _b : "stylesheet");
1279
- newSS.setAttribute("type", (_c = item.getAttribute("type")) !== null && _c !== void 0 ? _c : "text/css");
1280
- if ((_d = styleSheet === null || styleSheet === void 0 ? void 0 : styleSheet.cssText) !== null && _d !== void 0 ? _d : false) {
1281
- styleSheet.cssText = style;
1282
- }
1283
- else {
1284
- newSS.appendChild(document.createTextNode(style));
1285
- }
1286
- }, execCss = (item) => {
1287
- const tagName = item.tagName;
1288
- if (tagName && eIgnoreC(tagName, "link") && eIgnoreC(item.getAttribute("type"), "text/css")) {
1289
- applyStyle(item, "@import url('" + item.getAttribute("href") + "');");
1290
- }
1291
- else if (tagName && eIgnoreC(tagName, "style") && eIgnoreC(item.getAttribute("type"), "text/css")) {
1292
- let innerText = [];
1293
- // compliant browsers know child nodes
1294
- let childNodes = Array.prototype.slice.call(item.childNodes);
1295
- if (childNodes) {
1296
- childNodes.forEach(child => innerText.push(child.innerHTML || child.data));
1297
- // non-compliant elements innerHTML
1297
+ const execCss = (toReplace) => {
1298
+ const _toReplace = DomQuery.byId(toReplace);
1299
+ const tagName = _toReplace.tagName.orElse("").value;
1300
+ const head = DomQuery.byTagName("head");
1301
+ if (tagName && eqi(tagName, "link") && eqi(toReplace.getAttribute("rel"), "stylesheet")) {
1302
+ const rel = toReplace.getAttribute("rel");
1303
+ //if possible we are now replacing the existing elements where we reference this stylesheet
1304
+ const matches = head.querySelectorAll(`link[rel='stylesheet'][href='${rel}']`);
1305
+ if (matches.length) {
1306
+ matches.replace(_toReplace);
1307
+ }
1308
+ else {
1309
+ head.append(_toReplace);
1298
1310
  }
1299
- else if (item.innerHTML) {
1300
- innerText.push(item.innerHTML);
1311
+ }
1312
+ else if (tagName && eqi(tagName, "style")) {
1313
+ let innerText = _toReplace.innerHTML.replace(/\s+/gi, "");
1314
+ let styles = head.querySelectorAll("style");
1315
+ styles = styles.stream.filter(style => {
1316
+ return style.innerHTML.replace(/\s+/gi, "") == innerText;
1317
+ }).collect(new DomQueryCollector());
1318
+ if (!styles.length) { //already present
1319
+ head.append(_toReplace);
1301
1320
  }
1302
- applyStyle(item, innerText.join(""));
1303
1321
  }
1304
1322
  };
1305
1323
  const scriptElements = new DomQuery(this.filterSelector("link, style"), this.querySelectorAll("link, style"));
@@ -2719,7 +2737,7 @@ exports.Config = Config;
2719
2737
  * limitations under the License.
2720
2738
  */
2721
2739
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2722
- exports.QueryFormStringCollector = exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.Run = exports.ArrayAssocArrayCollector = exports.ArrayCollector = exports.FlatMapStreamDataSource = exports.MappedStreamDataSource = exports.FilteredStreamDatasource = exports.ArrayStreamDataSource = exports.SequenceDataSource = exports.ITERATION_STATUS = void 0;
2740
+ exports.QueryFormStringCollector = exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.Run = exports.ArrayAssocArrayCollector = exports.InverseArrayCollector = exports.ArrayCollector = exports.FlatMapStreamDataSource = exports.MappedStreamDataSource = exports.FilteredStreamDatasource = exports.ArrayStreamDataSource = exports.SequenceDataSource = exports.ITERATION_STATUS = void 0;
2723
2741
  const Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
2724
2742
  /**
2725
2743
  * special status of the datasource location pointer
@@ -3026,6 +3044,21 @@ class ArrayCollector {
3026
3044
  }
3027
3045
  }
3028
3046
  exports.ArrayCollector = ArrayCollector;
3047
+ /**
3048
+ * collects the values as inverse array
3049
+ */
3050
+ class InverseArrayCollector {
3051
+ constructor() {
3052
+ this.data = [];
3053
+ }
3054
+ collect(element) {
3055
+ this.data.unshift(element);
3056
+ }
3057
+ get finalValue() {
3058
+ return this.data;
3059
+ }
3060
+ }
3061
+ exports.InverseArrayCollector = InverseArrayCollector;
3029
3062
  /**
3030
3063
  * collects an tuple array stream into an assoc array with elements being collected into arrays
3031
3064
  *
@@ -3361,6 +3394,15 @@ exports.Stream = Stream;
3361
3394
  *
3362
3395
  */
3363
3396
  class LazyStream {
3397
+ static of(...values) {
3398
+ return new LazyStream(new SourcesCollectors_1.ArrayStreamDataSource(...values));
3399
+ }
3400
+ static ofAssoc(data) {
3401
+ return this.of(...Object.keys(data)).map(key => [key, data[key]]);
3402
+ }
3403
+ static ofStreamDataSource(value) {
3404
+ return new LazyStream(value);
3405
+ }
3364
3406
  constructor(parent) {
3365
3407
  this._limits = -1;
3366
3408
  /*
@@ -3371,15 +3413,6 @@ class LazyStream {
3371
3413
  this.pos = -1;
3372
3414
  this.dataSource = parent;
3373
3415
  }
3374
- static of(...values) {
3375
- return new LazyStream(new SourcesCollectors_1.ArrayStreamDataSource(...values));
3376
- }
3377
- static ofAssoc(data) {
3378
- return this.of(...Object.keys(data)).map(key => [key, data[key]]);
3379
- }
3380
- static ofStreamDataSource(value) {
3381
- return new LazyStream(value);
3382
- }
3383
3416
  hasNext() {
3384
3417
  if (this.isOverLimits()) {
3385
3418
  return false;
@@ -5247,10 +5280,8 @@ exports.Assertions = void 0;
5247
5280
  * limitations under the License.
5248
5281
  */
5249
5282
  const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
5250
- const Lang_1 = __webpack_require__(/*! ./Lang */ "./src/main/typescript/impl/util/Lang.ts");
5251
- var getMessage = Lang_1.ExtLang.getMessage;
5252
- var makeException = Lang_1.ExtLang.makeException;
5253
5283
  const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
5284
+ const Lang_1 = __webpack_require__(/*! ./Lang */ "./src/main/typescript/impl/util/Lang.ts");
5254
5285
  /**
5255
5286
  * a set of internal code assertions
5256
5287
  * which raise an error
@@ -5265,12 +5296,12 @@ var Assertions;
5265
5296
  assertFunction(options.getIf(Const_1.ON_EVENT).value);
5266
5297
  //improve the error messages if an empty elem is passed
5267
5298
  //Assertions.assertElementExists(elem);
5268
- assert(elem.isPresent(), getMessage("ERR_MUST_BE_PROVIDED1", "{0}: source must be provided or exist", "source element id"), "faces.ajax.request", "ArgNotSet");
5299
+ assert(elem.isPresent(), Lang_1.ExtLang.getMessage("ERR_MUST_BE_PROVIDED1", "{0}: source must be provided or exist", "source element id"), "faces.ajax.request", "ArgNotSet");
5269
5300
  }
5270
5301
  Assertions.assertRequestIntegrity = assertRequestIntegrity;
5271
5302
  function assertUrlExists(node) {
5272
5303
  if (node.attr(Const_1.ATTR_URL).isAbsent()) {
5273
- throw Assertions.raiseError(new Error(), getMessage("ERR_RED_URL", null, "processRedirect"), "processRedirect");
5304
+ throw Assertions.raiseError(new Error(), Lang_1.ExtLang.getMessage("ERR_RED_URL", null, "processRedirect"), "processRedirect");
5274
5305
  }
5275
5306
  }
5276
5307
  Assertions.assertUrlExists = assertUrlExists;
@@ -5299,7 +5330,7 @@ var Assertions;
5299
5330
  let finalName = name !== null && name !== void 0 ? name : Const_1.MALFORMEDXML;
5300
5331
  let finalMessage = message !== null && message !== void 0 ? message : Const_1.EMPTY_STR;
5301
5332
  //TODO clean up the messy makeException, this is a perfect case for encapsulation and sane defaults
5302
- return makeException(error, finalTitle, finalName, "Response", caller || ((arguments.caller) ? arguments.caller.toString() : "_raiseError"), finalMessage);
5333
+ return Lang_1.ExtLang.makeException(error, finalTitle, finalName, "Response", caller || ((arguments.caller) ? arguments.caller.toString() : "_raiseError"), finalMessage);
5303
5334
  }
5304
5335
  Assertions.raiseError = raiseError;
5305
5336
  /*
@@ -5322,6 +5353,13 @@ var Assertions;
5322
5353
  assertType(value, "function", msg, caller, title);
5323
5354
  }
5324
5355
  Assertions.assertFunction = assertFunction;
5356
+ function assertDelay(value) {
5357
+ if (!(value >= 0)) { // >= 0 abbreviation which covers all cases of non positive values,
5358
+ // including NaN and non numeric strings, no type equality is deliberate here,
5359
+ throw new Error("Invalid delay value: " + value);
5360
+ }
5361
+ }
5362
+ Assertions.assertDelay = assertDelay;
5325
5363
  })(Assertions = exports.Assertions || (exports.Assertions = {}));
5326
5364
 
5327
5365
 
@@ -6137,6 +6175,8 @@ const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-di
6137
6175
  const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
6138
6176
  const Lang_1 = __webpack_require__(/*! ../util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
6139
6177
  const ExtDomQuery_1 = __webpack_require__(/*! ../util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
6178
+ const Assertions_1 = __webpack_require__(/*! ../util/Assertions */ "./src/main/typescript/impl/util/Assertions.ts");
6179
+ var assertDelay = Assertions_1.Assertions.assertDelay;
6140
6180
  /**
6141
6181
  * Resolver functions for various aspects of the request data
6142
6182
  *
@@ -6199,7 +6239,15 @@ exports.resolveTimeout = resolveTimeout;
6199
6239
  function resolveDelay(options) {
6200
6240
  var _a;
6201
6241
  let getCfg = Lang_1.ExtLang.getLocalOrGlobalConfig;
6202
- return (_a = options.getIf(Const_1.CTX_PARAM_DELAY).value) !== null && _a !== void 0 ? _a : getCfg(options.value, Const_1.CTX_PARAM_DELAY, 0);
6242
+ // null or non undefined will automatically be mapped to 0 aka no delay
6243
+ let ret = (_a = options.getIf(Const_1.CTX_PARAM_DELAY).value) !== null && _a !== void 0 ? _a : getCfg(options.value, Const_1.CTX_PARAM_DELAY, 0);
6244
+ // if delay === none, no delay must be used, aka delay 0
6245
+ if ('none' === ret) {
6246
+ ret = 0;
6247
+ }
6248
+ // negative, or invalid values will automatically get a js exception
6249
+ assertDelay(ret);
6250
+ return ret;
6203
6251
  }
6204
6252
  exports.resolveDelay = resolveDelay;
6205
6253
  /**
@@ -6615,16 +6663,21 @@ class ResponseProcessor {
6615
6663
  if (!shadowHead.isPresent()) {
6616
6664
  return;
6617
6665
  }
6618
- let oldHead = ExtDomQuery_1.ExtDomQuery.querySelectorAll(Const_1.TAG_HEAD);
6666
+ let head = ExtDomQuery_1.ExtDomQuery.querySelectorAll(Const_1.TAG_HEAD);
6619
6667
  //delete all to avoid script and style overlays
6620
- oldHead.querySelectorAll(Const_1.SEL_SCRIPTS_STYLES).delete();
6621
- // we cannot replace new elements in the head, but we can eval the elements
6622
- // eval means the scripts will get attached (eval script attach method)
6623
- // but this is done by DomQuery not in this code
6624
- this.storeForEval(shadowHead);
6668
+ // we delete everything
6669
+ head.childNodes.delete();
6670
+ let postProcessTags = ["STYLE", "LINK", "SCRIPT"];
6671
+ shadowHead.stream
6672
+ .filter(item => postProcessTags.indexOf(item.tagName.orElse("").value) == -1)
6673
+ .each(item => {
6674
+ head.append(item);
6675
+ });
6625
6676
  //incoming either the outer head tag or its children
6626
- //shadowHead = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
6627
- //this.addToHead(shadowHead);
6677
+ const nodesToAdd = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
6678
+ // this is stored for post processing
6679
+ // after the rest of the "pyhsical build up", head before body
6680
+ this.addToHead(nodesToAdd);
6628
6681
  }
6629
6682
  addToHead(newElements) {
6630
6683
  this.internalContext.assign(Const_1.DEFERRED_HEAD_INSERTS).value.push(newElements);
Binary file
Binary file