jsf.js_next_gen 4.0.0-beta-11 → 4.0.0-beta-12

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 (146) hide show
  1. package/dist/window/faces-development.js +164 -49
  2. package/dist/window/faces-development.js.br +0 -0
  3. package/dist/window/faces-development.js.gz +0 -0
  4. package/dist/window/faces-development.js.map +1 -1
  5. package/dist/window/faces.js +1 -1
  6. package/dist/window/faces.js.br +0 -0
  7. package/dist/window/faces.js.gz +0 -0
  8. package/dist/window/faces.js.map +1 -1
  9. package/dist/window/jsf-development.js +164 -49
  10. package/dist/window/jsf-development.js.br +0 -0
  11. package/dist/window/jsf-development.js.gz +0 -0
  12. package/dist/window/jsf-development.js.map +1 -1
  13. package/dist/window/jsf.js +1 -1
  14. package/dist/window/jsf.js.br +0 -0
  15. package/dist/window/jsf.js.gz +0 -0
  16. package/dist/window/jsf.js.map +1 -1
  17. package/package.json +3 -3
  18. package/pom.xml +14 -0
  19. package/src/main/java/com/example/jsfs_js_ts/DecoratedFacesJS.java +80 -0
  20. package/src/main/java/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.java +54 -0
  21. package/src/main/typescript/impl/util/ExtDomQuery.ts +10 -6
  22. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +0 -2
  23. package/target/api/{Jsf.js → jsf.js} +0 -0
  24. package/target/api/{Jsf.js.map → jsf.js.map} +0 -0
  25. package/target/impl/util/ExtDomQuery.js +10 -6
  26. package/target/impl/util/ExtDomQuery.js.map +1 -1
  27. package/target/test/frameworkBase/_ext/shared/StandardInits.js +0 -2
  28. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  29. package/src/main/java/com/example/jsfs_js_ts/JsfsJsTsApplication.java +0 -12
  30. package/target/api/_faces.js +0 -251
  31. package/target/api/_faces.js.map +0 -1
  32. package/target/classes/com/example/jsfs_js_ts/JsfsJsTsApplication.class +0 -0
  33. package/target/impl/util/ListenerQueue.js +0 -3
  34. package/target/impl/util/ListenerQueue.js.map +0 -1
  35. package/target/main/typescript/api/Jsf.js +0 -258
  36. package/target/main/typescript/api/Jsf.js.map +0 -1
  37. package/target/main/typescript/impl/AjaxImpl.js +0 -569
  38. package/target/main/typescript/impl/AjaxImpl.js.map +0 -1
  39. package/target/main/typescript/impl/PushImpl.js +0 -215
  40. package/target/main/typescript/impl/PushImpl.js.map +0 -1
  41. package/target/main/typescript/impl/core/Const.js +0 -135
  42. package/target/main/typescript/impl/core/Const.js.map +0 -1
  43. package/target/main/typescript/impl/core/ImplTypes.js +0 -43
  44. package/target/main/typescript/impl/core/ImplTypes.js.map +0 -1
  45. package/target/main/typescript/impl/i18n/Messages.js +0 -114
  46. package/target/main/typescript/impl/i18n/Messages.js.map +0 -1
  47. package/target/main/typescript/impl/util/Assertions.js +0 -90
  48. package/target/main/typescript/impl/util/Assertions.js.map +0 -1
  49. package/target/main/typescript/impl/util/AsyncQueue.js +0 -104
  50. package/target/main/typescript/impl/util/AsyncQueue.js.map +0 -1
  51. package/target/main/typescript/impl/util/AsyncRunnable.js +0 -18
  52. package/target/main/typescript/impl/util/AsyncRunnable.js.map +0 -1
  53. package/target/main/typescript/impl/util/ExtDomQuery.js +0 -129
  54. package/target/main/typescript/impl/util/ExtDomQuery.js.map +0 -1
  55. package/target/main/typescript/impl/util/Lang.js +0 -215
  56. package/target/main/typescript/impl/util/Lang.js.map +0 -1
  57. package/target/main/typescript/impl/util/ListenerQueue.js +0 -3
  58. package/target/main/typescript/impl/util/ListenerQueue.js.map +0 -1
  59. package/target/main/typescript/impl/xhrCore/ErrorData.js +0 -89
  60. package/target/main/typescript/impl/xhrCore/ErrorData.js.map +0 -1
  61. package/target/main/typescript/impl/xhrCore/EventData.js +0 -30
  62. package/target/main/typescript/impl/xhrCore/EventData.js.map +0 -1
  63. package/target/main/typescript/impl/xhrCore/IResponseProcessor.js +0 -3
  64. package/target/main/typescript/impl/xhrCore/IResponseProcessor.js.map +0 -1
  65. package/target/main/typescript/impl/xhrCore/RequestDataResolver.js +0 -143
  66. package/target/main/typescript/impl/xhrCore/RequestDataResolver.js.map +0 -1
  67. package/target/main/typescript/impl/xhrCore/ResonseDataResolver.js +0 -103
  68. package/target/main/typescript/impl/xhrCore/ResonseDataResolver.js.map +0 -1
  69. package/target/main/typescript/impl/xhrCore/Response.js +0 -167
  70. package/target/main/typescript/impl/xhrCore/Response.js.map +0 -1
  71. package/target/main/typescript/impl/xhrCore/ResponseProcessor.js +0 -368
  72. package/target/main/typescript/impl/xhrCore/ResponseProcessor.js.map +0 -1
  73. package/target/main/typescript/impl/xhrCore/XhrFormData.js +0 -272
  74. package/target/main/typescript/impl/xhrCore/XhrFormData.js.map +0 -1
  75. package/target/main/typescript/impl/xhrCore/XhrRequest.js +0 -281
  76. package/target/main/typescript/impl/xhrCore/XhrRequest.js.map +0 -1
  77. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.js +0 -293
  78. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.js.map +0 -1
  79. package/target/test/frameworkBase/_ext/monadish/LangTest.js +0 -89
  80. package/target/test/frameworkBase/_ext/monadish/LangTest.js.map +0 -1
  81. package/target/test/frameworkBase/_ext/monadish/MappingTest.js +0 -39
  82. package/target/test/frameworkBase/_ext/monadish/MappingTest.js.map +0 -1
  83. package/target/test/frameworkBase/_ext/monadish/MonadTest.js +0 -155
  84. package/target/test/frameworkBase/_ext/monadish/MonadTest.js.map +0 -1
  85. package/target/test/frameworkBase/_ext/monadish/StreamTest.js +0 -176
  86. package/target/test/frameworkBase/_ext/monadish/StreamTest.js.map +0 -1
  87. package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.js +0 -1
  88. package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.js.map +0 -1
  89. package/target/test/impl/ImplTest_23.spec_.js +0 -165
  90. package/target/test/impl/ImplTest_23.spec_.js.map +0 -1
  91. package/target/test/typescript/frameworkBase/LangTest.js +0 -112
  92. package/target/test/typescript/frameworkBase/LangTest.js.map +0 -1
  93. package/target/test/typescript/frameworkBase/_ext/monadish/DomQueryTest.js +0 -293
  94. package/target/test/typescript/frameworkBase/_ext/monadish/DomQueryTest.js.map +0 -1
  95. package/target/test/typescript/frameworkBase/_ext/monadish/LangTest.js +0 -89
  96. package/target/test/typescript/frameworkBase/_ext/monadish/LangTest.js.map +0 -1
  97. package/target/test/typescript/frameworkBase/_ext/monadish/MappingProbes.js +0 -115
  98. package/target/test/typescript/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
  99. package/target/test/typescript/frameworkBase/_ext/monadish/MappingTest.js +0 -39
  100. package/target/test/typescript/frameworkBase/_ext/monadish/MappingTest.js.map +0 -1
  101. package/target/test/typescript/frameworkBase/_ext/monadish/MonadTest.js +0 -155
  102. package/target/test/typescript/frameworkBase/_ext/monadish/MonadTest.js.map +0 -1
  103. package/target/test/typescript/frameworkBase/_ext/monadish/StreamTest.js +0 -176
  104. package/target/test/typescript/frameworkBase/_ext/monadish/StreamTest.js.map +0 -1
  105. package/target/test/typescript/frameworkBase/_ext/monadish/XmlQueryTest.js +0 -1
  106. package/target/test/typescript/frameworkBase/_ext/monadish/XmlQueryTest.js.map +0 -1
  107. package/target/test/typescript/frameworkBase/_ext/shared/StandardInits.js +0 -264
  108. package/target/test/typescript/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
  109. package/target/test/typescript/frameworkBase/_ext/shared/XmlResponses.js +0 -23
  110. package/target/test/typescript/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
  111. package/target/test/typescript/impl/ImplTest.js +0 -98
  112. package/target/test/typescript/impl/ImplTest.js.map +0 -1
  113. package/target/test/typescript/impl/SeparatorCharsTest.js +0 -72
  114. package/target/test/typescript/impl/SeparatorCharsTest.js.map +0 -1
  115. package/target/test/typescript/queue/AsynchronousProbe.js +0 -99
  116. package/target/test/typescript/queue/AsynchronousProbe.js.map +0 -1
  117. package/target/test/typescript/queue/AsynchronousQueueTest.js +0 -130
  118. package/target/test/typescript/queue/AsynchronousQueueTest.js.map +0 -1
  119. package/target/test/typescript/xhrCore/EventTests.js +0 -155
  120. package/target/test/typescript/xhrCore/EventTests.js.map +0 -1
  121. package/target/test/typescript/xhrCore/FakeWebsocket.js +0 -25
  122. package/target/test/typescript/xhrCore/FakeWebsocket.js.map +0 -1
  123. package/target/test/typescript/xhrCore/FileUploadTest.js +0 -166
  124. package/target/test/typescript/xhrCore/FileUploadTest.js.map +0 -1
  125. package/target/test/typescript/xhrCore/RequestParamsTest.js +0 -151
  126. package/target/test/typescript/xhrCore/RequestParamsTest.js.map +0 -1
  127. package/target/test/typescript/xhrCore/RequestTest.js +0 -318
  128. package/target/test/typescript/xhrCore/RequestTest.js.map +0 -1
  129. package/target/test/typescript/xhrCore/ResponseTest.js +0 -257
  130. package/target/test/typescript/xhrCore/ResponseTest.js.map +0 -1
  131. package/target/test/typescript/xhrCore/ShadowDomTest.js +0 -122
  132. package/target/test/typescript/xhrCore/ShadowDomTest.js.map +0 -1
  133. package/target/test/typescript/xhrCore/WebsocketTest.js +0 -182
  134. package/target/test/typescript/xhrCore/WebsocketTest.js.map +0 -1
  135. package/target/test/typescript/xhrCore/XhrFormDataTest.js +0 -58
  136. package/target/test/typescript/xhrCore/XhrFormDataTest.js.map +0 -1
  137. package/target/test-classes/.gz +0 -0
  138. package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
  139. package/target/test-classes/fileuploadtest.html +0 -24
  140. package/target/test-classes/jsf-development.js +0 -6781
  141. package/target/test-classes/jsf-development.js.br +0 -0
  142. package/target/test-classes/jsf-development.js.gz +0 -0
  143. package/target/test-classes/jsf-development.js.map +0 -1
  144. package/target/test-classes/jsf.js +0 -3
  145. package/target/test-classes/jsf.js.br +0 -0
  146. package/target/test-classes/jsf.js.gz +0 -0
