You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2026/05/22 10:04:00 UTC
(myfaces-tobago) branch main updated: refactor(faces.js): use faces.d.ts from jsf.js_next_gen
This is an automated email from the ASF dual-hosted git repository.
henningn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
The following commit(s) were added to refs/heads/main by this push:
new fb0a7335c0 refactor(faces.js): use faces.d.ts from jsf.js_next_gen
fb0a7335c0 is described below
commit fb0a7335c07f68906ebe2f2f70ded043eb88c682
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Thu May 21 11:12:48 2026 +0200
refactor(faces.js): use faces.d.ts from jsf.js_next_gen
* use faces.d.ts from the jsf.js_next_gen dependency
* update tsconfig.json
* delete old self-build faces.d.ts
* replace EventData with faces.AjaxEvent
* replace EventError with faces.AjaxError
---
tobago-theme/eslint.config.mjs | 1 +
tobago-theme/package.json | 2 +-
.../tobago-theme-standard/src/main/ts/faces.d.ts | 76 ----------------------
.../src/main/ts/tobago-behavior.ts | 2 +-
.../src/main/ts/tobago-page.ts | 2 +-
.../src/main/ts/tobago-select-list-base.ts | 4 +-
.../src/main/ts/tobago-sheet.ts | 4 +-
.../src/main/ts/tobago-suggest.ts | 2 +-
tobago-theme/tsconfig.json | 11 +---
9 files changed, 12 insertions(+), 92 deletions(-)
diff --git a/tobago-theme/eslint.config.mjs b/tobago-theme/eslint.config.mjs
index 19ae492958..027a048a8a 100644
--- a/tobago-theme/eslint.config.mjs
+++ b/tobago-theme/eslint.config.mjs
@@ -23,6 +23,7 @@ import stylistic from '@stylistic/eslint-plugin'
export default defineConfig([
{
ignores: [
+ "**/faces.d.ts",
"**/tobago-polyfill.ts"
]
},
diff --git a/tobago-theme/package.json b/tobago-theme/package.json
index 1dd6f4e38d..44a0fc4e3b 100644
--- a/tobago-theme/package.json
+++ b/tobago-theme/package.json
@@ -72,7 +72,7 @@
"@trevoreyre/autocomplete-js": "3.0.3",
"bootstrap": "5.3.8",
"bootstrap-icons": "1.13.1",
- "jsf.js_next_gen": "4.1.0-beta.13",
+ "jsf.js_next_gen": "4.1.0-beta.15",
"lit-html": "3.3.2",
"tabbable": "^6.4.0"
},
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/faces.d.ts b/tobago-theme/tobago-theme-standard/src/main/ts/faces.d.ts
deleted file mode 100644
index ea0eb40983..0000000000
--- a/tobago-theme/tobago-theme-standard/src/main/ts/faces.d.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-interface Options {
- execute?: string,
- render?: string,
- onevent?: Function,
- onerror?: Function,
- params?: Context,
- delay?: number,
- resetValues?: boolean,
- myfaces?: {
- upload?: {
- progress?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
- preinit?: (upload: XMLHttpRequestUpload) => any,
- loadstart?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
- load?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
- loadend?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
- error?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
- abort?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
- timeout?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
- }
- }
-}
-
-type Context = Record<string, any>;
-
-declare interface EventData {
- type: string;
- status: string;
- source: any;
- responseCode: string;
- responseText: string;
- responseXML: Document;
-}
-
-declare interface ErrorData {
- type: string;
- source: string;
- errorName: string;
- errorMessage: string;
- responseText: string;
- responseXML: Document;
- status: string;
- serverErrorName: string;
- serverErrorMessage: string;
- responseCode: number;
-}
-
-declare const faces: Faces;
-
-interface Faces {
- ajax: Ajax;
-}
-
-interface Ajax {
- request(element: Element | string, event?: Event, options?: Options): void;
-
- addOnEvent(eventFunc: (data: EventData) => void): void;
-
- addOnError(errorFunc: (data: ErrorData) => void): void;
-}
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-behavior.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-behavior.ts
index 0bcbcaf064..1ebc568345 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-behavior.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-behavior.ts
@@ -132,7 +132,7 @@ class Behavior extends HTMLElement {
render: this.render,
resetValues: this.resetValues,
delay: this.delay,
- onevent: (event: EventData) => {
+ onevent: (event: faces.AjaxEvent) => {
// console.debug(`Status: ${event.status} - Type: ${event.type}`);
},
myfaces: {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts
index 89256b5462..4439aa7314 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts
@@ -100,7 +100,7 @@ export class Page extends HTMLElement {
faces.ajax.addOnEvent(this.facesResponse.bind(this));
}
- facesResponse(event: EventData): void {
+ facesResponse(event: faces.AjaxEvent): void {
console.debug("[tobago-faces] Faces event status: '%s'", event.status);
if (event.status === "success" && event.responseXML) {
event.responseXML.querySelectorAll("update").forEach(this.facesResponseSuccess.bind(this));
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-list-base.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-list-base.ts
index d8669762fe..b11bcf0f9c 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-list-base.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-list-base.ts
@@ -201,7 +201,7 @@ export abstract class SelectListBase extends HTMLElement {
}
}
- private lazyResponse(event: EventData): void {
+ private lazyResponse(event: faces.AjaxEvent): void {
const updates: NodeListOf<Element> = event.responseXML?.querySelectorAll("update");
if (updates && event.status === "complete") {
for (const update of updates) {
@@ -254,7 +254,7 @@ export abstract class SelectListBase extends HTMLElement {
}
}
- private lazyError(data: ErrorData): void {
+ private lazyError(data: faces.AjaxError): void {
console.error(`Select[One|Many]List filter loading error:
Error Name: ${data.errorName}
Error errorMessage: ${data.errorMessage}
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
index 08da3a8e29..562fda3b9f 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
@@ -344,7 +344,7 @@ export class Sheet extends HTMLElement {
}
}
- lazyResponse(event: EventData): void {
+ lazyResponse(event: faces.AjaxEvent): void {
const updates: NodeListOf<Element> = event.responseXML?.querySelectorAll("update");
if (updates && event.status === "complete") {
for (const update of updates) {
@@ -412,7 +412,7 @@ export class Sheet extends HTMLElement {
}
}
- lazyError(data: ErrorData): void {
+ lazyError(data: faces.AjaxError): void {
console.error(`Sheet lazy loading error:
Error Name: ${data.errorName}
Error errorMessage: ${data.errorMessage}
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
index 4df63abaa3..e1f4bbb6f5 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
@@ -249,7 +249,7 @@ export class Suggest {
}
}
- private ajaxEvent(event: EventData): void {
+ private ajaxEvent(event: faces.AjaxEvent): void {
if (event.status === "success") {
this.renderResults(this.items);
}
diff --git a/tobago-theme/tsconfig.json b/tobago-theme/tsconfig.json
index 6b803efd24..4fa218f054 100644
--- a/tobago-theme/tsconfig.json
+++ b/tobago-theme/tsconfig.json
@@ -11,13 +11,8 @@
"removeComments": false,
"strict": false,
"types": [
- "jest"
+ "jest",
+ "jsf.js_next_gen"
]
- },
- "include": [
- "tobago-theme-standard/src/main/ts/*.ts"
- ],
- "exclude": [
- "node_modules"
- ]
+ }
}