jsf.js_next_gen 4.0.0-beta-11 → 4.0.0-beta-13
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.
- package/dist/window/faces-development.js +165 -49
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +165 -49
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +3 -3
- package/pom.xml +14 -0
- package/src/main/java/com/example/jsfs_js_ts/DecoratedFacesJS.java +80 -0
- package/src/main/java/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.java +54 -0
- package/src/main/typescript/impl/util/ExtDomQuery.ts +10 -6
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +0 -2
- package/target/api/{Jsf.js → jsf.js} +0 -0
- package/target/api/{Jsf.js.map → jsf.js.map} +0 -0
- package/target/impl/util/ExtDomQuery.js +10 -6
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +0 -2
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/src/main/java/com/example/jsfs_js_ts/JsfsJsTsApplication.java +0 -12
- package/target/api/_faces.js +0 -251
- package/target/api/_faces.js.map +0 -1
- package/target/classes/com/example/jsfs_js_ts/JsfsJsTsApplication.class +0 -0
- package/target/impl/util/ListenerQueue.js +0 -3
- package/target/impl/util/ListenerQueue.js.map +0 -1
- package/target/main/typescript/api/Jsf.js +0 -258
- package/target/main/typescript/api/Jsf.js.map +0 -1
- package/target/main/typescript/impl/AjaxImpl.js +0 -569
- package/target/main/typescript/impl/AjaxImpl.js.map +0 -1
- package/target/main/typescript/impl/PushImpl.js +0 -215
- package/target/main/typescript/impl/PushImpl.js.map +0 -1
- package/target/main/typescript/impl/core/Const.js +0 -135
- package/target/main/typescript/impl/core/Const.js.map +0 -1
- package/target/main/typescript/impl/core/ImplTypes.js +0 -43
- package/target/main/typescript/impl/core/ImplTypes.js.map +0 -1
- package/target/main/typescript/impl/i18n/Messages.js +0 -114
- package/target/main/typescript/impl/i18n/Messages.js.map +0 -1
- package/target/main/typescript/impl/util/Assertions.js +0 -90
- package/target/main/typescript/impl/util/Assertions.js.map +0 -1
- package/target/main/typescript/impl/util/AsyncQueue.js +0 -104
- package/target/main/typescript/impl/util/AsyncQueue.js.map +0 -1
- package/target/main/typescript/impl/util/AsyncRunnable.js +0 -18
- package/target/main/typescript/impl/util/AsyncRunnable.js.map +0 -1
- package/target/main/typescript/impl/util/ExtDomQuery.js +0 -129
- package/target/main/typescript/impl/util/ExtDomQuery.js.map +0 -1
- package/target/main/typescript/impl/util/Lang.js +0 -215
- package/target/main/typescript/impl/util/Lang.js.map +0 -1
- package/target/main/typescript/impl/util/ListenerQueue.js +0 -3
- package/target/main/typescript/impl/util/ListenerQueue.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/ErrorData.js +0 -89
- package/target/main/typescript/impl/xhrCore/ErrorData.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/EventData.js +0 -30
- package/target/main/typescript/impl/xhrCore/EventData.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/IResponseProcessor.js +0 -3
- package/target/main/typescript/impl/xhrCore/IResponseProcessor.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/RequestDataResolver.js +0 -143
- package/target/main/typescript/impl/xhrCore/RequestDataResolver.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/ResonseDataResolver.js +0 -103
- package/target/main/typescript/impl/xhrCore/ResonseDataResolver.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/Response.js +0 -167
- package/target/main/typescript/impl/xhrCore/Response.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/ResponseProcessor.js +0 -368
- package/target/main/typescript/impl/xhrCore/ResponseProcessor.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/XhrFormData.js +0 -272
- package/target/main/typescript/impl/xhrCore/XhrFormData.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/XhrRequest.js +0 -281
- package/target/main/typescript/impl/xhrCore/XhrRequest.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.js +0 -293
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/LangTest.js +0 -89
- package/target/test/frameworkBase/_ext/monadish/LangTest.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/MappingTest.js +0 -39
- package/target/test/frameworkBase/_ext/monadish/MappingTest.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/MonadTest.js +0 -155
- package/target/test/frameworkBase/_ext/monadish/MonadTest.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/StreamTest.js +0 -176
- package/target/test/frameworkBase/_ext/monadish/StreamTest.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.js +0 -1
- package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.js.map +0 -1
- package/target/test/impl/ImplTest_23.spec_.js +0 -165
- package/target/test/impl/ImplTest_23.spec_.js.map +0 -1
- package/target/test/typescript/frameworkBase/LangTest.js +0 -112
- package/target/test/typescript/frameworkBase/LangTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/DomQueryTest.js +0 -293
- package/target/test/typescript/frameworkBase/_ext/monadish/DomQueryTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/LangTest.js +0 -89
- package/target/test/typescript/frameworkBase/_ext/monadish/LangTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/MappingProbes.js +0 -115
- package/target/test/typescript/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/MappingTest.js +0 -39
- package/target/test/typescript/frameworkBase/_ext/monadish/MappingTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/MonadTest.js +0 -155
- package/target/test/typescript/frameworkBase/_ext/monadish/MonadTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/StreamTest.js +0 -176
- package/target/test/typescript/frameworkBase/_ext/monadish/StreamTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/XmlQueryTest.js +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/XmlQueryTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/shared/StandardInits.js +0 -264
- package/target/test/typescript/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/shared/XmlResponses.js +0 -23
- package/target/test/typescript/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
- package/target/test/typescript/impl/ImplTest.js +0 -98
- package/target/test/typescript/impl/ImplTest.js.map +0 -1
- package/target/test/typescript/impl/SeparatorCharsTest.js +0 -72
- package/target/test/typescript/impl/SeparatorCharsTest.js.map +0 -1
- package/target/test/typescript/queue/AsynchronousProbe.js +0 -99
- package/target/test/typescript/queue/AsynchronousProbe.js.map +0 -1
- package/target/test/typescript/queue/AsynchronousQueueTest.js +0 -130
- package/target/test/typescript/queue/AsynchronousQueueTest.js.map +0 -1
- package/target/test/typescript/xhrCore/EventTests.js +0 -155
- package/target/test/typescript/xhrCore/EventTests.js.map +0 -1
- package/target/test/typescript/xhrCore/FakeWebsocket.js +0 -25
- package/target/test/typescript/xhrCore/FakeWebsocket.js.map +0 -1
- package/target/test/typescript/xhrCore/FileUploadTest.js +0 -166
- package/target/test/typescript/xhrCore/FileUploadTest.js.map +0 -1
- package/target/test/typescript/xhrCore/RequestParamsTest.js +0 -151
- package/target/test/typescript/xhrCore/RequestParamsTest.js.map +0 -1
- package/target/test/typescript/xhrCore/RequestTest.js +0 -318
- package/target/test/typescript/xhrCore/RequestTest.js.map +0 -1
- package/target/test/typescript/xhrCore/ResponseTest.js +0 -257
- package/target/test/typescript/xhrCore/ResponseTest.js.map +0 -1
- package/target/test/typescript/xhrCore/ShadowDomTest.js +0 -122
- package/target/test/typescript/xhrCore/ShadowDomTest.js.map +0 -1
- package/target/test/typescript/xhrCore/WebsocketTest.js +0 -182
- package/target/test/typescript/xhrCore/WebsocketTest.js.map +0 -1
- package/target/test/typescript/xhrCore/XhrFormDataTest.js +0 -58
- package/target/test/typescript/xhrCore/XhrFormDataTest.js.map +0 -1
- package/target/test-classes/.gz +0 -0
- package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
- package/target/test-classes/fileuploadtest.html +0 -24
- package/target/test-classes/jsf-development.js +0 -6781
- package/target/test-classes/jsf-development.js.br +0 -0
- package/target/test-classes/jsf-development.js.gz +0 -0
- package/target/test-classes/jsf-development.js.map +0 -1
- package/target/test-classes/jsf.js +0 -3
- package/target/test-classes/jsf.js.br +0 -0
- 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
|
|
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
|
-
|
|
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
|
|
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 = (
|
|
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
|
-
|
|
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.
|
|
779
|
+
return this.isPresent() ? Monad_1.Optional.fromNullable(this.innerHTML) : Monad_1.Optional.absent;
|
|
751
780
|
}
|
|
752
|
-
this.
|
|
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
|
|
791
|
+
set innerHTML(inVal) {
|
|
763
792
|
this.eachElem(elem => elem.innerHTML = inVal);
|
|
764
793
|
}
|
|
765
|
-
get
|
|
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.
|
|
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: (
|
|
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 = (
|
|
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) {
|
|
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,16 @@ 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
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
}
|
|
1151
|
-
this.loadScriptEval(src, 0, "UTF-8");
|
|
1236
|
+
//we run the collected scripts before running, the include
|
|
1237
|
+
evalCollectedScripts(finalScripts);
|
|
1238
|
+
(!!nonce) ? this.loadScriptEval(src, 0, "UTF-8", nonce) :
|
|
1239
|
+
//if no nonce is set we do not pass any once
|
|
1240
|
+
this.loadScriptEval(src, 0, "UTF-8");
|
|
1152
1241
|
}
|
|
1153
1242
|
}
|
|
1154
1243
|
else {
|
|
@@ -1172,9 +1261,13 @@ class DomQuery {
|
|
|
1172
1261
|
go = true;
|
|
1173
1262
|
}
|
|
1174
1263
|
}
|
|
1264
|
+
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
1265
|
// we have to run the script under a global context
|
|
1176
1266
|
//we store the script for less calls to eval
|
|
1177
|
-
finalScripts.push(
|
|
1267
|
+
finalScripts.push({
|
|
1268
|
+
nonce,
|
|
1269
|
+
evalText
|
|
1270
|
+
});
|
|
1178
1271
|
}
|
|
1179
1272
|
}
|
|
1180
1273
|
};
|
|
@@ -1185,9 +1278,7 @@ class DomQuery {
|
|
|
1185
1278
|
.flatMap(item => Stream_1.Stream.of(item.values))
|
|
1186
1279
|
.sort((node1, node2) => node1.compareDocumentPosition(node2) - 3) //preceding 2, following == 4)
|
|
1187
1280
|
.each(item => execScrpt(item));
|
|
1188
|
-
|
|
1189
|
-
this.globalEval(finalScripts.join("\n"));
|
|
1190
|
-
}
|
|
1281
|
+
evalCollectedScripts(finalScripts);
|
|
1191
1282
|
}
|
|
1192
1283
|
catch (e) {
|
|
1193
1284
|
if (console && console.error) {
|
|
@@ -1301,7 +1392,6 @@ class DomQuery {
|
|
|
1301
1392
|
break;
|
|
1302
1393
|
default:
|
|
1303
1394
|
throw "fireEvent: Couldn't find an event class for event '" + eventName + "'.";
|
|
1304
|
-
break;
|
|
1305
1395
|
}
|
|
1306
1396
|
let event = doc.createEvent(eventClass);
|
|
1307
1397
|
event.initEvent(eventName, true, true); // All events created as bubbling and cancelable.
|
|
@@ -1422,7 +1512,6 @@ class DomQuery {
|
|
|
1422
1512
|
return target;
|
|
1423
1513
|
}
|
|
1424
1514
|
get cDATAAsString() {
|
|
1425
|
-
let cDataBlock = [];
|
|
1426
1515
|
let TYPE_CDATA_BLOCK = 4;
|
|
1427
1516
|
let res = this.lazyStream.flatMap(item => {
|
|
1428
1517
|
return item.childNodes.stream;
|
|
@@ -1580,7 +1669,8 @@ class DomQuery {
|
|
|
1580
1669
|
}
|
|
1581
1670
|
/**
|
|
1582
1671
|
* concats the elements of two Dom Queries into a single one
|
|
1583
|
-
* @param toAttach
|
|
1672
|
+
* @param toAttach the elements to attach
|
|
1673
|
+
* @param filterDoubles filter out possible double elements (aka same markup)
|
|
1584
1674
|
*/
|
|
1585
1675
|
concat(toAttach, filterDoubles = true) {
|
|
1586
1676
|
const ret = this.lazyStream.concat(toAttach.lazyStream).collect(new DomQueryCollector());
|
|
@@ -1595,6 +1685,22 @@ class DomQuery {
|
|
|
1595
1685
|
return notFound;
|
|
1596
1686
|
}).collect(new DomQueryCollector());
|
|
1597
1687
|
}
|
|
1688
|
+
append(elem) {
|
|
1689
|
+
this.each(item => elem.appendTo(item));
|
|
1690
|
+
return this;
|
|
1691
|
+
}
|
|
1692
|
+
prependTo(elem) {
|
|
1693
|
+
elem.eachElem(item => {
|
|
1694
|
+
item.prepend(...this.allElems());
|
|
1695
|
+
});
|
|
1696
|
+
return this;
|
|
1697
|
+
}
|
|
1698
|
+
prepend(elem) {
|
|
1699
|
+
this.eachElem(item => {
|
|
1700
|
+
item.prepend(...elem.allElems());
|
|
1701
|
+
});
|
|
1702
|
+
return this;
|
|
1703
|
+
}
|
|
1598
1704
|
}
|
|
1599
1705
|
exports.DomQuery = DomQuery;
|
|
1600
1706
|
DomQuery.absent = new DomQuery();
|
|
@@ -1623,6 +1729,11 @@ exports.DomQueryCollector = DomQueryCollector;
|
|
|
1623
1729
|
* abbreviation for DomQuery
|
|
1624
1730
|
*/
|
|
1625
1731
|
exports.DQ = DomQuery;
|
|
1732
|
+
// noinspection JSUnusedGlobalSymbols
|
|
1733
|
+
/**
|
|
1734
|
+
* replacement for the jquery $
|
|
1735
|
+
*/
|
|
1736
|
+
exports.DQ$ = DomQuery.querySelectorAll;
|
|
1626
1737
|
|
|
1627
1738
|
|
|
1628
1739
|
/***/ }),
|
|
@@ -3349,7 +3460,7 @@ exports.XQ = XMLQuery;
|
|
|
3349
3460
|
|
|
3350
3461
|
|
|
3351
3462
|
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;
|
|
3463
|
+
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
3464
|
/*!
|
|
3354
3465
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3355
3466
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -3373,6 +3484,7 @@ Object.defineProperty(exports, "DomQuery", ({ enumerable: true, get: function ()
|
|
|
3373
3484
|
Object.defineProperty(exports, "ElementAttribute", ({ enumerable: true, get: function () { return DomQuery_1.ElementAttribute; } }));
|
|
3374
3485
|
Object.defineProperty(exports, "DomQueryCollector", ({ enumerable: true, get: function () { return DomQuery_1.DomQueryCollector; } }));
|
|
3375
3486
|
Object.defineProperty(exports, "DQ", ({ enumerable: true, get: function () { return DomQuery_1.DQ; } }));
|
|
3487
|
+
Object.defineProperty(exports, "DQ$", ({ enumerable: true, get: function () { return DomQuery_1.DQ$; } }));
|
|
3376
3488
|
var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
|
|
3377
3489
|
Object.defineProperty(exports, "Lang", ({ enumerable: true, get: function () { return Lang_1.Lang; } }));
|
|
3378
3490
|
var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
|
|
@@ -5195,22 +5307,26 @@ class ExtDomquery extends mona_dish_1.DQ {
|
|
|
5195
5307
|
}
|
|
5196
5308
|
let curScript = new mona_dish_1.DQ(document.currentScript);
|
|
5197
5309
|
//since our baseline atm is ie11 we cannot use document.currentScript globally
|
|
5198
|
-
if (
|
|
5310
|
+
if (!!this.extractNonce(curScript)) {
|
|
5199
5311
|
// fastpath for modern browsers
|
|
5200
|
-
return
|
|
5312
|
+
return this.extractNonce(curScript);
|
|
5201
5313
|
}
|
|
5202
5314
|
// fallback if the currentScript method fails, we just search the jsf tags for nonce, this is
|
|
5203
5315
|
// the last possibility
|
|
5204
5316
|
let nonceScript = mona_dish_1.DQ
|
|
5205
5317
|
.querySelectorAll("script[src], link[src]")
|
|
5206
5318
|
.lazyStream
|
|
5207
|
-
.filter((item) =>
|
|
5208
|
-
.
|
|
5319
|
+
.filter((item) => this.extractNonce(item) && item.attr(ATTR_SRC) != null)
|
|
5320
|
+
.filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))
|
|
5209
5321
|
.first();
|
|
5210
5322
|
if (nonceScript.isPresent()) {
|
|
5211
|
-
|
|
5323
|
+
return this.extractNonce(nonceScript.value);
|
|
5212
5324
|
}
|
|
5213
|
-
return
|
|
5325
|
+
return null;
|
|
5326
|
+
}
|
|
5327
|
+
extractNonce(curScript) {
|
|
5328
|
+
var _a, _b;
|
|
5329
|
+
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
5330
|
}
|
|
5215
5331
|
static searchJsfJsFor(item) {
|
|
5216
5332
|
return new ExtDomquery(document).searchJsfJsFor(item);
|
|
Binary file
|
|
Binary file
|