@yuneta/gobj-ui 7.23.0 → 7.23.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.
- package/README.md +10 -2
- package/dist/gobj-ui.cjs.js +35 -10
- package/dist/gobj-ui.es.js +35 -10
- package/package.json +1 -1
- package/src/c_yui_json_graph.js +36 -13
package/README.md
CHANGED
|
@@ -446,8 +446,16 @@ many matched, and **expand-all / collapse-all** (`EV_EXPAND_ALL` /
|
|
|
446
446
|
`EV_COLLAPSE_ALL`) that fold every card but the root, marking each cut with
|
|
447
447
|
`▸ N` so the shape stays legible and you can see where the rest went. Since
|
|
448
448
|
`7.23.0` each card that HAS a branch also carries its own handle in its header
|
|
449
|
-
(
|
|
450
|
-
because a handle that does nothing is worse than none
|
|
449
|
+
(`EV_TOGGLE_FOLD {path}`); a leaf gets a spacer of the same width instead,
|
|
450
|
+
because a handle that does nothing is worse than none and the labels should
|
|
451
|
+
stay on one axis.
|
|
452
|
+
|
|
453
|
+
That handle is the **same filled chip the gobj tree draws** (`+N` folded, `−`
|
|
454
|
+
open — see `render_toggle_html` in `c_yui_gobj_tree_js.js`), and it is a chip
|
|
455
|
+
for a reason: `7.23.0` shipped it as a bare `▾` and on a phone it was
|
|
456
|
+
invisible. At the zoom that fits a document on screen a glyph is a couple of
|
|
457
|
+
pixels of ink; a filled chip is still a visible blob and reads as something you
|
|
458
|
+
press. `+N` also carries the count of what is hidden.
|
|
451
459
|
|
|
452
460
|
The handle is delegated from the canvas mount in the **capture** phase, over
|
|
453
461
|
`pointerdown`/`pointerup`/`mousedown`/`click`: the card is an `innerHTML`
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -9940,15 +9940,40 @@ function build_cell_html(key, value, type, dark, matched) {
|
|
|
9940
9940
|
* innerHTML string, so there is no other way to hang a
|
|
9941
9941
|
* handler on it.
|
|
9942
9942
|
*
|
|
9943
|
-
*
|
|
9944
|
-
*
|
|
9945
|
-
*
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9943
|
+
* A filled CHIP, the same one the gobj tree draws
|
|
9944
|
+
* (`c_yui_gobj_tree_js.js`, render_toggle_html): background,
|
|
9945
|
+
* border, radius, and `+N` / `−` rather than a triangle. It
|
|
9946
|
+
* shipped once as a bare `▾` and on a phone it was invisible —
|
|
9947
|
+
* a glyph is a couple of pixels of ink at the zoom that fits a
|
|
9948
|
+
* document on screen, while a filled chip stays a visible blob
|
|
9949
|
+
* and reads as something you press. `+N` also carries the
|
|
9950
|
+
* count of what is hidden, which the open state does not need.
|
|
9951
|
+
*
|
|
9952
|
+
* No `title`: it would be a word inside an innerHTML string,
|
|
9953
|
+
* where it could carry no i18n key and would sit in English
|
|
9954
|
+
* forever. `+3` and `−` need no language.
|
|
9955
|
+
************************************************************/
|
|
9956
|
+
function fold_toggle_html(path, foldable, folded, branches, colors) {
|
|
9957
|
+
if (!foldable) return `<span style="width:24px; flex:0 0 auto;"></span>`;
|
|
9958
|
+
let label = folded ? "+" + branches : "−";
|
|
9959
|
+
return `<span data-fold-path="${(0, _yuneta_gobj_js.escapeHtml)(path)}" style="
|
|
9960
|
+
flex: 0 0 auto;
|
|
9961
|
+
display: inline-flex;
|
|
9962
|
+
align-items: center;
|
|
9963
|
+
justify-content: center;
|
|
9964
|
+
min-width: 22px;
|
|
9965
|
+
height: 16px;
|
|
9966
|
+
padding: 0 5px;
|
|
9967
|
+
background: ${colors.bg};
|
|
9968
|
+
color: ${colors.border};
|
|
9969
|
+
border: 1px solid ${colors.bg};
|
|
9970
|
+
border-radius: 6px;
|
|
9971
|
+
font-size: 11px;
|
|
9972
|
+
font-weight: 700;
|
|
9973
|
+
line-height: 1;
|
|
9974
|
+
cursor: pointer;
|
|
9975
|
+
user-select: none;
|
|
9976
|
+
">${label}</span>`;
|
|
9952
9977
|
}
|
|
9953
9978
|
/************************************************************
|
|
9954
9979
|
* Does this key/value pair match the find term?
|
|
@@ -10060,7 +10085,7 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id) {
|
|
|
10060
10085
|
display: flex;
|
|
10061
10086
|
align-items: center;
|
|
10062
10087
|
gap: 6px;
|
|
10063
|
-
">${fold_toggle_html(path, foldable, folded, pending_complex.length)}<span style="flex:1 1 auto; text-align:center;">${(0, _yuneta_gobj_js.escapeHtml)(label)}</span></div>
|
|
10088
|
+
">${fold_toggle_html(path, foldable, folded, pending_complex.length, colors)}<span style="flex:1 1 auto; text-align:center;">${(0, _yuneta_gobj_js.escapeHtml)(label)}</span></div>
|
|
10064
10089
|
${content_html}
|
|
10065
10090
|
</div>`;
|
|
10066
10091
|
let node = {
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -9935,15 +9935,40 @@ function build_cell_html(key, value, type, dark, matched) {
|
|
|
9935
9935
|
* innerHTML string, so there is no other way to hang a
|
|
9936
9936
|
* handler on it.
|
|
9937
9937
|
*
|
|
9938
|
-
*
|
|
9939
|
-
*
|
|
9940
|
-
*
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
|
|
9938
|
+
* A filled CHIP, the same one the gobj tree draws
|
|
9939
|
+
* (`c_yui_gobj_tree_js.js`, render_toggle_html): background,
|
|
9940
|
+
* border, radius, and `+N` / `−` rather than a triangle. It
|
|
9941
|
+
* shipped once as a bare `▾` and on a phone it was invisible —
|
|
9942
|
+
* a glyph is a couple of pixels of ink at the zoom that fits a
|
|
9943
|
+
* document on screen, while a filled chip stays a visible blob
|
|
9944
|
+
* and reads as something you press. `+N` also carries the
|
|
9945
|
+
* count of what is hidden, which the open state does not need.
|
|
9946
|
+
*
|
|
9947
|
+
* No `title`: it would be a word inside an innerHTML string,
|
|
9948
|
+
* where it could carry no i18n key and would sit in English
|
|
9949
|
+
* forever. `+3` and `−` need no language.
|
|
9950
|
+
************************************************************/
|
|
9951
|
+
function fold_toggle_html(path, foldable, folded, branches, colors) {
|
|
9952
|
+
if (!foldable) return `<span style="width:24px; flex:0 0 auto;"></span>`;
|
|
9953
|
+
let label = folded ? "+" + branches : "−";
|
|
9954
|
+
return `<span data-fold-path="${escapeHtml(path)}" style="
|
|
9955
|
+
flex: 0 0 auto;
|
|
9956
|
+
display: inline-flex;
|
|
9957
|
+
align-items: center;
|
|
9958
|
+
justify-content: center;
|
|
9959
|
+
min-width: 22px;
|
|
9960
|
+
height: 16px;
|
|
9961
|
+
padding: 0 5px;
|
|
9962
|
+
background: ${colors.bg};
|
|
9963
|
+
color: ${colors.border};
|
|
9964
|
+
border: 1px solid ${colors.bg};
|
|
9965
|
+
border-radius: 6px;
|
|
9966
|
+
font-size: 11px;
|
|
9967
|
+
font-weight: 700;
|
|
9968
|
+
line-height: 1;
|
|
9969
|
+
cursor: pointer;
|
|
9970
|
+
user-select: none;
|
|
9971
|
+
">${label}</span>`;
|
|
9947
9972
|
}
|
|
9948
9973
|
/************************************************************
|
|
9949
9974
|
* Does this key/value pair match the find term?
|
|
@@ -10055,7 +10080,7 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id) {
|
|
|
10055
10080
|
display: flex;
|
|
10056
10081
|
align-items: center;
|
|
10057
10082
|
gap: 6px;
|
|
10058
|
-
">${fold_toggle_html(path, foldable, folded, pending_complex.length)}<span style="flex:1 1 auto; text-align:center;">${escapeHtml(label)}</span></div>
|
|
10083
|
+
">${fold_toggle_html(path, foldable, folded, pending_complex.length, colors)}<span style="flex:1 1 auto; text-align:center;">${escapeHtml(label)}</span></div>
|
|
10059
10084
|
${content_html}
|
|
10060
10085
|
</div>`;
|
|
10061
10086
|
let node = {
|
package/package.json
CHANGED
package/src/c_yui_json_graph.js
CHANGED
|
@@ -668,24 +668,47 @@ function build_cell_html(key, value, type, dark, matched)
|
|
|
668
668
|
* innerHTML string, so there is no other way to hang a
|
|
669
669
|
* handler on it.
|
|
670
670
|
*
|
|
671
|
-
*
|
|
672
|
-
*
|
|
673
|
-
*
|
|
671
|
+
* A filled CHIP, the same one the gobj tree draws
|
|
672
|
+
* (`c_yui_gobj_tree_js.js`, render_toggle_html): background,
|
|
673
|
+
* border, radius, and `+N` / `−` rather than a triangle. It
|
|
674
|
+
* shipped once as a bare `▾` and on a phone it was invisible —
|
|
675
|
+
* a glyph is a couple of pixels of ink at the zoom that fits a
|
|
676
|
+
* document on screen, while a filled chip stays a visible blob
|
|
677
|
+
* and reads as something you press. `+N` also carries the
|
|
678
|
+
* count of what is hidden, which the open state does not need.
|
|
679
|
+
*
|
|
680
|
+
* No `title`: it would be a word inside an innerHTML string,
|
|
681
|
+
* where it could carry no i18n key and would sit in English
|
|
682
|
+
* forever. `+3` and `−` need no language.
|
|
674
683
|
************************************************************/
|
|
675
|
-
function fold_toggle_html(path, foldable, folded, branches)
|
|
684
|
+
function fold_toggle_html(path, foldable, folded, branches, colors)
|
|
676
685
|
{
|
|
677
686
|
if(!foldable) {
|
|
678
|
-
/* A spacer, so the label of a leaf card
|
|
679
|
-
* same axis as the label of a foldable one. */
|
|
680
|
-
return `<span style="width:
|
|
687
|
+
/* A spacer the width of the chip, so the label of a leaf card
|
|
688
|
+
* stays on the same axis as the label of a foldable one. */
|
|
689
|
+
return `<span style="width:24px; flex:0 0 auto;"></span>`;
|
|
681
690
|
}
|
|
682
691
|
|
|
683
|
-
let
|
|
684
|
-
let text = folded? `${glyph} ${branches}`: glyph;
|
|
692
|
+
let label = folded? ("+" + branches): "−"; /* +N / − */
|
|
685
693
|
|
|
686
|
-
return `<span data-fold-path="${escapeHtml(path)}"
|
|
687
|
-
|
|
688
|
-
|
|
694
|
+
return `<span data-fold-path="${escapeHtml(path)}" style="
|
|
695
|
+
flex: 0 0 auto;
|
|
696
|
+
display: inline-flex;
|
|
697
|
+
align-items: center;
|
|
698
|
+
justify-content: center;
|
|
699
|
+
min-width: 22px;
|
|
700
|
+
height: 16px;
|
|
701
|
+
padding: 0 5px;
|
|
702
|
+
background: ${colors.bg};
|
|
703
|
+
color: ${colors.border};
|
|
704
|
+
border: 1px solid ${colors.bg};
|
|
705
|
+
border-radius: 6px;
|
|
706
|
+
font-size: 11px;
|
|
707
|
+
font-weight: 700;
|
|
708
|
+
line-height: 1;
|
|
709
|
+
cursor: pointer;
|
|
710
|
+
user-select: none;
|
|
711
|
+
">${label}</span>`;
|
|
689
712
|
}
|
|
690
713
|
|
|
691
714
|
/************************************************************
|
|
@@ -854,7 +877,7 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id)
|
|
|
854
877
|
display: flex;
|
|
855
878
|
align-items: center;
|
|
856
879
|
gap: 6px;
|
|
857
|
-
">${fold_toggle_html(path, foldable, folded, pending_complex.length)}<span style="flex:1 1 auto; text-align:center;">${escapeHtml(label)}</span></div>
|
|
880
|
+
">${fold_toggle_html(path, foldable, folded, pending_complex.length, colors)}<span style="flex:1 1 auto; text-align:center;">${escapeHtml(label)}</span></div>
|
|
858
881
|
${content_html}
|
|
859
882
|
</div>`;
|
|
860
883
|
|