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

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 (90) hide show
  1. package/README.md +24 -0
  2. package/dist/docs/assets/highlight.css +21 -0
  3. package/dist/docs/assets/search.js +1 -1
  4. package/dist/docs/index.html +15 -0
  5. package/dist/window/faces-development.js +29 -4
  6. package/dist/window/faces-development.js.br +0 -0
  7. package/dist/window/faces-development.js.gz +0 -0
  8. package/dist/window/faces-development.js.map +1 -1
  9. package/dist/window/faces.js +1 -1
  10. package/dist/window/faces.js.br +0 -0
  11. package/dist/window/faces.js.gz +0 -0
  12. package/dist/window/faces.js.map +1 -1
  13. package/dist/window/jsf-development.js +22 -5
  14. package/dist/window/jsf-development.js.br +0 -0
  15. package/dist/window/jsf-development.js.gz +0 -0
  16. package/dist/window/jsf-development.js.map +1 -1
  17. package/dist/window/jsf.js +1 -1
  18. package/dist/window/jsf.js.br +0 -0
  19. package/dist/window/jsf.js.gz +0 -0
  20. package/dist/window/jsf.js.map +1 -1
  21. package/package.json +1 -1
  22. package/src/main/java/com/example/jsfs_js_ts/DecoratedFacesJS.java +14 -0
  23. package/src/main/java/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.java +57 -0
  24. package/src/main/java/com/example/jsfs_js_ts/FacesJSMappingDecorator.java +138 -0
  25. package/src/main/typescript/@types/definitions/index.d.ts +173 -0
  26. package/src/main/typescript/api/_api.ts +11 -13
  27. package/src/main/typescript/api/faces.ts +11 -6
  28. package/src/main/typescript/api/jsf.ts +5 -8
  29. package/src/main/typescript/impl/AjaxImpl.ts +1 -2
  30. package/src/main/typescript/impl/PushImpl.ts +1 -3
  31. package/src/main/typescript/impl/core/Const.ts +0 -3
  32. package/src/main/typescript/impl/util/ExtDomQuery.ts +1 -1
  33. package/src/main/typescript/impl/util/Lang.ts +3 -4
  34. package/src/main/typescript/impl/xhrCore/ErrorData.ts +1 -2
  35. package/src/main/typescript/impl/xhrCore/EventData.ts +1 -1
  36. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +1 -2
  37. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +0 -1
  38. package/src/main/typescript/myfaces/OamSubmit.ts +5 -8
  39. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +2 -2
  40. package/src/main/typescript/test/impl/ImplTest.spec.ts +2 -1
  41. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +4 -3
  42. package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +2 -2
  43. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +2 -2
  44. package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +2 -2
  45. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +2 -2
  46. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +5 -4
  47. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +7 -4
  48. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +2 -2
  49. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +2 -2
  50. package/src/main/typescript/test/xhrCore/ShadowDomTest.spec.ts +2 -2
  51. package/src/main/typescript/test/xhrCore/WebsocketTest.ts +2 -2
  52. package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +2 -2
  53. package/src/main/typescript/tsconfig.json +6 -3
  54. package/target/api/_api.js +0 -2
  55. package/target/api/_api.js.map +1 -1
  56. package/target/api/faces.js +8 -1
  57. package/target/api/faces.js.map +1 -1
  58. package/target/api/jsf.js +1 -2
  59. package/target/api/jsf.js.map +1 -1
  60. package/target/impl/AjaxImpl.js.map +1 -1
  61. package/target/impl/PushImpl.js +1 -0
  62. package/target/impl/PushImpl.js.map +1 -1
  63. package/target/impl/core/Const.js.map +1 -1
  64. package/target/impl/util/Lang.js +0 -1
  65. package/target/impl/util/Lang.js.map +1 -1
  66. package/target/impl/xhrCore/ErrorData.js.map +1 -1
  67. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  68. package/target/impl/xhrCore/XhrRequest.js +9 -0
  69. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  70. package/target/myfaces/OamSubmit.js +11 -0
  71. package/target/myfaces/OamSubmit.js.map +1 -1
  72. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  73. package/target/test/impl/ImplTest.spec.js.map +1 -1
  74. package/target/test/impl/ImplTest_23.spec.js.map +1 -1
  75. package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
  76. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  77. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  78. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  79. package/target/test/xhrCore/RequestTest.spec.js +1 -0
  80. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  81. package/target/test/xhrCore/RequestTest_23.spec.js +2 -0
  82. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  83. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  84. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
  85. package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
  86. package/target/test/xhrCore/WebsocketTest.js.map +1 -1
  87. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
  88. package/target/types/index.js +18 -0
  89. package/target/types/index.js.map +1 -0
  90. package/src/main/types/typedefs.d.ts +0 -68
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsf.js_next_gen",
3
- "version": "4.0.0-beta-16",
3
+ "version": "4.0.0-beta-18",
4
4
  "description": "A next generation typescript reimplementation of jsf.js",
