jsf.js_next_gen 4.1.0-beta.16 → 4.1.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 (26) hide show
  1. package/README.md +15 -0
  2. package/dist/docs/index.html +25 -1
  3. package/dist/window/faces-development.js +53 -23
  4. package/dist/window/faces-development.js.map +1 -1
  5. package/dist/window/faces.js +1 -1
  6. package/dist/window/faces.js.map +1 -1
  7. package/dist/window/jsf-development.js +53 -23
  8. package/dist/window/jsf-development.js.map +1 -1
  9. package/dist/window/jsf.js +1 -1
  10. package/dist/window/jsf.js.map +1 -1
  11. package/package.json +8 -8
  12. package/src/main/typescript/api/_api_ae_stub.d.ts +16 -0
  13. package/src/main/typescript/impl/i18n/Messages.ts +1 -1
  14. package/src/main/typescript/impl/util/AsyncRunnable.ts +1 -1
  15. package/src/main/typescript/impl/util/FileUtils.ts +16 -0
  16. package/src/main/typescript/impl/util/XhrQueueController.ts +16 -0
  17. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +1 -1
  18. package/src/main/typescript/test/api/MyFacesABTest.spec.ts +16 -0
  19. package/src/main/typescript/test/frameworkBase/LangTest.spec.ts +16 -0
  20. package/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.ts +16 -0
  21. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +16 -0
  22. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +16 -0
  23. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +16 -0
  24. package/src/main/typescript/test/xhrCore/ClientWindow.spec.ts +16 -0
  25. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +115 -0
  26. package/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.ts +16 -0
package/README.md CHANGED
@@ -281,6 +281,21 @@ Tests
281
281
  - Added tests for HiddenInputBuilder, Lang, and async queue
282
282
 
283
283
 
284
+ ## 4.1.0-beta.17
285
+
286
+ - Bugfix: caret position regression on partial updates
287
+ - After typing into an input that triggers an ajax request, the keyboard caret jumped to
288
+ the beginning of the field (e.g. typing `123` resulted in `321`). This regressed in
289
+ `mona-dish` `0.50.0-beta.3`'s caret restoration and is fixed there; the focused input now
290
+ keeps its caret whether a partial response re-renders a different component or the input
291
+ itself.
292
+ - Dependency update
293
+ - Updated `mona-dish` to `0.50.0-beta.3`
294
+ - Tests added
295
+ - Added two protocol-level regression tests (`ResponseTest`) reproducing the Tobago
296
+ `<tc:in>`/`<tc:out>` scenario: typing `123` keeps the caret in order for both the
297
+ "re-render only the output" and the "re-render the input itself" cases.
298
+
284
299
  ## 4.1.0-beta.16
285
300
 
286
301
  - Dependency update
@@ -249,6 +249,30 @@ enqueues on separate instances to cancel each other's debounce window</li>
249
249
  <li>Added tests for ExtDomQuery (nonce DOM fallback, runHeadInserts text-node path) and ExtConfig (append, appendIf, deepCopy)</li>
250
250
  <li>Added tests for HiddenInputBuilder, Lang, and async queue</li>
251
251
  </ul>
252
+ <h2 id="410-beta17" class="tsd-anchor-link">4.1.0-beta.17<a href="#410-beta17" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
253
+ <ul>
254
+ <li>Bugfix: caret position regression on partial updates
255
+ <ul>
256
+ <li>After typing into an input that triggers an ajax request, the keyboard caret jumped to
257
+ the beginning of the field (e.g. typing <code>123</code> resulted in <code>321</code>). This regressed in
258
+ <code>mona-dish</code> <code>0.50.0-beta.3</code>'s caret restoration and is fixed there; the focused input now
259
+ keeps its caret whether a partial response re-renders a different component or the input
260
+ itself.</li>
261
+ </ul>
262
+ </li>
263
+ <li>Dependency update
264
+ <ul>
265
+ <li>Updated <code>mona-dish</code> to <code>0.50.0-beta.3</code></li>
266
+ </ul>
267
+ </li>
268
+ <li>Tests added
269
+ <ul>
270
+ <li>Added two protocol-level regression tests (<code>ResponseTest</code>) reproducing the Tobago
271
+ <code>&lt;tc:in&gt;</code>/<code>&lt;tc:out&gt;</code> scenario: typing <code>123</code> keeps the caret in order for both the
272
+ &quot;re-render only the output&quot; and the &quot;re-render the input itself&quot; cases.</li>
273
+ </ul>
274
+ </li>
275
+ </ul>
252
276
  <h2 id="410-beta16" class="tsd-anchor-link">4.1.0-beta.16<a href="#410-beta16" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