@@ -35,7 +35,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
35
35
  });
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", ({ value: true }));
38
- exports.DQ = exports.DomQueryCollector = exports.DomQuery = exports.Style = exports.ElementAttribute = void 0;
38
+ exports.DQ$ = exports.DQ = exports.DomQueryCollector = exports.DomQuery = exports.Style = exports.ElementAttribute = void 0;
39
39
  const Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
40
40
  const Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
41
41
  const SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
@@ -64,10 +64,12 @@ var Submittables;
64
64
  /**
65
65
  * helper to fix a common problem that a system has to wait until a certain condition is reached
66
66
  * depening on the browser this uses either the mutation observer or a semi compatible interval as fallback
67
- * @param condition
67
+ * @param root the root domquery element to start from
68
+ * @param condition the condition lambda to be fullfilled
69
+ * @param options options for the search
68
70
  */
69
71
  function waitUntilDom(root, condition, options = { attributes: true, childList: true, subtree: true, timeout: 500, interval: 100 }) {
70
- const ret = new Promise((success, error) => {
72
+ return new Promise((success, error) => {
71
73
  const MUT_ERROR = new Error("Mutation observer timeout");
72
74
  //we do the same but for now ignore the options on the dom query
73
75
  //we cannot use absent here, because the condition might search for an absent element
@@ -88,7 +90,7 @@ function waitUntilDom(root, condition, options = { attributes: true, childList:
88
90
  return found;
89
91
  }
90
92
  let foundElement = root;
91
- if (foundElement = findElement(foundElement, condition)) {
93
+ if ((foundElement = findElement(foundElement, condition)) != null) {
92
94
  success(new DomQuery(foundElement));
93
95
  return;
94
96
  }
@@ -96,7 +98,7 @@ function waitUntilDom(root, condition, options = { attributes: true, childList:
96
98
  const mutTimeout = setTimeout(() => {
97
99
  return error(MUT_ERROR);
98
100
  }, options.timeout);
99
- const callback = (mutationList, observer) => {
101
+ const callback = (mutationList) => {
100
102
  const found = new DomQuery(mutationList.map((mut) => mut.target)).first(condition);
101
103
  if (found) {
102
104
  clearTimeout(mutTimeout);
@@ -132,7 +134,6 @@ function waitUntilDom(root, condition, options = { attributes: true, childList:
132
134
  }, options.timeout);
133
135
  }
134
136
  });
135
- return ret;
136
137
  }
137
138
  class ElementAttribute extends Monad_1.ValueEmbedder {
138
139
  constructor(element, name, defaultVal = null) {
@@ -193,10 +194,9 @@ class Style extends Monad_1.ValueEmbedder {
193
194
  exports.Style = Style;
194
195
  /**
195
196
  * small helper for the specialized jsf case
196
- * @param src
197
197
  * @constructor
198
198
  */
199
- const DEFAULT_WHITELIST = (src) => {
199
+ const DEFAULT_WHITELIST = () => {
200
200
  return true;
201
201
  };
202
202
  /**
@@ -235,7 +235,6 @@ class DomQuery {
235
235
  if (!rootNode[cnt]) {
236
236
  //we skip possible null entries which can happen in
237
237
  //certain corner conditions due to the constructor re-wrapping single elements into arrays.
238
- continue;
239
238
  }
240
239
  else if (isString(rootNode[cnt])) {
241
240
  let foundElement = DomQuery.querySelectorAll(rootNode[cnt]);
@@ -324,6 +323,12 @@ class DomQuery {
324
323
  return Monad_1.ValueEmbedder.absent;
325
324
  }
326
325
  }
326
+ get val() {
327
+ return this.inputValue.value;
328
+ }
329
+ set val(value) {
330
+ this.inputValue.value = value;
331
+ }
327
332
  get checked() {
328
333
  return Stream_1.Stream.of(...this.values).allMatch(el => !!el.checked);
329
334
  }
@@ -409,6 +414,30 @@ class DomQuery {
409
414
  return DomQuery.byId(item);
410
415
  }).collect(new SourcesCollectors_1.ArrayCollector()));
411
416
  }
417
+ get offsetWidth() {
418
+ return Stream_1.LazyStream.of(...this.rootNode)
419
+ .filter(item => item != null)
420
+ .map(elem => elem.offsetWidth)
421
+ .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
422
+ }
423
+ get offsetHeight() {
424
+ return Stream_1.LazyStream.of(...this.rootNode)
425
+ .filter(item => item != null)
426
+ .map(elem => elem.offsetHeight)
427
+ .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
428
+ }
429
+ get offsetLeft() {
430
+ return Stream_1.LazyStream.of(...this.rootNode)
431
+ .filter(item => item != null)
432
+ .map(elem => elem.offsetLeft)
433
+ .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
434
+ }
435
+ get offsetTop() {
436
+ return Stream_1.LazyStream.of(...this.rootNode)
437
+ .filter(item => item != null)
438
+ .map(elem => elem.offsetTop)
439
+ .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
440
+ }
412
441
  get asNodeArray() {
413
442
  return [].concat(Stream_1.Stream.of(this.rootNode).filter(item => item != null).collect(new SourcesCollectors_1.ArrayCollector()));
414
443
  }
@@ -433,6 +462,7 @@ class DomQuery {
433
462
  * byId producer
434
463
  *
435
464
  * @param selector id
465
+ * @param deep true if you want to go into shadow areas
436
466
  * @return a DomQuery containing the found elements
437
467
  */
438
468
  static byId(selector, deep = false) {
@@ -615,7 +645,6 @@ class DomQuery {
615
645
  if (!((_a = this === null || this === void 0 ? void 0 : this.rootNode) === null || _a === void 0 ? void 0 : _a.length)) {
616
646
  return this;
617
647
  }
618
- let nodes = [];
619
648
  let foundNodes = new DomQuery(...this.rootNode);
620
649
  let selectors = selector.split(/\/shadow\//);
621
650
  for (let cnt2 = 0; cnt2 < selectors.length; cnt2++) {
@@ -665,8 +694,9 @@ class DomQuery {
665
694
  }
666
695
  /**
667
696
  * same as byId just for the tag name
668
- * @param tagName
669
- * @param includeRoot
697
+ * @param tagName the tagname to search for
698
+ * @param includeRoot shall the root element be part of this search
699
+ * @param deep do we also want to go into shadow dom areas
670
700
  */
671
701
  byTagName(tagName, includeRoot, deep) {
672
702
  var _a;
@@ -731,10 +761,9 @@ class DomQuery {
731
761
  */
732
762
  isMultipartCandidate(deep = false) {
733
763
  const FILE_INPUT = "input[type='file']";
734
- const ret = this.matchesSelector(FILE_INPUT) ||
764
+ return this.matchesSelector(FILE_INPUT) ||
735
765
  ((!deep) ? this.querySelectorAll(FILE_INPUT) :
736
766
  this.querySelectorAllDeep(FILE_INPUT)).first().isPresent();
737
- return ret;
738
767
  }
739
768
  /**
740
769
  * innerHtml equivalkent
@@ -747,9 +776,9 @@ class DomQuery {
747
776
  */
748
777
  html(inval) {
749
778
  if (Monad_1.Optional.fromNullable(inval).isAbsent()) {
750
- return this.isPresent() ? Monad_1.Optional.fromNullable(this.innerHtml) : Monad_1.Optional.absent;
779
+ return this.isPresent() ? Monad_1.Optional.fromNullable(this.innerHTML) : Monad_1.Optional.absent;
751
780
  }
752
- this.innerHtml = inval;
781
+ this.innerHTML = inval;
753
782
  return this;
754
783
  }
755
784
  /**
@@ -759,14 +788,20 @@ class DomQuery {
759
788
  this.eachElem(elem => elem.dispatchEvent(evt));
760
789
  return this;
761
790
  }
762
- set innerHtml(inVal) {
791
+ set innerHTML(inVal) {
763
792
  this.eachElem(elem => elem.innerHTML = inVal);
764
793
  }
765
- get innerHtml() {
794
+ get innerHTML() {
766
795
  let retArr = [];
767
796
  this.eachElem(elem => retArr.push(elem.innerHTML));
768
797
  return retArr.join("");
769
798
  }
799
+ set innerHtml(inval) {
800
+ this.innerHTML = inval;
801
+ }
802
+ get innerHtml() {
803
+ return this.innerHTML;
804
+ }
770
805
  //source: https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
771
806
  //code snippet license: https://creativecommons.org/licenses/by-sa/2.5/
772
807
  _mozMatchesSelector(toMatch, selector) {
@@ -845,6 +880,12 @@ class DomQuery {
845
880
  }
846
881
  return this;
847
882
  }
883
+ lastElem(func = item => item) {
884
+ if (this.rootNode.length > 1) {
885
+ func(this.rootNode[this.rootNode.length - 1], 0);
886
+ }
887
+ return this;
888
+ }
848
889
  each(func) {
849
890
  Stream_1.Stream.of(...this.rootNode)
850
891
  .each((item, cnt) => {
@@ -868,6 +909,19 @@ class DomQuery {
868
909
  }
869
910
  return this;
870
911
  }
912
+ /**
913
+ * returns a new dom query containing only the first element max
914
+ *
915
+ * @param func a an optional callback function to perform an operation on the first element
916
+ */
917
+ last(func = (item) => item) {
918
+ if (this.rootNode.length >= 1) {
919
+ let lastNode = this.get(this.rootNode.length - 1);
920
+ func(lastNode, 0);
921
+ return lastNode;
922
+ }
923
+ return this;
924
+ }
871
925
  /**
872
926
  * filter function which filters a subset
873
927
  *
@@ -891,7 +945,12 @@ class DomQuery {
891
945
  let head = document.getElementsByTagName("head")[0] || document.documentElement;
892
946
  let script = document.createElement("script");
893
947
  if (nonce) {
894
- script.setAttribute("nonce", nonce);
948
+ if ('undefined' != typeof (script === null || script === void 0 ? void 0 : script.nonce)) {
949
+ script.nonce = nonce;
950
+ }
951
+ else {
952
+ script.setAttribute("nonce", nonce);
953
+ }
895
954
  }
896
955
  script.type = "text/javascript";
897
956
  script.innerHTML = code;
@@ -902,7 +961,6 @@ class DomQuery {
902
961
  /**
903
962
  * detaches a set of nodes from their parent elements
904
963
  * in a browser independend manner
905
- * @param {Object} items the items which need to be detached
906
964
  * @return {Array} an array of nodes with the detached dom nodes
907
965
  */
908
966
  detach() {
@@ -917,15 +975,20 @@ class DomQuery {
917
975
  * @param elem
918
976
  */
919
977
  appendTo(elem) {
978
+ if (Lang_1.Lang.isString(elem)) {
979
+ this.appendTo(DomQuery.querySelectorAll(elem));
980
+ return this;
981
+ }
920
982
  this.eachElem((item) => {
921
983
  let value1 = elem.getAsElem(0).orElseLazy(() => {
922
984
  return {
923
- appendChild: (theItem) => {
985
+ appendChild: () => {
924
986
  }
925
987
  };
926
988
  }).value;
927
989
  value1.appendChild(item);
928
990
  });
991
+ return this;
929
992
  }
930
993
  /**
931
994
  * loads and evals a script from a source uri
@@ -934,25 +997,25 @@ class DomQuery {
934
997
  * @param defer in miliseconds execution default (0 == no defer)
935
998
  * @param charSet
936
999
  */
937
- loadScriptEval(src, defer = 0, charSet = "utf-8") {
1000
+ loadScriptEval(src, defer = 0, charSet = "utf-8", nonce) {
938
1001
  let xhr = new XMLHttpRequest();
939
1002
  xhr.open("GET", src, false);
940
1003
  if (charSet) {
941
1004
  xhr.setRequestHeader("Content-Type", "application/x-javascript; charset:" + charSet);
942
1005
  }
943
- xhr.onload = (responseData) => {
1006
+ xhr.onload = () => {
944
1007
  //defer also means we have to process after the ajax response
945
1008
  //has been processed
946
1009
  //we can achieve that with a small timeout, the timeout
947
1010
  //triggers after the processing is done!
948
1011
  if (!defer) {
949
- this.globalEval(xhr.responseText.replace(/\n/g, "\r\n") + "\r\n//@ sourceURL=" + src);
1012
+ this.globalEval(xhr.responseText.replace(/\n/g, "\r\n") + "\r\n//@ sourceURL=" + src, nonce);
950
1013
  }
951
1014
  else {
952
1015
  //TODO not ideal we maybe ought to move to something else here
953
1016
  //but since it is not in use yet, it is ok
954
1017
  setTimeout(() => {
955
- this.globalEval(xhr.responseText + "\r\n//@ sourceURL=" + src);
1018
+ this.globalEval(xhr.responseText + "\r\n//@ sourceURL=" + src, nonce);
956
1019
  }, defer);
957
1020
  }
958
1021
  };
@@ -1079,9 +1142,10 @@ class DomQuery {
1079
1142
  * for instance for your jsf.js we have a full
1080
1143
  * replace pattern which needs outerHTML processing
1081
1144
  *
1082
- * @param markup
1083
- * @param runEmbeddedScripts
1084
- * @param runEmbeddedCss
1145
+ * @param markup the markup which should replace the root element
1146
+ * @param runEmbeddedScripts if true the embedded scripts are executed
1147
+ * @param runEmbeddedCss if true the embeddec css are executed
1148
+ * @param deep should this also work for shadow dom (run scripts etc...)
1085
1149
  */
1086
1150
  outerHTML(markup, runEmbeddedScripts, runEmbeddedCss, deep = false) {
1087
1151
  var _a;
@@ -1126,7 +1190,33 @@ class DomQuery {
1126
1190
  * defaults to the standard jsf.js exclusion (we use this code for myfaces)
1127
1191
  */
1128
1192
  runScripts(whilteListed = DEFAULT_WHITELIST) {
1193
+ const evalCollectedScripts = (finalScripts) => {
1194
+ if (finalScripts.length) {
1195
+ //script source means we have to eval the existing
1196
+ //scripts before running the include
1197
+ //this.globalEval(finalScripts.join("\n"));
1198
+ let joinedScripts = [];
1199
+ Stream_1.Stream.of(...finalScripts).each(item => {
1200
+ if (item.nonce == 'evalText') {
1201
+ joinedScripts.push(item.evalText);
1202
+ }
1203
+ else {
1204
+ if (joinedScripts.length) {
1205
+ this.globalEval(joinedScripts.join("\n"));
1206
+ joinedScripts.length = 0;
1207
+ }
1208
+ this.globalEval(item.evalText, item.nonce);
1209
+ }
1210
+ });
1211
+ if (joinedScripts.length) {
1212
+ this.globalEval(joinedScripts.join("\n"));
1213
+ joinedScripts.length = 0;
1214
+ }
1215
+ finalScripts = [];
1216
+ }
1217
+ };
1129
1218
  let finalScripts = [], equi = equalsIgnoreCase, execScrpt = (item) => {
1219
+ var _a, _b, _c;
1130
1220
  let tagName = item.tagName;
1131
1221
  let itemType = item.type || "";
1132
1222
  if (tagName && equi(tagName, "script") &&
@@ -1138,17 +1228,15 @@ class DomQuery {
1138
1228
  if ('undefined' != typeof src
1139
1229
  && null != src
1140
1230
  && src.length > 0) {
1231
+ let nonce = (_a = item === null || item === void 0 ? void 0 : item.nonce) !== null && _a !== void 0 ? _a : item.getAttribute('nonce').value;
1141
1232
  //we have to move this into an inner if because chrome otherwise chokes
1142
1233
  //due to changing the and order instead of relying on left to right
1143
1234
  //if jsf.js is already registered we do not replace it anymore
1144
1235
  if (whilteListed(src)) {
1145
- if (finalScripts.length) {
1146
- //script source means we have to eval the existing
1147
- //scripts before running the include
1148
- this.globalEval(finalScripts.join("\n"));
1149
- finalScripts = [];
1150
- }
1151
- this.loadScriptEval(src, 0, "UTF-8");
1236
+ evalCollectedScripts(finalScripts);
1237
+ nonce != '' ? this.loadScriptEval(src, 0, "UTF-8", nonce) :
1238
+ //if no nonce is set we do not pass any once
1239
+ this.loadScriptEval(src, 0, "UTF-8");
1152
1240
  }
1153
1241
  }
1154
1242
  else {
@@ -1172,9 +1260,13 @@ class DomQuery {
1172
1260
  go = true;
1173
1261
  }
1174
1262
  }
1263
+ let nonce = (_c = (_b = item === null || item === void 0 ? void 0 : item.nonce) !== null && _b !== void 0 ? _b : item.getAttribute('nonce').value) !== null && _c !== void 0 ? _c : '';
1175
1264
  // we have to run the script under a global context
1176
1265
  //we store the script for less calls to eval
1177
- finalScripts.push(evalText);
1266
+ finalScripts.push({
1267
+ nonce,
1268
+ evalText
1269
+ });
1178
1270
  }
1179
1271
  }
1180
1272
  };
@@ -1185,9 +1277,7 @@ class DomQuery {
1185
1277
  .flatMap(item => Stream_1.Stream.of(item.values))
1186
1278
  .sort((node1, node2) => node1.compareDocumentPosition(node2) - 3) //preceding 2, following == 4)
1187
1279
  .each(item => execScrpt(item));
1188
- if (finalScripts.length) {
1189
- this.globalEval(finalScripts.join("\n"));
1190
- }
1280
+ evalCollectedScripts(finalScripts);
1191
1281
  }
1192
1282
  catch (e) {
1193
1283
  if (console && console.error) {
@@ -1301,7 +1391,6 @@ class DomQuery {
1301
1391
  break;
1302
1392
  default:
1303
1393
  throw "fireEvent: Couldn't find an event class for event '" + eventName + "'.";
1304
- break;
1305
1394
  }
1306
1395
  let event = doc.createEvent(eventClass);
1307
1396
  event.initEvent(eventName, true, true); // All events created as bubbling and cancelable.
@@ -1422,7 +1511,6 @@ class DomQuery {
1422
1511
  return target;
1423
1512
  }
1424
1513
  get cDATAAsString() {
1425
- let cDataBlock = [];
1426
1514
  let TYPE_CDATA_BLOCK = 4;
1427
1515
  let res = this.lazyStream.flatMap(item => {
1428
1516
  return item.childNodes.stream;
@@ -1580,7 +1668,8 @@ class DomQuery {
1580
1668
  }
1581
1669
  /**
1582
1670
  * concats the elements of two Dom Queries into a single one
1583
- * @param toAttach
1671
+ * @param toAttach the elements to attach
1672
+ * @param filterDoubles filter out possible double elements (aka same markup)
1584
1673
  */
1585
1674
  concat(toAttach, filterDoubles = true) {
1586
1675
  const ret = this.lazyStream.concat(toAttach.lazyStream).collect(new DomQueryCollector());
@@ -1595,6 +1684,22 @@ class DomQuery {
1595
1684
  return notFound;
1596
1685
  }).collect(new DomQueryCollector());
1597
1686
  }
1687
+ append(elem) {
1688
+ this.each(item => elem.appendTo(item));
1689
+ return this;
1690
+ }
1691
+ prependTo(elem) {
1692
+ elem.eachElem(item => {
1693
+ item.prepend(...this.allElems());
1694
+ });
1695
+ return this;
1696
+ }
1697
+ prepend(elem) {
1698
+ this.eachElem(item => {
1699
+ item.prepend(...elem.allElems());
1700
+ });
1701
+ return this;
1702
+ }
1598
1703
  }
1599
1704
  exports.DomQuery = DomQuery;
1600
1705
  DomQuery.absent = new DomQuery();
@@ -1623,6 +1728,11 @@ exports.DomQueryCollector = DomQueryCollector;
1623
1728
  * abbreviation for DomQuery
1624
1729
  */
1625
1730
  exports.DQ = DomQuery;
1731
+ // noinspection JSUnusedGlobalSymbols
1732
+ /**
1733
+ * replacement for the jquery $
1734
+ */
1735
+ exports.DQ$ = DomQuery.querySelectorAll;
1626
1736
 
1627
1737
 
1628
1738
  /***/ }),
@@ -3349,7 +3459,7 @@ exports.XQ = XMLQuery;
3349
3459
 
3350
3460
 
3351
3461
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3352
- exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.ArrayCollector = exports.QueryFormStringCollector = exports.SequenceDataSource = exports.FlatMapStreamDataSource = exports.FilteredStreamDatasource = exports.MappedStreamDataSource = exports.ArrayStreamDataSource = exports.LazyStream = exports.Stream = exports.XQ = exports.XMLQuery = exports.ValueEmbedder = exports.Optional = exports.Monad = exports.Config = exports.Lang = exports.DQ = exports.DomQueryCollector = exports.ElementAttribute = exports.DomQuery = void 0;
3462
+ exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.ArrayCollector = exports.QueryFormStringCollector = exports.SequenceDataSource = exports.FlatMapStreamDataSource = exports.FilteredStreamDatasource = exports.MappedStreamDataSource = exports.ArrayStreamDataSource = exports.LazyStream = exports.Stream = exports.XQ = exports.XMLQuery = exports.ValueEmbedder = exports.Optional = exports.Monad = exports.Config = exports.Lang = exports.DQ$ = exports.DQ = exports.DomQueryCollector = exports.ElementAttribute = exports.DomQuery = void 0;
3353
3463
  /*!
3354
3464
  * Licensed to the Apache Software Foundation (ASF) under one
3355
3465
  * or more contributor license agreements. See the NOTICE file
@@ -3373,6 +3483,7 @@ Object.defineProperty(exports, "DomQuery", ({ enumerable: true, get: function ()
3373
3483
  Object.defineProperty(exports, "ElementAttribute", ({ enumerable: true, get: function () { return DomQuery_1.ElementAttribute; } }));
3374
3484
  Object.defineProperty(exports, "DomQueryCollector", ({ enumerable: true, get: function () { return DomQuery_1.DomQueryCollector; } }));
3375
3485
  Object.defineProperty(exports, "DQ", ({ enumerable: true, get: function () { return DomQuery_1.DQ; } }));
3486
+ Object.defineProperty(exports, "DQ$", ({ enumerable: true, get: function () { return DomQuery_1.DQ$; } }));
3376
3487
  var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
3377
3488
  Object.defineProperty(exports, "Lang", ({ enumerable: true, get: function () { return Lang_1.Lang; } }));
3378
3489
  var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
@@ -5195,22 +5306,26 @@ class ExtDomquery extends mona_dish_1.DQ {
5195
5306
  }
5196
5307
  let curScript = new mona_dish_1.DQ(document.currentScript);
5197
5308
  //since our baseline atm is ie11 we cannot use document.currentScript globally
5198
- if (curScript.attr("nonce").value != null) {
5309
+ if (!!this.extractNonce(curScript)) {
5199
5310
  // fastpath for modern browsers
5200
- return curScript.attr("nonce").value;
5311
+ return this.extractNonce(curScript);
5201
5312
  }
5202
5313
  // fallback if the currentScript method fails, we just search the jsf tags for nonce, this is
5203
5314
  // the last possibility
5204
5315
  let nonceScript = mona_dish_1.DQ
5205
5316
  .querySelectorAll("script[src], link[src]")
5206
5317
  .lazyStream
5207
- .filter((item) => item.attr("nonce").value != null && item.attr(ATTR_SRC) != null)
5208
- .map(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))
5318
+ .filter((item) => this.extractNonce(item) && item.attr(ATTR_SRC) != null)
5319
+ .filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))
5209
5320
  .first();
5210
5321
  if (nonceScript.isPresent()) {
5211
- nonce.value = mona_dish_1.DomQuery.byId(nonceScript.value, true).attr("nonce").value;
5322
+ return this.extractNonce(nonceScript.value);
5212
5323
  }
5213
- return nonce.value;
5324
+ return null;
5325
+ }
5326
+ extractNonce(curScript) {
5327
+ var _a, _b;
5328
+ return (_b = (_a = curScript.getAsElem(0).value) === null || _a === void 0 ? void 0 : _a.nonce) !== null && _b !== void 0 ? _b : curScript.attr("nonce").value;
5214
5329
  }
5215
5330
  static searchJsfJsFor(item) {
5216
5331
  return new ExtDomquery(document).searchJsfJsFor(item);
Binary file
Binary file