5
5
  "main": "dist/window/faces.js",
6
6
  "scripts": {
@@ -25,6 +25,20 @@ import java.io.*;
25
25
  import java.net.URL;
26
26
  import java.util.Map;
27
27
 
28
+ /**
29
+ * This class replicates a certain behavior we have
30
+ * in myfaces for the internal faces.js (which is based
31
+ * upon this projects code)
32
+ * MyFaces has a resource loader
33
+ * which replaces el constructs with their variable values, in faces.js
34
+ * We replicate this here in a somewhat hackish manner, atm
35
+ * only the context path is generated this way, because
36
+ * for other constructs which we use it we have pure js fallbacks
37
+ * delivering the same values
38
+ *
39
+ * You can use this class if you need or to provide the requestContextPath
40
+ * on js level (and extend it if you need to provide more)
41
+ */
28
42
  public class DecoratedFacesJS extends Resource {
29
43
 
30
44
  Resource delegate;
@@ -0,0 +1,57 @@
1
+ /* Licensed to the Apache Software Foundation (ASF) under one or more
2
+ * contributor license agreements. See the NOTICE file distributed with
3
+ * this work for additional information regarding copyright ownership.
4
+ * The ASF licenses this file to you under the Apache License, Version 2.0
5
+ * (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package com.example.jsfs_js_ts;
17
+
18
+ import jakarta.faces.application.Resource;
19
+ import jakarta.faces.application.ResourceHandler;
20
+ import jakarta.faces.application.ResourceHandlerWrapper;
21
+
22
+ /**
23
+ * this class decorates a resource handler
24
+ * which dynamically adds the correct mapping data to the
25
+ * faces.js file depending on the configuration
26
+ *
27
+ * Note, you only need this class in your own projects, if you add
28
+ * the scripts to a Faces resource library.
29
+ * MyFaces itself has a similar mechanism in 4.0.0+ placed
30
+ * directly in the resource handler code.
31
+ */
32
+ public class FacesJSMapFileResourceWrapper extends ResourceHandlerWrapper {
33
+ public FacesJSMapFileResourceWrapper(ResourceHandler delegate) {
34
+ super(delegate);
35
+ }
36
+
37
+ @Override
38
+ public Resource createResource(String resourceName) {
39
+ if (resourceName.contains("faces.js") || resourceName.contains("faces-development.js")) {
40
+ return new DecoratedFacesJS(super.createResource(resourceName));
41
+ }
42
+ return super.createResource(resourceName);
43
+ }
44
+
45
+ @Override
46
+ public Resource createResource(String resourceName, String libraryName) {
47
+ if (!resourceName.contains(".map") && (resourceName.contains("faces.js") || resourceName.contains("faces-development.js"))) {
48
+ return new FacesJSMappingDecorator(super.createResource(resourceName, libraryName));
49
+ }
50
+ return super.createResource(resourceName, libraryName);
51
+ }
52
+
53
+ @Override
54
+ public Resource createResource(String resourceName, String libraryName, String contentType) {
55
+ return super.createResource(resourceName, libraryName, contentType);
56
+ }
57
+ }
@@ -0,0 +1,138 @@
1
+ /* Licensed to the Apache Software Foundation (ASF) under one or more
2
+ * contributor license agreements. See the NOTICE file distributed with
3
+ * this work for additional information regarding copyright ownership.
4
+ * The ASF licenses this file to you under the Apache License, Version 2.0
5
+ * (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package com.example.jsfs_js_ts;
17
+
18
+ import jakarta.faces.FacesException;
19
+ import jakarta.faces.application.Resource;
20
+ import jakarta.faces.context.FacesContext;
21
+
22
+ import java.io.*;
23
+ import java.net.MalformedURLException;
24
+ import java.net.URL;
25
+ import java.util.Map;
26
+
27
+ /**
28
+ * The core implementation of the mapping file decoration.
29
+ * We basically rip out the old mapping file reference
30
+ * and add the new one, on the fly, when the resource is loaded.
31
+ */
32
+ public class FacesJSMappingDecorator extends Resource {
33
+
34
+ public static final String URL_ENCODING = "UTF-8";
35
+ Resource delegate;
36
+
37
+ public FacesJSMappingDecorator(Resource delegate) {
38
+ this.delegate = delegate;
39
+ }
40
+
41
+ @Override
42
+ public InputStream getInputStream() throws IOException {
43
+ try (
44
+ InputStream inputStream = delegate.getInputStream();
45
+ ByteArrayOutputStream writer = new ByteArrayOutputStream();
46
+ ) {
47
+ new BufferedReader(new InputStreamReader(inputStream))
48
+ .lines()
49
+ .forEach(line -> {
50
+ if (line.contains("//# sourceMappingURL=")) {
51
+ return;
52
+ }
53
+ try {
54
+ writer.write(line.getBytes());
55
+ writer.write("\n".getBytes());
56
+ } catch (IOException e) {
57
+ throw new FacesException(e);
58
+ }
59
+ });
60
+ // let´s add the decoration
61
+ String resourcePath = remapNames(delegate.getRequestPath());
62
+ resourcePath = resourcePath.substring(resourcePath.lastIndexOf("/") + 1);
63
+
64
+ writer.write("\n//# sourceMappingURL=".getBytes());
65
+ writer.write(resourcePath.getBytes());
66
+ return new ByteArrayInputStream(writer.toByteArray());
67
+ }
68
+ }
69
+
70
+ @Override
71
+ public String getRequestPath() {
72
+ return delegate.getRequestPath();
73
+ }
74
+
75
+ @Override
76
+ public Map<String, String> getResponseHeaders() {
77
+ return delegate.getResponseHeaders();
78
+ }
79
+
80
+ @Override
81
+ public URL getURL() {
82
+ try {
83
+ return remapNames(delegate.getURL());
84
+ } catch (MalformedURLException e) {
85
+ throw new FacesException(e);
86
+ }
87
+ }
88
+
89
+ @Override
90
+ public boolean userAgentNeedsUpdate(FacesContext context) {
91
+ return delegate.userAgentNeedsUpdate(context);
92
+ }
93
+
94
+ @Override
95
+ public String getContentType() {
96
+ return delegate.getContentType();
97
+ }
98
+
99
+ @Override
100
+ public String getLibraryName() {
101
+ return delegate.getLibraryName();
102
+ }
103
+
104
+ @Override
105
+ public String getResourceName() {
106
+ return remapNames(delegate.getResourceName());
107
+ }
108
+
109
+ @Override
110
+ public void setContentType(String contentType) {
111
+ delegate.setContentType(contentType);
112
+ }
113
+
114
+ @Override
115
+ public void setLibraryName(String libraryName) {
116
+ delegate.setLibraryName(libraryName);
117
+ }
118
+
119
+ @Override
120
+ public void setResourceName(String resourceName) {
121
+ delegate.setResourceName(resourceName);
122
+ }
123
+
124
+ @Override
125
+ public String toString() {
126
+ return delegate.toString();
127
+ }
128
+
129
+ private String remapNames(String in) {
130
+ return in.replace("faces-development.js", "faces-development.js.map")
131
+ .replace("faces.js", "faces.js.map");
132
+ }
133
+
134
+ private URL remapNames(URL in) throws MalformedURLException {
135
+ return new URL(in.toString().replace("faces-development.js", "faces-development.js.map")
136
+ .replace("faces.js", "faces.js.map"));
137
+ }
138
+ }
@@ -0,0 +1,173 @@
1
+ /* Licensed to the Apache Software Foundation (ASF) under one or more
2
+ * contributor license agreements. See the NOTICE file distributed with
3
+ * this work for additional information regarding copyright ownership.
4
+ * The ASF licenses this file to you under the Apache License, Version 2.0
5
+ * (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /**
18
+ * Basic internal types used
19
+ *
20
+ * This file is only to eliminate various any calls into
21
+ * window, jsf and myfaces and make also the calls into
22
+ * the apis from a an extended window context in a type safe
23
+ * way
24
+ *
25
+ * We use this trick to map the types into the modules
26
+ * which we need to produce proper jsdoc files
27
+ */
28
+ declare global {
29
+
30
+ type Producer<T> = () => T;
31
+ type Consumer<T> = (s?: T) => void;
32
+ type Runnable = () => any;
33
+ type Transformable<S, T> = (s: S) => T;
34
+
35
+ type AssocArr<T> = { [key: string]: T };
36
+
37
+ type EvalFuncs = Array<Function | string>;
38
+ type Options = { [key: string]: string | Function | { [key: string]: string | Function } };
39
+ type Context = AssocArr<any>;
40
+ type ElemDef = Element | string;
41
+
42
+
43
+ /**
44
+ * * <ul>
45
+ * <li> errorData.type : &quot;error&quot;</li>
46
+ * <li> errorData.status : the error status message</li>
47
+ * <li> errorData.serverErrorName : the server error name in case of a server error</li>
48
+ * <li> errorData.serverErrorMessage : the server error message in case of a server error</li>
49
+ * <li> errorData.source : the issuing source element which triggered the requestInternal </li>
50
+ * <li> eventData.responseCode: the response code (aka http requestInternal response code, 401 etc...) </li>
51
+ * <li> eventData.responseText: the requestInternal response text </li>
52
+ * <li> eventData.responseXML: the requestInternal response xml </li>
53
+ * </ul>
54
+ */
55
+ interface IErrorData {
56
+ type: any;
57
+ status: string;
58
+ serverErrorName: string;
59
+ serverErrorMessage: string;
60
+ source: any;
61
+
62
+ responseCode: string;
63
+ responseText: string;
64
+ responseXML: string;
65
+ }
66
+
67
+ /**
68
+ * <ul>
69
+ * <li>status: status of the ajax cycle</li>
70
+ * </ul>
71
+ */
72
+ interface IEventData {
73
+ status: String;
74
+ source: any;
75
+ }
76
+
77
+ /*! Licensed to the Apache Software Foundation (ASF) under one or more
78
+ * contributor license agreements. See the NOTICE file distributed with
79
+ * this work for additional information regarding copyright ownership.
80
+ * The ASF licenses this file to you under the Apache License, Version 2.0
81
+ * (the "License"); you may not use this file except in compliance with
82
+ * the License. You may obtain a copy of the License at
83
+ *
84
+ * http://www.apache.org/licenses/LICENSE-2.0
85
+ *
86
+ * Unless required by applicable law or agreed to in writing, software
87
+ * distributed under the License is distributed on an "AS IS" BASIS,
88
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89
+ * See the License for the specific language governing permissions and
90
+ * limitations under the License.
91
+ */
92
+
93
+ /**
94
+ * interface definitions to make the code more compiler typesafe
95
+ */
96
+
97
+ interface Ajax {
98
+ request(element: Element, event?: Event, options?: Context): void;
99
+
100
+ response(request: XMLHttpRequest, context?: Context): void;
101
+ }
102
+
103
+ interface Util {
104
+ chain(source, event, ...funcs: Array<Function | string>): boolean;
105
+ }
106
+
107
+ interface Push {
108
+ init(socketClientId: string,
109
+ uri: string,
110
+ channel: string,
111
+ onopen: Function,
112
+ onmessage: Function,
113
+ onclose: Function,
114
+ behaviorScripts: any,
115
+ autoconnect: boolean): void;
116
+
117
+ open(socketClientId: string);
118
+
119
+ close(socketClientId: string): void;
120
+ }
121
+
122
+
123
+ interface FacesAPI {
124
+ contextpath: string;
125
+ specversion: number;
126
+ implversion: number;
127
+ separatorchar: string;
128
+
129
+ getProjectStage(): string;
130
+ getViewState(formElement: Element | string): string;
131
+ getClientWindow(rootNode?: Element | string): string;
132
+ getSeparatorChar(): string;
133
+ response(request: XMLHttpRequest, context?: Context): void;
134
+ addOnError(errorFunc: (data: IErrorData) => void): void;
135
+ addOnEvent(eventFunc: (data: IEventData) => void): void;
136
+
137
+ ajax: Ajax;
138
+ util: Util;
139
+ push: Push;
140
+ }
141
+
142
+ interface OAM {
143
+ clearHiddenInput(formName: string, name: string): void;
144
+ setHiddenInput(formName: string, name: string, value: string): void;
145
+ submitForm(formName: string, linkId: string, target: string, params: { [key: string]: any }): boolean;
146
+ }
147
+
148
+ interface MyFacesAPI {
149
+ ab(source: Element, event: Event, eventName: string, execute: string, render: string, options: Context): void;
150
+
151
+ config: { [key: string]: any };
152
+ oam: OAM;
153
+ core: {
154
+ config ?: {[key: string]: any};
155
+ };
156
+ }
157
+
158
+ let myfaces: MyFacesAPI;
159
+ let jsf: FacesAPI;
160
+ let faces: FacesAPI;
161
+ // special trick, the typscript compiler treats window as Window
162
+ interface Window {
163
+ myfaces: MyFacesAPI,
164
+ faces: FacesAPI,
165
+ jsf: FacesAPI,
166
+ XMLHttpRequest: XMLHttpRequest,
167
+ called: { [key: string]: any }
168
+ }
169
+ }
170
+ // this is needed to tell the compiler that we have an ambient
171
+ // module, otherwise the global overload would produce an error
172
+ // noinspection JSUnusedGlobalSymbols
173
+ export var __my_faces_ambient_module_glob_;
@@ -17,14 +17,13 @@ import {Implementation} from "../impl/AjaxImpl";
17
17
  import {PushImpl} from "../impl/PushImpl";
18
18
  import {oam as _oam} from "../myfaces/OamSubmit";
19
19
  import {$nsp, CTX_PARAM_EXECUTE, CTX_PARAM_RENDER, P_BEHAVIOR_EVENT} from "../impl/core/Const";
20
+ import {ErrorData} from "../impl/xhrCore/ErrorData";
21
+ import {EventData} from "../impl/xhrCore/EventData";
20
22
 
21
-
22
- declare const window: any;
23
23
  //we use modules to get a proper jsdoc and static/map structure in the calls
24
24
  //as per spec requirement
25
25
  export module faces {
26
26
 
27
- export var contextpath = '#{facesContext.externalContext.requestContextPath}';
28
27
 
29
28
  /**
30
29
  * Version of the implementation for the faces.ts.
@@ -101,7 +100,7 @@ export module faces {
101
100
  }
102
101
 
103
102
  //private helper functions
104
- function getSeparatorChar() {
103
+ function getSeparatorChar(): string {
105
104
  const sep = '#{facesContext.namingContainerSeparatorChar}';
106
105
  //We now enable standalone mode, the separator char was not mapped we make a fallback to 2.3 behavior
107
106
  //the idea is that the separator char is provided from the underlying container, but if not then we
@@ -130,9 +129,8 @@ export module faces {
130
129
  * @param {EVENT} event: any javascript event supported by that object
131
130
  * @param {Map} options : map of options being pushed into the ajax cycle
132
131
  */
133
- export function request(element: Element, event?: Event, options?: Context) {
132
+ export function request(element: Element, event?: Event, options?: Context): void {
134
133
  Implementation.request(element, event, options)
135
- //Implementation.getInstance().requestInternal(element, event, options);
136
134
  }
137
135
 
138
136
  /**
@@ -142,7 +140,7 @@ export module faces {
142
140
  *
143
141
  * TODO add info on what can be in the context
144
142
  */
145
- export function response(request: XMLHttpRequest, context?: Context) {
143
+ export function response(request: XMLHttpRequest, context?: Context): void {
146
144
  Implementation.response(request, context);
147
145
  }
148
146
 
@@ -163,7 +161,7 @@ export module faces {
163
161
  *
164
162
  * @param {function} errorListener error handler must be of the format <i>function errorListener(&lt;errorData&gt;)</i>
165
163
  */
166
- export function addOnError(errorFunc: (data: ErrorData) => void) {
164
+ export function addOnError(errorFunc: (data: ErrorData) => void): void {
167
165
  Implementation.addOnError(<any>errorFunc);
168
166
  }
169
167
 
@@ -173,7 +171,7 @@ export module faces {
173
171
  *
174
172
  * @param {function} eventListener event must be of the format <i>function eventListener(&lt;eventData&gt;)</i>
175
173
  */
176
- export function addOnEvent(eventFunc: (data: EventData) => void) {
174
+ export function addOnEvent(eventFunc: (data: EventData) => void): void {
177
175
  Implementation.addOnEvent(<any>eventFunc);
178
176
  }
179
177
  }
@@ -210,7 +208,7 @@ export module faces {
210
208
  onmessage: Function,
211
209
  onclose: Function,
212
210
  behaviorScripts: any,
213
- autoconnect: boolean) {
211
+ autoconnect: boolean): void {
214
212
  PushImpl.init(socketClientId, uri, channel, onopen, onmessage, onclose, behaviorScripts, autoconnect);
215
213
  }
216
214
 
@@ -219,7 +217,7 @@ export module faces {
219
217
  * @param {string} channel The name of the web socket channel.
220
218
  * @throws {Error} When channel is unknown.
221
219
  */
222
- export function open(socketClientId: string) {
220
+ export function open(socketClientId: string): void {
223
221
  PushImpl.open(socketClientId);
224
222
  }
225
223
 
@@ -228,7 +226,7 @@ export module faces {
228
226
  * @param {string} channel The name of the web socket channel.
229
227
  * @throws {Error} When channel is unknown.
230
228
  */
231
- export function close(socketClientId: string) {
229
+ export function close(socketClientId: string): void {
232
230
  PushImpl.close(socketClientId);
233
231
  }
234
232
 
@@ -248,7 +246,7 @@ export module myfaces {
248
246
  * @param render
249
247
  * @param options
250
248
  */
251
- export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options: Context = {}) {
249
+ export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options: Context = {}): void {
252
250
  if (eventName) {
253
251
  options[$nsp(P_BEHAVIOR_EVENT)] = eventName;
254
252
  }
@@ -13,26 +13,31 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- ///<reference types='../../types/typedefs'/>
17
- "use strict";
18
- import {Implementation} from "../impl/AjaxImpl";
19
16
 
20
- declare const window: any;
17
+ "use strict";
21
18
 
22
19
  /**
23
20
  * faces.js init layer which provides as per spec the proper
24
21
  * window namespace if it does not exist already
22
+ *
23
+ * The idea is that we use a small shim on top of
24
+ * the implementation to provide the window namespace.
25
+ * The implementation itself is in a protected namespace
26
+ * which will be bound by the build system
27
+ *
28
+ * The documentation nevertheless targets the _api file, which
29
+ * hosts the full api
25
30
  */
26
31
  if(!window.faces) {
27
32
  //we lazily load the code to prevent ram bloat
28
33
  const faces = require("./_api").faces;
29
- window['faces'] = (window as any)?.faces ?? faces;
34
+ window['faces'] = window?.faces ?? faces;
30
35
  }
31
36
  if(!window?.myfaces?.ab) {
32
37
  const myfaces = require("./_api").myfaces;
33
38
 
34
39
  //namespace might be extended is not exclusively reserved so we merge
35
- window["myfaces"] = window?.myfaces ?? {};
40
+ (window as any)["myfaces"] = window?.myfaces ?? {};
36
41
  Object.keys(myfaces).forEach(key => window.myfaces[key] = window.myfaces?.[key] ?? myfaces[key]);
37
42
  }
38
43
  export var faces = window.faces;
@@ -13,31 +13,28 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- ///<reference types='../../types/typedefs'/>
17
- "use strict";
18
-
19
- declare const window: any;
20
16
 
17
+ "use strict";
21
18
  /**
22
19
  * jsf.js init layer which provides as per spec the proper
23
20
  * window namespace if it does not exist already
24
21
  * if this file is included then the code falls back with its namespaces
25
22
  * on jsf2.3 or earlier level, for 4.0+ please include faces.js
26
23
  */
27
- if(!window.jsf) {
24
+ if(!window?.jsf) {
28
25
  const faces = require("./_api").faces;
29
- window['jsf'] = (window as any)?.jsf ?? faces;
26
+ (window as any)['jsf'] = window?.jsf ?? faces;
30
27
  window.jsf.specversion = 230000;
31
28
  delete window.jsf.contextpath;
32
29
  }
33
30
  if(!window?.myfaces?.ab) {
34
31
  const myfaces = require("./_api").myfaces;
35
32
  //namespace might be extended is not exclusively reserved so we merge
36
- window["myfaces"] = window?.myfaces ?? {};
33
+ (window as any)["myfaces"] = window?.myfaces ?? {};
37
34
  if(!window?.myfaces?.ab) {
38
35
  const myfaces = require("./_api").myfaces;
39
36
  //namespace might be extended is not exclusively reserved so we merge
40
- window["myfaces"] = window?.myfaces ?? {};
37
+ (window as any)["myfaces"] = window?.myfaces ?? {};
41
38
  Object.keys(myfaces).forEach(key => window.myfaces[key] = window.myfaces?.[key] ?? myfaces[key]);
42
39
  }
43
40
  }
@@ -25,6 +25,7 @@ import {ExtDomquery} from "./util/ExtDomQuery";
25
25
  import {ErrorData} from "./xhrCore/ErrorData";
26
26
  import {EventData} from "./xhrCore/EventData";
27
27
  import {ExtLang} from "./util/Lang";
28
+
28
29
  import {
29
30
  $nsp,
30
31
  CTX_PARAM_EXECUTE,
@@ -150,8 +151,6 @@ export module Implementation {
150
151
  import getGlobalConfig = ExtLang.getGlobalConfig;
151
152
  import assert = Assertions.assert;
152
153
 
153
- declare const window: any;
154
-
155
154
  let projectStage: string = null;
156
155
  let separator: string = null;
157
156
  let eventQueue = [];
@@ -21,16 +21,14 @@
21
21
  //TODO still work in progress
22
22
  //this is a 1:1 port for the time being
23
23
  import {MAX_RECONNECT_ATTEMPTS, REASON_EXPIRED, RECONNECT_INTERVAL} from "./core/Const";
24
+ ;
24
25
 
25
- declare const window: any;
26
26
 
27
27
  /**
28
28
  * Implementation class for the push functionality
29
29
  */
30
30
  export module PushImpl {
31
31
 
32
-
33
-
34
32
  const URL_PROTOCOL = window.location.protocol.replace("http", "ws") + "//";
35
33
 
36
34
 
@@ -172,9 +172,6 @@ export const MAX_RECONNECT_ATTEMPTS = 25;
172
172
 
173
173
  export const UNKNOWN = "UNKNOWN";
174
174
 
175
- declare const window: any;
176
-
177
-
178
175
  /**
179
176
  * helper to remap the namespaces variables for 2.3
180
177
  * from 2.3 to 4.0 every javax namespace has been changed
@@ -16,7 +16,7 @@
16
16
  import {Config, IValueHolder, Optional, DomQuery, DQ, Stream, ArrayCollector} from "mona-dish";
17
17
  import {$nsp, P_WINDOW_ID} from "../core/Const";
18
18
 
19
- declare let window: any;
19
+
20
20
 
21
21
 
22
22
  /**
@@ -22,6 +22,7 @@ import {Messages} from "../i18n/Messages";
22
22
  import {EMPTY_STR, TAG_FORM} from "../core/Const";
23
23
  import {getEventTarget} from "../xhrCore/RequestDataResolver";
24
24
 
25
+
25
26
  export module ExtLang {
26
27
 
27
28
  let installedLocale: Messages;
@@ -134,7 +135,7 @@ export module ExtLang {
134
135
  * given this function here is called very often
135
136
  * is a single entry without . in between we can do the lighter shortcut
136
137
  */
137
- return (<any>window)?.myfaces?.config?.[configName] ?? defaultValue;
138
+ return window?.myfaces?.config?.[configName] ?? defaultValue;
138
139
  }
139
140
 
140
141
  /**
@@ -198,13 +199,12 @@ export module ExtLang {
198
199
  */
199
200
  export function getLocalOrGlobalConfig(localOptions: Config, configName: string, defaultValue: any): any {
200
201
  return localOptions.value?.myfaces?.config?.[configName] ??
201
- (<any>window)?.myfaces?.config?.[configName] ??
202
+ window?.myfaces?.config?.[configName] ??
202
203
  defaultValue;
203
204
  }
204
205
 
205
206
  /**
206
207
  * assert that the form exists and throw an exception in the case it does not
207
- * (TODO move this into the assertions)
208
208
  *
209
209
  * @param form the form to check for
210
210
  */
@@ -213,5 +213,4 @@ export module ExtLang {
213
213
  throw makeException(new Error(), null, null, "Impl", "getForm", getMessage("ERR_FORM"));
214
214
  }
215
215
  }
216
-
217
216
  }
@@ -46,7 +46,7 @@ export enum ErrorType {
46
46
  * everything into the same attributes,
47
47
  * I will add deprecated myfaces backwards compatibility attributes as well
48
48
  */
49
- export class ErrorData extends EventData {
49
+ export class ErrorData extends EventData implements IErrorData {
50
50
 
51
51
  type: string = "error";
52
52
  source: string;
@@ -59,7 +59,6 @@ export class ErrorData extends EventData {
59
59
  status: string;
60
60
  typeDetails: ErrorType;
61
61
 
62
- //TODO backwards compatible attributes
63
62
  serverErrorName: string;
64
63
  serverErrorMessage: string;
65
64
  message: string;