@yuneta/gobj-ui 7.5.0 → 7.5.1

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.
@@ -52922,7 +52922,8 @@ var PRIVATE_DATA$1 = {
52922
52922
  _focus_topic: null,
52923
52923
  _focus_ids: [],
52924
52924
  _pending_focus_topic: null,
52925
- _pending_find: null
52925
+ _pending_find: null,
52926
+ _layout_asked: ""
52926
52927
  };
52927
52928
  var __gclass__$1 = null;
52928
52929
  /******************************
@@ -52933,6 +52934,7 @@ var __gclass__$1 = null;
52933
52934
  ***************************************************************/
52934
52935
  function mt_create$1(gobj) {
52935
52936
  let priv = gobj.priv;
52937
+ priv._layout_asked = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "layout") || "";
52936
52938
  let subscriber = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "subscriber");
52937
52939
  if (!subscriber) subscriber = (0, _yuneta_gobj_js.gobj_parent)(gobj);
52938
52940
  (0, _yuneta_gobj_js.gobj_subscribe_event)(gobj, null, {}, subscriber);
@@ -55734,7 +55736,7 @@ function has_saved_geometry(gobj) {
55734
55736
  ************************************************************/
55735
55737
  function auto_layout(gobj) {
55736
55738
  let priv = gobj.priv;
55737
- if (priv.layout) return;
55739
+ if (priv._layout_asked) return;
55738
55740
  if (has_saved_geometry(gobj)) return;
55739
55741
  if (!priv.graph) return;
55740
55742
  let name = "dagre";
@@ -52909,7 +52909,8 @@ var PRIVATE_DATA$1 = {
52909
52909
  _focus_topic: null,
52910
52910
  _focus_ids: [],
52911
52911
  _pending_focus_topic: null,
52912
- _pending_find: null
52912
+ _pending_find: null,
52913
+ _layout_asked: ""
52913
52914
  };
52914
52915
  var __gclass__$1 = null;
52915
52916
  /******************************
@@ -52920,6 +52921,7 @@ var __gclass__$1 = null;
52920
52921
  ***************************************************************/
52921
52922
  function mt_create$1(gobj) {
52922
52923
  let priv = gobj.priv;
52924
+ priv._layout_asked = gobj_read_str_attr(gobj, "layout") || "";
52923
52925
  let subscriber = gobj_read_pointer_attr(gobj, "subscriber");
52924
52926
  if (!subscriber) subscriber = gobj_parent(gobj);
52925
52927
  gobj_subscribe_event(gobj, null, {}, subscriber);
@@ -55721,7 +55723,7 @@ function has_saved_geometry(gobj) {
55721
55723
  ************************************************************/
55722
55724
  function auto_layout(gobj) {
55723
55725
  let priv = gobj.priv;
55724
- if (priv.layout) return;
55726
+ if (priv._layout_asked) return;
55725
55727
  if (has_saved_geometry(gobj)) return;
55726
55728
  if (!priv.graph) return;
55727
55729
  let name = "dagre";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.5.0",
3
+ "version": "7.5.1",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -291,6 +291,7 @@ let PRIVATE_DATA = {
291
291
  _focus_ids: [], // node ids carrying the focus 'active' state
292
292
  _pending_focus_topic: null, // focus requested before data was loaded
293
293
  _pending_find: null, // find requested before data was loaded
294
+ _layout_asked: "", // layout the host asked for at create (see mt_create)
294
295
  };
295
296
 
296
297
  let __gclass__ = null;
@@ -312,6 +313,15 @@ function mt_create(gobj)
312
313
  {
313
314
  let priv = gobj.priv;
314
315
 
316
+ /* What the HOST asked for, captured before anything overwrites it.
317
+ *
318
+ * `gobj_write_attr()` also writes the private field of the same name,
319
+ * so the moment select_layout() resolves the empty preference to
320
+ * `manual` and stores it, `priv.layout` reads "manual" and no longer
321
+ * says whether anybody ever chose it. auto_layout() needs exactly that
322
+ * distinction. */
323
+ priv._layout_asked = gobj_read_str_attr(gobj, "layout") || "";
324
+
315
325
  /*
316
326
  * CHILD subscription model
317
327
  */
@@ -4534,7 +4544,7 @@ function auto_layout(gobj)
4534
4544
  {
4535
4545
  let priv = gobj.priv;
4536
4546
 
4537
- if(priv.layout) {
4547
+ if(priv._layout_asked) {
4538
4548
  return; /* the user picked one for this treedb */
4539
4549
  }
4540
4550
  if(has_saved_geometry(gobj)) {