253
277
  <ul>
254
278
  <li>
@@ -306,4 +330,4 @@ enqueues on separate instances to cancel each other's debounce window</li>
306
330
  generative AI Tooling, as per <a href="https://www.apache.org/legal/generative-tooling.html">https://www.apache.org/legal/generative-tooling.html</a>
307
331
  disclosures now are added!
308
332
  See AI_CONTRIBUTIONS.md for full disclosure</p>
309
- </div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#🚀-scratchpad-for-the-typescript-based-reimplementation-of-jsfjs"><span>🚀 <wbr/>Scratchpad for the <wbr/>Type<wbr/>Script-<wbr/>based reimplementation of jsf.js</span></a><ul><li><a href="#what-is-this"><span>What is this?</span></a></li><li><a href="#status"><span>Status</span></a></li><li><ul><li><a href="#special-info"><span>Special <wbr/>Info</span></a></li><li><a href="#general-build"><span>General <wbr/>Build</span></a></li><li><ul><li><a href="#on-windows"><span>On <wbr/>Windows</span></a></li></ul></li><li><a href="#tests"><span>Tests</span></a></li><li><a href="#test-coverage"><span>Test <wbr/>Coverage</span></a></li><li><a href="#changelist-compared-to-the-original-implementation"><span>Changelist compared to the original implementation</span></a></li></ul></li><li><a href="#upload-support"><span>Upload <wbr/>Support</span></a></li><li><a href="#changes-since-40"><span>Changes since 4.0</span></a></li><li><a href="#changes-since-410-beta-10"><span>Changes since 4.1.0-<wbr/>beta-<wbr/>10</span></a></li><li><a href="#410-beta16"><span>4.1.0-<wbr/>beta.16</span></a></li><li><a href="#410-beta15"><span>4.1.0-<wbr/>beta.15</span></a></li><li><a href="#410-beta13-410-beta14"><span>4.1.0-<wbr/>beta.13 / 4.1.0-<wbr/>beta.14</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">jsf.js_next_gen</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
333
+ </div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#🚀-scratchpad-for-the-typescript-based-reimplementation-of-jsfjs"><span>🚀 <wbr/>Scratchpad for the <wbr/>Type<wbr/>Script-<wbr/>based reimplementation of jsf.js</span></a><ul><li><a href="#what-is-this"><span>What is this?</span></a></li><li><a href="#status"><span>Status</span></a></li><li><ul><li><a href="#special-info"><span>Special <wbr/>Info</span></a></li><li><a href="#general-build"><span>General <wbr/>Build</span></a></li><li><ul><li><a href="#on-windows"><span>On <wbr/>Windows</span></a></li></ul></li><li><a href="#tests"><span>Tests</span></a></li><li><a href="#test-coverage"><span>Test <wbr/>Coverage</span></a></li><li><a href="#changelist-compared-to-the-original-implementation"><span>Changelist compared to the original implementation</span></a></li></ul></li><li><a href="#upload-support"><span>Upload <wbr/>Support</span></a></li><li><a href="#changes-since-40"><span>Changes since 4.0</span></a></li><li><a href="#changes-since-410-beta-10"><span>Changes since 4.1.0-<wbr/>beta-<wbr/>10</span></a></li><li><a href="#410-beta17"><span>4.1.0-<wbr/>beta.17</span></a></li><li><a href="#410-beta16"><span>4.1.0-<wbr/>beta.16</span></a></li><li><a href="#410-beta15"><span>4.1.0-<wbr/>beta.15</span></a></li><li><a href="#410-beta13-410-beta14"><span>4.1.0-<wbr/>beta.13 / 4.1.0-<wbr/>beta.14</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">jsf.js_next_gen</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -1827,11 +1827,16 @@ class DomQuery {
1827
1827
  if (this.isAbsent()) {
1828
1828
  return undefined;
1829
1829
  }
