jsf.js_next_gen 4.0.0-beta-23 → 4.0.1-alpha.0
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/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/README.md +13 -21
- package/dist/docs/assets/main.js +56 -52
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/assets/style.css +23 -0
- package/dist/docs/functions/faces.ajax.addOnError.html +2 -0
- package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
- package/dist/docs/functions/faces.push.close.html +4 -2
- package/dist/docs/functions/faces.push.init.html +19 -7
- package/dist/docs/functions/faces.push.open.html +4 -2
- package/dist/docs/functions/myfaces.ab.html +9 -4
- package/dist/docs/functions/myfaces.onDomReady.html +72 -0
- package/dist/docs/index.html +16 -18
- package/dist/docs/modules/myfaces.html +3 -1
- package/dist/docs/variables/myfaces.oam.html +2 -1
- package/dist/window/faces-development.js +2846 -2085
- 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.LICENSE.txt +17 -2
- 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 +2856 -2084
- 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.LICENSE.txt +17 -2
- 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 +19 -18
- package/plans for 4.0.1.txt +8 -0
- package/src/main/test.xml +23 -0
- package/src/main/typescript/@types/definitions/index.d.ts +19 -2
- package/src/main/typescript/api/_api.ts +68 -25
- package/src/main/typescript/api/jsf.ts +18 -0
- package/src/main/typescript/impl/AjaxImpl.ts +204 -100
- package/src/main/typescript/impl/PushImpl.ts +63 -38
- package/src/main/typescript/impl/core/Const.ts +56 -40
- package/src/main/typescript/impl/util/Assertions.ts +16 -8
- package/src/main/typescript/impl/util/AsyncRunnable.ts +85 -10
- package/src/main/typescript/impl/util/ExtDomQuery.ts +65 -54
- package/src/main/typescript/impl/util/FileUtils.ts +108 -0
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +93 -0
- package/src/main/typescript/impl/util/Lang.ts +91 -35
- package/src/main/typescript/impl/util/XhrQueueController.ts +112 -0
- package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
- package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
- package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +25 -11
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +78 -32
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +10 -10
- package/src/main/typescript/impl/xhrCore/Response.ts +66 -49
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +211 -138
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +92 -166
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +111 -120
- package/src/main/typescript/myfaces/OamSubmit.ts +30 -14
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +163 -27
- package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +4 -4
- package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/blank.css +0 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +921 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +108 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +111 -3
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
- package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +0 -0
- package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
- package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -7
- package/src/main/typescript/test/myfaces/OnLoadSpec.ts +52 -0
- package/src/main/typescript/test/queue/AsynchronousProbe.ts +5 -5
- package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +4 -3
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +28 -22
- package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -2
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
- package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +158 -17
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +320 -15
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +45 -4
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +374 -35
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
- package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
- package/src/main/typescript/test.xml +6 -0
- package/src/main/typescript/tsconfig.json +1 -1
- package/src/test/resources/jsf-development.js +1 -1
- package/src/tmp/test.html +12 -88
- package/target/api/_api.js +63 -21
- package/target/api/_api.js.map +1 -1
- package/target/api/jsf.js +11 -0
- package/target/api/jsf.js.map +1 -1
- package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
- package/target/impl/AjaxImpl.js +177 -81
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +66 -35
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +54 -39
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/core/Context.js +10 -0
- package/target/impl/core/Context.js.map +1 -0
- package/target/impl/util/Assertions.js +12 -7
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/AsyncQueue.js.map +1 -1
- package/target/impl/util/AsyncRunnable.js +60 -0
- package/target/impl/util/AsyncRunnable.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +66 -48
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/FileUtils.js +97 -0
- package/target/impl/util/FileUtils.js.map +1 -0
- package/target/impl/util/HiddenElementBuilder.js +7 -0
- package/target/impl/util/HiddenElementBuilder.js.map +1 -0
- package/target/impl/util/HiddenInputBuilder.js +83 -0
- package/target/impl/util/HiddenInputBuilder.js.map +1 -0
- package/target/{types/index.js → impl/util/IAsyncRunnable.js} +11 -2
- package/target/impl/util/IAsyncRunnable.js.map +1 -0
- package/target/impl/util/Lang.js +81 -31
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/util/URLCodec.js +77 -0
- package/target/impl/util/URLCodec.js.map +1 -0
- package/target/impl/util/XhrQueueController.js +107 -0
- package/target/impl/util/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/ErrorData.js +10 -8
- package/target/impl/xhrCore/ErrorData.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +2 -2
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/RequestContext.js +11 -0
- package/target/impl/xhrCore/RequestContext.js.map +1 -0
- package/target/impl/xhrCore/RequestDataResolver.js +70 -23
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +9 -9
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +44 -29
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +187 -119
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +82 -156
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrQueHandler.js +11 -0
- package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
- package/target/impl/xhrCore/XhrQueueController.js +62 -0
- package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/XhrRequest.js +94 -106
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +25 -14
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +124 -23
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +76 -0
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +4 -4
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +925 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +112 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +103 -3
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +2 -2
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +2 -2
- package/target/test/impl/ImplTest_23.spec.js.map +1 -1
- package/target/test/myfaces/OnLoadSpec.js +57 -0
- package/target/test/myfaces/OnLoadSpec.js.map +1 -0
- package/target/test/queue/AsynchronousQueueTest.spec.js +3 -3
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
- package/target/test/xhrCore/EventTests.spec.js +26 -19
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +2 -1
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
- package/target/test/xhrCore/RequestParamsTest.spec.js +142 -10
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +288 -11
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +40 -2
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +315 -24
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +38 -8
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
- package/target/test/xhrCore/XhrFormDataTest.spec.js +57 -34
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -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 +24 -0
- package/target/test-classes/jsf-development.js +3559 -0
- 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 +1 -0
- package/target/test-classes/jsf.js +3 -0
- package/target/test-classes/jsf.js.br +0 -0
- package/target/test-classes/jsf.js.gz +0 -0
- package/tmp.xml +36 -0
- package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/src/main/typescript/impl/util/AsyncQueue.ts +0 -133
- package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +0 -231
- package/target/types/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsf.js_next_gen",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.1-alpha.0",
|
|
4
4
|
"description": "A next generation typescript reimplementation of jsf.js",
|
|
5
5
|
"main": "dist/window/faces.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"doc": "npx typedoc --tsconfig src/main/typescript/tsconfig-typedoc.json",
|
|
8
|
-
"test": "env TS_NODE_PROJECT=./src/main/typescript/tsconfig.json mocha",
|
|
9
|
-
"coverage": "env TS_NODE_PROJECT=./src/
|
|
8
|
+
"test": "cross-env TS_NODE_PROJECT=./src/main/typescript/tsconfig.json mocha",
|
|
9
|
+
"coverage": "cross-env TS_NODE_PROJECT=./src/main/typescript/tsconfig.json nyc --reporter=html --reporter=text mocha",
|
|
10
10
|
"build-production": "webpack --mode production --env FILE_NAME=jsf && ts-node ./remap.ts --production",
|
|
11
11
|
"build-development": "webpack --mode development --env FILE_NAME=jsf-development && ts-node ./remap.ts --development",
|
|
12
12
|
"build": "npm run doc && npm run build-development && npm run build-production",
|
|
@@ -21,33 +21,34 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
24
|
-
"@types/chai": "^4.3.
|
|
25
|
-
"@types/mocha": "^10.0.
|
|
26
|
-
"@types/node": "^18.
|
|
24
|
+
"@types/chai": "^4.3.4",
|
|
25
|
+
"@types/mocha": "^10.0.1",
|
|
26
|
+
"@types/node": "^18.14.6",
|
|
27
27
|
"@types/sinon": "^10.0.13",
|
|
28
28
|
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
|
29
|
-
"chai": "^4.3.
|
|
29
|
+
"chai": "^4.3.7",
|
|
30
30
|
"compression-webpack-plugin": "^10.0.0",
|
|
31
|
+
"cross-env": "^7.0.3",
|
|
31
32
|
"html-webpack-plugin": "^5.5.0",
|
|
32
33
|
"http-server": "^14.1.1",
|
|
33
|
-
"jsdom": "^
|
|
34
|
+
"jsdom": "^21.1.0",
|
|
34
35
|
"jsdom-global": "^3.0.2",
|
|
35
|
-
"mocha": "^10.
|
|
36
|
-
"npm-check-updates": "^16.
|
|
36
|
+
"mocha": "^10.2.0",
|
|
37
|
+
"npm-check-updates": "^16.7.10",
|
|
37
38
|
"nyc": "^15.1.0",
|
|
38
39
|
"replace-in-file": "^6.3.5",
|
|
39
|
-
"rxjs": "^7.
|
|
40
|
-
"sinon": "^
|
|
40
|
+
"rxjs": "^7.8.0",
|
|
41
|
+
"sinon": "^15.0.1",
|
|
41
42
|
"terser-webpack-plugin": "^5.3.6",
|
|
42
|
-
"ts-loader": "^9.4.
|
|
43
|
+
"ts-loader": "^9.4.2",
|
|
43
44
|
"ts-node": "^10.9.1",
|
|
44
|
-
"typedoc": "^0.23.
|
|
45
|
-
"typescript": "^4.
|
|
46
|
-
"webpack": "^5.
|
|
47
|
-
"webpack-cli": "^
|
|
45
|
+
"typedoc": "^0.23.26",
|
|
46
|
+
"typescript": "^4.9.5",
|
|
47
|
+
"webpack": "^5.75.0",
|
|
48
|
+
"webpack-cli": "^5.0.1",
|
|
48
49
|
"webpack-dev-server": "^4.11.1"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"mona-dish": "0.
|
|
52
|
+
"mona-dish": "0.25.28"
|
|
52
53
|
}
|
|
53
54
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Brainstorming for 4.0.1
|
|
2
|
+
|
|
3
|
+
* Eliminate Streams - done, this was the biggest one
|
|
4
|
+
* Reintroduce partial page submit (myfaces.pps?), while never really used - done, pps=true is reintroduced
|
|
5
|
+
reducing the commit load onto execute!
|
|
6
|
+
|
|
7
|
+
queue size reduction... not really needed, there never was a usecase for it
|
|
8
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<partial-response id="viewroot_1">
|
|
2
|
+
<changes>
|
|
3
|
+
<update id="panel2"><![CDATA[
|
|
4
|
+
<div id="panel2">
|
|
5
|
+
after update
|
|
6
|
+
<form id="form2" name="form2" method="post" action="booga2"
|
|
7
|
+
><a href="#" id="form2:link" name="form2:link"></a>
|
|
8
|
+
<input type="hidden" name="form2_SUBMIT" value="1"/></form>
|
|
9
|
+
</div>
|
|
10
|
+
]]>
|
|
11
|
+
</update>
|
|
12
|
+
<update id="panel3"><![CDATA[
|
|
13
|
+
<div id="panel3">
|
|
14
|
+
after update
|
|
15
|
+
<form id="form3" name="form3" method="post" action="booga3"
|
|
16
|
+
><a href="#" id="form3:link" name="form3:link"></a>
|
|
17
|
+
</form>
|
|
18
|
+
</div>
|
|
19
|
+
]]>
|
|
20
|
+
</update>
|
|
21
|
+
<update id="j_id__v_0:jakarta.faces.ViewState:1"><![CDATA[booga_after_update]]></update>
|
|
22
|
+
</changes>
|
|
23
|
+
</partial-response>
|
|
@@ -23,9 +23,24 @@
|
|
|
23
23
|
declare global {
|
|
24
24
|
|
|
25
25
|
type Consumer<T> = (s?: T) => void;
|
|
26
|
+
type Tuple<V,K> = [V, K];
|
|
27
|
+
type Tuples<V,K> = [Tuple<V, K>];
|
|
26
28
|
type AssocArr<T> = { [key: string]: T };
|
|
27
29
|
type EvalFuncs = Array<Function | string>;
|
|
28
|
-
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
type Options = {
|
|
33
|
+
render ?: string,
|
|
34
|
+
execute ?: string, //space separated list of client ids
|
|
35
|
+
onevent ?: Function, // event handler callback
|
|
36
|
+
onerror ?: Function, // error handler callback
|
|
37
|
+
params ?: AssocArr<any>, // passthrough params
|
|
38
|
+
delay ?: number, // delay in milliseconds
|
|
39
|
+
resetValues ?: boolean, // if set to true jakarta.faces.partial.resetValues is sent
|
|
40
|
+
/* @deprecated non-spec conform fallback behavior that anything can be passed and is used as passthrough */
|
|
41
|
+
[key: string]: any
|
|
42
|
+
}
|
|
43
|
+
|
|
29
44
|
type Context = AssocArr<any>;
|
|
30
45
|
type ElemDef = Element | string;
|
|
31
46
|
|
|
@@ -106,7 +121,7 @@ declare global {
|
|
|
106
121
|
interface OAM {
|
|
107
122
|
clearHiddenInput(formName: string, name: string): void;
|
|
108
123
|
setHiddenInput(formName: string, name: string, value: string): void;
|
|
109
|
-
submitForm(formName: string, linkId
|
|
124
|
+
submitForm(formName: string, linkId?: string |null, target?: string | null, params?: AssocArr<any> |Tuples<string, any> | null): boolean;
|
|
110
125
|
}
|
|
111
126
|
|
|
112
127
|
interface MyFacesAPI {
|
|
@@ -119,6 +134,8 @@ declare global {
|
|
|
119
134
|
};
|
|
120
135
|
}
|
|
121
136
|
|
|
137
|
+
|
|
138
|
+
|
|
122
139
|
/*
|
|
123
140
|
* Global namespaces type definitions
|
|
124
141
|
*/
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import {Implementation} from "../impl/AjaxImpl";
|
|
17
17
|
import {PushImpl} from "../impl/PushImpl";
|
|
18
18
|
import {oam as _oam} from "../myfaces/OamSubmit";
|
|
19
|
-
import {$nsp,
|
|
19
|
+
import {$nsp, CTX_OPTIONS_EXECUTE, CTX_OPTIONS_PARAMS, CTX_PARAM_RENDER, P_BEHAVIOR_EVENT} from "../impl/core/Const";
|
|
20
20
|
import {ErrorData} from "../impl/xhrCore/ErrorData";
|
|
21
21
|
import {EventData} from "../impl/xhrCore/EventData";
|
|
22
22
|
|
|
@@ -49,14 +49,14 @@ export module faces {
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* SeparatorChar as defined by facesContext.getNamingContainerSeparatorChar()
|
|
52
|
-
* @type {Char}
|
|
53
52
|
*/
|
|
54
|
-
export var separatorchar = getSeparatorChar();
|
|
53
|
+
export var separatorchar: string = getSeparatorChar();
|
|
55
54
|
|
|
55
|
+
// noinspection JSUnusedGlobalSymbols
|
|
56
56
|
/**
|
|
57
57
|
* Context Path as defined externalContext.requestContextPath
|
|
58
58
|
*/
|
|
59
|
-
export var contextpath = '#{facesContext.externalContext.requestContextPath}';
|
|
59
|
+
export var contextpath: string = '#{facesContext.externalContext.requestContextPath}';
|
|
60
60
|
// we do not have a fallback here, for now
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -99,7 +99,7 @@ export module faces {
|
|
|
99
99
|
return Implementation.getClientWindow(rootNode);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
//private helper functions
|
|
102
|
+
// private helper functions
|
|
103
103
|
function getSeparatorChar(): string {
|
|
104
104
|
const sep = '#{facesContext.namingContainerSeparatorChar}';
|
|
105
105
|
//We now enable standalone mode, the separator char was not mapped we make a fallback to 2.3 behavior
|
|
@@ -159,7 +159,7 @@ export module faces {
|
|
|
159
159
|
* <li> eventData.responseXML: the requestInternal response xml </li>
|
|
160
160
|
* </ul>
|
|
161
161
|
*
|
|
162
|
-
* @param
|
|
162
|
+
* @param errorFunc error handler must be of the format <i>function errorListener(<errorData>)</i>
|
|
163
163
|
*/
|
|
164
164
|
export function addOnError(errorFunc: (data: ErrorData) => void): void {
|
|
165
165
|
Implementation.addOnError(<any>errorFunc);
|
|
@@ -169,7 +169,7 @@ export module faces {
|
|
|
169
169
|
* Adds a global event listener to the ajax event queue. The event listener must be a function
|
|
170
170
|
* of following format: <i>function eventListener(<eventData>)</i>
|
|
171
171
|
*
|
|
172
|
-
* @param
|
|
172
|
+
* @param eventFunc event must be of the format <i>function eventListener(<eventData>)</i>
|
|
173
173
|
*/
|
|
174
174
|
export function addOnEvent(eventFunc: (data: EventData) => void): void {
|
|
175
175
|
Implementation.addOnEvent(<any>eventFunc);
|
|
@@ -184,7 +184,7 @@ export module faces {
|
|
|
184
184
|
* if any of the code returns false, the execution
|
|
185
185
|
* is terminated prematurely skipping the rest of the code!
|
|
186
186
|
*
|
|
187
|
-
* @param {
|
|
187
|
+
* @param {HTMLElement | String} source, the callee object
|
|
188
188
|
* @param {Event} event, the event object of the callee event triggering this function
|
|
189
189
|
* @param funcs ... arbitrary array of functions or strings
|
|
190
190
|
* @returns true if the chain has succeeded false otherwise
|
|
@@ -196,26 +196,32 @@ export module faces {
|
|
|
196
196
|
|
|
197
197
|
export module push {
|
|
198
198
|
/**
|
|
199
|
-
* @param
|
|
200
|
-
* @param
|
|
201
|
-
* @param
|
|
202
|
-
* @param
|
|
199
|
+
* @param socketClientId the sockets client identifier
|
|
200
|
+
* @param url the uri to reach the socket
|
|
201
|
+
* @param channel the channel name/id
|
|
202
|
+
* @param onopen The function to be invoked when the web socket is opened.
|
|
203
|
+
* @param onmessage The function to be invoked when a message is received.
|
|
204
|
+
* @param onerror The function to be invoked when an error occurs.
|
|
205
|
+
* @param onclose The function to be invoked when the web socket is closed.
|
|
206
|
+
* @param behaviors functions which are invoked whenever a message is received
|
|
207
|
+
* @param autoConnect Whether or not to automatically open the socket. Defaults to <code>false</code>.
|
|
203
208
|
*/
|
|
204
209
|
export function init(socketClientId: string,
|
|
205
|
-
|
|
210
|
+
url: string,
|
|
206
211
|
channel: string,
|
|
207
212
|
onopen: Function,
|
|
208
213
|
onmessage: Function,
|
|
214
|
+
onerror: Function,
|
|
209
215
|
onclose: Function,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
PushImpl.init(socketClientId,
|
|
216
|
+
behaviors: any,
|
|
217
|
+
autoConnect: boolean): void {
|
|
218
|
+
PushImpl.init(socketClientId, url, channel, onopen, onmessage, onerror, onclose, behaviors, autoConnect);
|
|
213
219
|
}
|
|
214
220
|
|
|
215
221
|
/**
|
|
216
222
|
* Open the web socket on the given channel.
|
|
217
|
-
* @param
|
|
218
|
-
* @throws
|
|
223
|
+
* @param socketClientId The name of the web socket channel.
|
|
224
|
+
* @throws Error is thrown, if the channel is unknown.
|
|
219
225
|
*/
|
|
220
226
|
export function open(socketClientId: string): void {
|
|
221
227
|
PushImpl.open(socketClientId);
|
|
@@ -223,8 +229,8 @@ export module faces {
|
|
|
223
229
|
|
|
224
230
|
/**
|
|
225
231
|
* Close the web socket on the given channel.
|
|
226
|
-
* @param
|
|
227
|
-
* @throws
|
|
232
|
+
* @param socketClientId The id of the web socket client.
|
|
233
|
+
* @throws Error is thrown, if the channel is unknown.
|
|
228
234
|
*/
|
|
229
235
|
export function close(socketClientId: string): void {
|
|
230
236
|
PushImpl.close(socketClientId);
|
|
@@ -243,15 +249,16 @@ export module myfaces {
|
|
|
243
249
|
* @param event the event
|
|
244
250
|
* @param eventName event name for java.jakarta.faces.behavior.evemnt
|
|
245
251
|
* @param execute execute list as passed down in faces.ajax.request
|
|
246
|
-
* @param render
|
|
247
|
-
* @param options
|
|
252
|
+
* @param render the render list as string
|
|
253
|
+
* @param options the options which need to be mered in
|
|
248
254
|
*/
|
|
249
|
-
export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options:
|
|
255
|
+
export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options: Options = {}): void {
|
|
250
256
|
if (eventName) {
|
|
251
|
-
options[
|
|
257
|
+
options[CTX_OPTIONS_PARAMS] = options?.[CTX_OPTIONS_PARAMS] ?? {};
|
|
258
|
+
options[CTX_OPTIONS_PARAMS][$nsp(P_BEHAVIOR_EVENT)] = eventName;
|
|
252
259
|
}
|
|
253
260
|
if (execute) {
|
|
254
|
-
options[
|
|
261
|
+
options[CTX_OPTIONS_EXECUTE] = execute;
|
|
255
262
|
}
|
|
256
263
|
if (render) {
|
|
257
264
|
options[CTX_PARAM_RENDER] = render;
|
|
@@ -260,6 +267,42 @@ export module myfaces {
|
|
|
260
267
|
(window?.faces ?? window.jsf).ajax.request(source, event, options);
|
|
261
268
|
}
|
|
262
269
|
|
|
270
|
+
|
|
271
|
+
const onReadyChain: Array<() => void> = [];
|
|
272
|
+
let readyStateListener = null;
|
|
273
|
+
// noinspection JSUnusedGlobalSymbols
|
|
274
|
+
/**
|
|
275
|
+
* Helper function in the myfaces namespace to handle document ready properly for the load case
|
|
276
|
+
* the ajax case, does not need proper treatment, since it is deferred anyway.
|
|
277
|
+
* Used by command script as helper function!
|
|
278
|
+
*
|
|
279
|
+
* @param executionFunc the function to be executed upon ready
|
|
280
|
+
*/
|
|
281
|
+
export function onDomReady(executionFunc: () => void) {
|
|
282
|
+
if(document.readyState !== "complete") {
|
|
283
|
+
onReadyChain.push(executionFunc);
|
|
284
|
+
if(!readyStateListener) {
|
|
285
|
+
readyStateListener = () => {
|
|
286
|
+
window.removeEventListener("DOMContentLoaded", readyStateListener);
|
|
287
|
+
readyStateListener = null;
|
|
288
|
+
try {
|
|
289
|
+
onReadyChain.forEach(func => func());
|
|
290
|
+
} finally {
|
|
291
|
+
//done we clear now the ready chain
|
|
292
|
+
onReadyChain.length = 0;
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
window.addEventListener("DOMContentLoaded", readyStateListener);
|
|
296
|
+
}
|
|
297
|
+
} else {
|
|
298
|
+
if(readyStateListener) {
|
|
299
|
+
readyStateListener();
|
|
300
|
+
}
|
|
301
|
+
executionFunc();
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
}
|
|
305
|
+
|
|
263
306
|
/**
|
|
264
307
|
* legacy oam functions
|
|
265
308
|
*/
|
|
@@ -26,6 +26,24 @@ if(!window?.jsf) {
|
|
|
26
26
|
(window as any)['jsf'] = window?.jsf ?? faces;
|
|
27
27
|
window.jsf.specversion = 230000;
|
|
28
28
|
delete window.jsf.contextpath;
|
|
29
|
+
|
|
30
|
+
let faces4Init = faces.push.init;
|
|
31
|
+
/*
|
|
32
|
+
* we shim back the breaking api change from 3.0 to 4.0
|
|
33
|
+
* onerror is gone
|
|
34
|
+
*/
|
|
35
|
+
faces.push.init = (socketClientId: string,
|
|
36
|
+
url: string,
|
|
37
|
+
channel: string,
|
|
38
|
+
onopen: Function,
|
|
39
|
+
onmessage: Function,
|
|
40
|
+
// no on error api change for 4.0
|
|
41
|
+
//onerror: Function,
|
|
42
|
+
onclose: Function,
|
|
43
|
+
behaviors: any,
|
|
44
|
+
autoConnect: boolean) => {
|
|
45
|
+
faces4Init(socketClientId, url, channel, onopen, onmessage, null, onclose, behaviors, autoConnect);
|
|
46
|
+
}
|
|
29
47
|
}
|
|
30
48
|
if(!window?.myfaces?.ab) {
|
|
31
49
|
const myfaces = require("./_api").myfaces;
|