@yuneta/gobj-ui 7.18.2 → 7.18.3
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/gobj-ui.cjs.js +12 -2
- package/dist/gobj-ui.es.js +12 -2
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +37 -10
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -53869,6 +53869,7 @@ var PRIVATE_DATA$1 = {
|
|
|
53869
53869
|
_focus_topic: null,
|
|
53870
53870
|
_focus_ids: [],
|
|
53871
53871
|
_on_pointerdown_focus: null,
|
|
53872
|
+
_on_focusout_restore: null,
|
|
53872
53873
|
_selected_paint_ids: [],
|
|
53873
53874
|
_pending_focus_topic: null,
|
|
53874
53875
|
_pending_find: null,
|
|
@@ -53935,9 +53936,12 @@ function mt_destroy$1(gobj) {
|
|
|
53935
53936
|
}
|
|
53936
53937
|
if (priv._on_pointerdown_focus) {
|
|
53937
53938
|
priv.$container.removeEventListener("pointerdown", priv._on_pointerdown_focus, true);
|
|
53938
|
-
priv.$container.removeEventListener("click", priv._on_pointerdown_focus, true);
|
|
53939
53939
|
priv._on_pointerdown_focus = null;
|
|
53940
53940
|
}
|
|
53941
|
+
if (priv._on_focusout_restore) {
|
|
53942
|
+
priv.$container.removeEventListener("focusout", priv._on_focusout_restore);
|
|
53943
|
+
priv._on_focusout_restore = null;
|
|
53944
|
+
}
|
|
53941
53945
|
if (priv.theme_observer) {
|
|
53942
53946
|
priv.theme_observer.disconnect();
|
|
53943
53947
|
priv.theme_observer = null;
|
|
@@ -54113,7 +54117,13 @@ function configure_events(gobj) {
|
|
|
54113
54117
|
if ($canvas && typeof $canvas.focus === "function") $canvas.focus({ preventScroll: true });
|
|
54114
54118
|
};
|
|
54115
54119
|
priv.$container.addEventListener("pointerdown", priv._on_pointerdown_focus, true);
|
|
54116
|
-
priv
|
|
54120
|
+
priv._on_focusout_restore = (ev) => {
|
|
54121
|
+
if (ev.relatedTarget) return;
|
|
54122
|
+
if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
|
|
54123
|
+
let $canvas = main_canvas_of(priv.$container);
|
|
54124
|
+
if ($canvas && $canvas.isConnected && document.activeElement !== $canvas) $canvas.focus({ preventScroll: true });
|
|
54125
|
+
};
|
|
54126
|
+
priv.$container.addEventListener("focusout", priv._on_focusout_restore);
|
|
54117
54127
|
graph.on("keydown", (evt) => {
|
|
54118
54128
|
let ctrl = !!(evt.ctrlKey || evt.metaKey);
|
|
54119
54129
|
if (ctrl && (evt.key === "a" || evt.key === "A")) {
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -53856,6 +53856,7 @@ var PRIVATE_DATA$1 = {
|
|
|
53856
53856
|
_focus_topic: null,
|
|
53857
53857
|
_focus_ids: [],
|
|
53858
53858
|
_on_pointerdown_focus: null,
|
|
53859
|
+
_on_focusout_restore: null,
|
|
53859
53860
|
_selected_paint_ids: [],
|
|
53860
53861
|
_pending_focus_topic: null,
|
|
53861
53862
|
_pending_find: null,
|
|
@@ -53922,9 +53923,12 @@ function mt_destroy$1(gobj) {
|
|
|
53922
53923
|
}
|
|
53923
53924
|
if (priv._on_pointerdown_focus) {
|
|
53924
53925
|
priv.$container.removeEventListener("pointerdown", priv._on_pointerdown_focus, true);
|
|
53925
|
-
priv.$container.removeEventListener("click", priv._on_pointerdown_focus, true);
|
|
53926
53926
|
priv._on_pointerdown_focus = null;
|
|
53927
53927
|
}
|
|
53928
|
+
if (priv._on_focusout_restore) {
|
|
53929
|
+
priv.$container.removeEventListener("focusout", priv._on_focusout_restore);
|
|
53930
|
+
priv._on_focusout_restore = null;
|
|
53931
|
+
}
|
|
53928
53932
|
if (priv.theme_observer) {
|
|
53929
53933
|
priv.theme_observer.disconnect();
|
|
53930
53934
|
priv.theme_observer = null;
|
|
@@ -54100,7 +54104,13 @@ function configure_events(gobj) {
|
|
|
54100
54104
|
if ($canvas && typeof $canvas.focus === "function") $canvas.focus({ preventScroll: true });
|
|
54101
54105
|
};
|
|
54102
54106
|
priv.$container.addEventListener("pointerdown", priv._on_pointerdown_focus, true);
|
|
54103
|
-
priv
|
|
54107
|
+
priv._on_focusout_restore = (ev) => {
|
|
54108
|
+
if (ev.relatedTarget) return;
|
|
54109
|
+
if (gobj_is_destroying(gobj)) return;
|
|
54110
|
+
let $canvas = main_canvas_of(priv.$container);
|
|
54111
|
+
if ($canvas && $canvas.isConnected && document.activeElement !== $canvas) $canvas.focus({ preventScroll: true });
|
|
54112
|
+
};
|
|
54113
|
+
priv.$container.addEventListener("focusout", priv._on_focusout_restore);
|
|
54104
54114
|
graph.on("keydown", (evt) => {
|
|
54105
54115
|
let ctrl = !!(evt.ctrlKey || evt.metaKey);
|
|
54106
54116
|
if (ctrl && (evt.key === "a" || evt.key === "A")) {
|
package/package.json
CHANGED
package/src/c_g6_nodes_tree.js
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
gobj_parent,
|
|
38
38
|
gobj_name,
|
|
39
39
|
gobj_short_name,
|
|
40
|
+
gobj_is_destroying,
|
|
40
41
|
gobj_subscribe_event,
|
|
41
42
|
gobj_publish_event,
|
|
42
43
|
gobj_send_event,
|
|
@@ -334,6 +335,7 @@ let PRIVATE_DATA = {
|
|
|
334
335
|
_focus_topic: null, // topic currently focused (EV_FOCUS_TOPIC)
|
|
335
336
|
_focus_ids: [], // node ids carrying the focus 'active' state
|
|
336
337
|
_on_pointerdown_focus: null, // listener keeping the keyboard on the canvas
|
|
338
|
+
_on_focusout_restore: null, // ...and putting it back when it goes nowhere
|
|
337
339
|
_selected_paint_ids: [], // node ids whose card is PAINTED selected
|
|
338
340
|
// (G6's 'selected' state is the selection
|
|
339
341
|
// itself; this is what is on screen, and
|
|
@@ -464,10 +466,14 @@ function mt_destroy(gobj)
|
|
|
464
466
|
priv.$container.removeEventListener(
|
|
465
467
|
"pointerdown", priv._on_pointerdown_focus, true
|
|
466
468
|
);
|
|
469
|
+
priv._on_pointerdown_focus = null;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if(priv._on_focusout_restore) {
|
|
467
473
|
priv.$container.removeEventListener(
|
|
468
|
-
"
|
|
474
|
+
"focusout", priv._on_focusout_restore
|
|
469
475
|
);
|
|
470
|
-
priv.
|
|
476
|
+
priv._on_focusout_restore = null;
|
|
471
477
|
}
|
|
472
478
|
|
|
473
479
|
if(priv.theme_observer) {
|
|
@@ -826,17 +832,38 @@ function configure_events(gobj)
|
|
|
826
832
|
$canvas.focus({preventScroll: true});
|
|
827
833
|
}
|
|
828
834
|
};
|
|
829
|
-
/* Capture
|
|
830
|
-
*
|
|
831
|
-
* click too because the browser does its OWN focus handling on
|
|
832
|
-
* mousedown, after ours, and it sends the focus to <body> when
|
|
833
|
-
* what was pressed cannot take it -- which a card cannot. */
|
|
835
|
+
/* Capture: the cards are DOM and may stop the press from
|
|
836
|
+
* bubbling. */
|
|
834
837
|
priv.$container.addEventListener(
|
|
835
838
|
"pointerdown", priv._on_pointerdown_focus, true
|
|
836
839
|
);
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
+
|
|
841
|
+
/* And put it back when it is taken away to NOWHERE.
|
|
842
|
+
*
|
|
843
|
+
* Focusing on pointerdown is not enough on its own, which is
|
|
844
|
+
* measurable: the press does focus the canvas, and then the
|
|
845
|
+
* browser runs its own focus handling for the mousedown -- after
|
|
846
|
+
* ours -- and a card is not focusable, so it moves the focus to
|
|
847
|
+
* <body>. The graph goes deaf right after the click that
|
|
848
|
+
* selected something, which is the worst possible moment.
|
|
849
|
+
*
|
|
850
|
+
* Only when it goes nowhere (`relatedTarget` null). A focus
|
|
851
|
+
* moving to a REAL element -- the find box, a dialog, the next
|
|
852
|
+
* tab stop -- is the user leaving, and is left alone.
|
|
853
|
+
*/
|
|
854
|
+
priv._on_focusout_restore = (ev) => {
|
|
855
|
+
if(ev.relatedTarget) {
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
if(gobj_is_destroying(gobj)) {
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
let $canvas = main_canvas_of(priv.$container);
|
|
862
|
+
if($canvas && $canvas.isConnected && document.activeElement !== $canvas) {
|
|
863
|
+
$canvas.focus({preventScroll: true});
|
|
864
|
+
}
|
|
865
|
+
};
|
|
866
|
+
priv.$container.addEventListener("focusout", priv._on_focusout_restore);
|
|
840
867
|
|
|
841
868
|
/* The canvas carries a `tabIndex` of its own, so a keydown reaches
|
|
842
869
|
* us only while the GRAPH has focus. That is what keeps Ctrl+A in
|