1830
- let focusElementId = (_a = document === null || document === void 0 ? void 0 : document.activeElement) === null || _a === void 0 ? void 0 : _a.id;
1831
- let caretPosition = (focusElementId) ? DomQuery.getCaretPosition(document.activeElement) : null;
1830
+ let toReplace = this.getAsElem(0).value;
1831
+ let activeElement = document === null || document === void 0 ? void 0 : document.activeElement;
1832
+ let focusElementId = activeElement === null || activeElement === void 0 ? void 0 : activeElement.id;
1833
+ // only save/restore the caret if the focused element is actually part of the
1834
+ // subtree that gets replaced. Otherwise updating an unrelated component would
1835
+ // reset the caret of a different, still focused input field.
1836
+ let restoreFocus = !!focusElementId && !!((_a = toReplace === null || toReplace === void 0 ? void 0 : toReplace.contains) === null || _a === void 0 ? void 0 : _a.call(toReplace, activeElement));
1837
+ let caretPosition = restoreFocus ? DomQuery.getCaretPosition(activeElement) : null;
1832
1838
  let nodes = DomQuery.fromMarkup(markup);
1833
1839
  let res = [];
1834
- let toReplace = this.getAsElem(0).value;
1835
1840
  let firstInsert = nodes.get(0);
1836
1841
  let parentNode = toReplace.parentNode;
1837
1842
  let replaced = firstInsert.getAsElem(0).value;
@@ -1852,10 +1857,12 @@ class DomQuery {
1852
1857
  if (runEmbeddedCss) {
1853
1858
  this.runCss();
1854
1859
  }
1855
- let focusElement = DomQuery.byId(focusElementId);
1856
- if (focusElementId && focusElement.isPresent() &&
1857
- caretPosition != null && "undefined" != typeof caretPosition) {
1858
- focusElement.eachElem(item => DomQuery.setCaretPosition(item, caretPosition));
1860
+ if (restoreFocus) {
1861
+ let focusElement = DomQuery.byId(focusElementId);
1862
+ if (focusElement.isPresent() &&
1863
+ caretPosition != null && "undefined" != typeof caretPosition) {
1864
+ focusElement.eachElem(item => DomQuery.setCaretPosition(item, caretPosition));
1865
+ }
1859
1866
  }
1860
1867
  return nodes;
1861
1868
  }
@@ -2322,25 +2329,18 @@ class DomQuery {
2322
2329
  }
2323
2330
  return false;
2324
2331
  }
2325
- // from
2326
- // http:// blog.vishalon.net/index.php/javascript-getting-and-setting-caret-position-in-textarea/
2327
2332
  static getCaretPosition(ctrl) {
2328
- let caretPos = 0;
2329
2333
  try {
2330
- if (document === null || document === void 0 ? void 0 : document.selection) {
2331
- ctrl.focus();
2332
- let selection = document.selection.createRange();
2333
- // the selection now is start zero
2334
- selection.moveStart('character', -ctrl.value.length);
2335
- // the caret-position is the selection start
2336
- caretPos = selection.text.length;
2334
+ // selectionStart is supported on text inputs/textareas in every relevant
2335
+ // browser (IE9+ and all modern engines)
2336
+ if (typeof (ctrl === null || ctrl === void 0 ? void 0 : ctrl.selectionStart) === "number") {
2337
+ return ctrl.selectionStart;
2337
2338
  }
2338
2339
  }
2339
2340
  catch (e) {
2340
- // now this is ugly, but not supported input types throw errors for selectionStart
2341
- // just in case someone dumps this code onto unsupported browsers
2341
+ // some input types throw on selectionStart access; treat as "no caret"
2342
2342
  }
2343
- return caretPos;
2343
+ return 0;
2344
2344
  }
2345
2345
  /**
2346
2346
  * sets the caret position
@@ -6913,7 +6913,7 @@ class Messages {
6913
6913
  /** @constant */
6914
6914
  this.ERR_TRANSPORT = "Transport type {0} does not exist";
6915
6915
  /** @constant */
6916
- this.ERR_EVT_PASS = "an event must be passed down (either a an event object null or undefined) ";
6916
+ this.ERR_EVT_PASS = "an event must be passed down (either an event object null or undefined) ";
6917
6917
  /** @constant */
6918
6918
  this.ERR_CONSTRUCT = "Parts of the response couldn't be retrieved when constructing the event data= {0} ";
6919
6919
  /** @constant */
@@ -7160,7 +7160,7 @@ class AsyncRunnable {
7160
7160
  }
7161
7161
  /**
7162
7162
  * registers a finally functor
7163
- * @param func the functor for the finally handling chanin
7163
+ * @param func the functor for the finally handling chain
7164
7164
  */
7165
7165
  finally(func) {
7166
7166
  // no ie11 support we probably are going to revert to shims for that one
@@ -7515,6 +7515,21 @@ __webpack_require__.r(__webpack_exports__);
7515
7515
  /* harmony import */ var mona_dish__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
7516
7516
  /* harmony import */ var _ExtDomQuery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
7517
7517
  /* harmony import */ var _core_Const__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
7518
+ /*! Licensed to the Apache Software Foundation (ASF) under one or more
7519
+ * contributor license agreements. See the NOTICE file distributed with
7520
+ * this work for additional information regarding copyright ownership.
7521
+ * The ASF licenses this file to you under the Apache License, Version 2.0
7522
+ * (the "License"); you may not use this file except in compliance with
7523
+ * the License. You may obtain a copy of the License at
7524
+ *
7525
+ * http://www.apache.org/licenses/LICENSE-2.0
7526
+ *
7527
+ * Unless required by applicable law or agreed to in writing, software
7528
+ * distributed under the License is distributed on an "AS IS" BASIS,
7529
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7530
+ * See the License for the specific language governing permissions and
7531
+ * limitations under the License.
7532
+ */
7518
7533
 
7519
7534
 
7520
7535
 
@@ -7991,6 +8006,21 @@ __webpack_require__.r(__webpack_exports__);
7991
8006
  /* harmony export */ XhrQueueController: () => (/* binding */ XhrQueueController)
7992
8007
  /* harmony export */ });
7993
8008
  /* harmony import */ var _Lang__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Lang */ "./src/main/typescript/impl/util/Lang.ts");
8009
+ /*! Licensed to the Apache Software Foundation (ASF) under one or more
8010
+ * contributor license agreements. See the NOTICE file distributed with
8011
+ * this work for additional information regarding copyright ownership.
8012
+ * The ASF licenses this file to you under the Apache License, Version 2.0
8013
+ * (the "License"); you may not use this file except in compliance with
8014
+ * the License. You may obtain a copy of the License at
8015
+ *
8016
+ * http://www.apache.org/licenses/LICENSE-2.0
8017
+ *
8018
+ * Unless required by applicable law or agreed to in writing, software
8019
+ * distributed under the License is distributed on an "AS IS" BASIS,
8020
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8021
+ * See the License for the specific language governing permissions and
8022
+ * limitations under the License.
8023
+ */
7994
8024
 
7995
8025
  const debounce = _Lang__WEBPACK_IMPORTED_MODULE_0__.ExtLang.debounce;
7996
8026
  /**
@@ -9790,7 +9820,7 @@ class XhrRequest extends _util_AsyncRunnable__WEBPACK_IMPORTED_MODULE_0__.AsyncR
9790
9820
  appendIssuingItem(formData) {
9791
9821
  var _a, _b;
9792
9822
  const issuingItemId = this.internalContext.getIf(_core_Const__WEBPACK_IMPORTED_MODULE_7__.CTX_PARAM_SRC_CTL_ID).value;
9793
- //to avoid sideffects with buttons we only can append the issuing item if no behavior event is set
9823
+ //to avoid side effects with buttons we only can append the issuing item if no behavior event is set
9794
9824
  //MYFACES-4679!
9795
9825
  const eventType = (_b = (_a = formData.getIf((0,_core_Const__WEBPACK_IMPORTED_MODULE_7__.$nsp)(_core_Const__WEBPACK_IMPORTED_MODULE_7__.P_BEHAVIOR_EVENT)).value) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null;
9796
9826
  const isBehaviorEvent = !!eventType && eventType !== 'click';