@yuneta/gobj-ui 7.23.142 → 7.23.144
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 +40 -0
- package/dist/gobj-ui.cjs.js +1225 -213
- package/dist/gobj-ui.es.js +1225 -215
- package/index.js +2 -0
- package/package.json +1 -1
- package/src/c_yui_json_pad.css +94 -0
- package/src/c_yui_json_pad.js +907 -0
- package/src/c_yui_treedb_topic_with_form.js +14 -0
- package/src/json_view_helpers.js +56 -1
- package/src/json_view_helpers.test.js +43 -0
- package/src/yui_icons.css +12 -0
- package/src/yui_json_pad.js +109 -0
package/README.md
CHANGED
|
@@ -663,6 +663,11 @@ url is what gives way, cut with an ellipsis, and the whole value stays in the
|
|
|
663
663
|
> only paginating the FETCH is not. `page_size` sets the display page for both
|
|
664
664
|
> paths.
|
|
665
665
|
|
|
666
|
+
**A topic table opens sorted by `id`** (since `7.23.143`): the pkey, ascending
|
|
667
|
+
and natural (`alphanum`, so `d2` comes before `d10`) — normalized records are
|
|
668
|
+
read by their key. Not when the app passes its own `initialSort`, and not with
|
|
669
|
+
`with_remote_paging`, where a sort in the browser would reorder one page.
|
|
670
|
+
|
|
666
671
|
`C_YUI_TREEDB_TOPICS` takes **`with_remote_paging`** (off by default) and
|
|
667
672
|
forwards it to every topic table: the table pulls the page it is showing
|
|
668
673
|
instead of the host pushing the whole topic down. It needs the SDK's `nodes`
|
|
@@ -1902,6 +1907,41 @@ if(id) {
|
|
|
1902
1907
|
$box.appendChild(yui_asset_element(answer, {detail: device.foto_name}));
|
|
1903
1908
|
```
|
|
1904
1909
|
|
|
1910
|
+
### JSON viewer — `setup_json_pad`
|
|
1911
|
+
|
|
1912
|
+
`setup_json_pad(self)` opens a **blank JSON pad** (`C_YUI_JSON_PAD`) in a
|
|
1913
|
+
floating `C_YUI_WINDOW`: paste JSON from outside — a log line, a config file, an
|
|
1914
|
+
answer copied from a terminal — and read it with the library's own viewer
|
|
1915
|
+
(`C_YUI_JSON`: tree, text, graph). Wire it to an account-menu entry, next to the
|
|
1916
|
+
frontend view (`EV_OPEN_JSON_VIEWER` in every SPA of the ecosystem). Like the
|
|
1917
|
+
frontend view it returns `null` when the window is already open, so the host
|
|
1918
|
+
toggles with it, and it registers `C_YUI_JSON_PAD` (and the `C_YUI_JSON` it
|
|
1919
|
+
hosts) itself when the app did not.
|
|
1920
|
+
|
|
1921
|
+
- A **paste anywhere in a pane** replaces its document and shows it at once;
|
|
1922
|
+
**view** (or Ctrl+Enter) reads the text area as typed; **clear** empties it.
|
|
1923
|
+
- Text that is not JSON leaves the last document on screen and says so under
|
|
1924
|
+
the text area, with the parser's reason.
|
|
1925
|
+
- **Two panes.** *Second json* opens a second pane beside the first (stacked
|
|
1926
|
+
when the pad is narrower than 40rem), and *compare* puts the differences of
|
|
1927
|
+
the two documents in place of the two viewers: one row per id of the flat
|
|
1928
|
+
form (`json2flat`, `json_diff_rows()` in `json_view_helpers.js`), tagged
|
|
1929
|
+
added / removed / changed, sorted by id. Edit either text area and view it
|
|
1930
|
+
again: the differences follow.
|
|
1931
|
+
- **What was pasted is kept**: both texts and the layout, in `localStorage`
|
|
1932
|
+
under the pad's `storage_key` attribute (default `yui_json_pad`; empty keeps
|
|
1933
|
+
nothing), so the next pad opens as the last one was left. A text too big for
|
|
1934
|
+
the browser's quota is not kept, and the pad says so in its toolbar.
|
|
1935
|
+
- A `__collapsed__` sentinel in a pasted dump is answered with
|
|
1936
|
+
`EV_SUBTREE_ERROR`: the source truncated it, and a pad has no backend to ask.
|
|
1937
|
+
|
|
1938
|
+
Consumer i18n keys: `json viewer`, `paste json here`, `invalid json`,
|
|
1939
|
+
`collapsed in the source`, `first json`, `second json`, `compare`, `added`,
|
|
1940
|
+
`removed`, `changed`, `path`, `no differences`, `compare needs two json`,
|
|
1941
|
+
`cannot compare`, `json not kept` (plus `view` and `clear`, which every app
|
|
1942
|
+
has). `compare`, `view` and `clear` reach `t()` as variables, so a consumer's
|
|
1943
|
+
`validate-locales` does not see them.
|
|
1944
|
+
|
|
1905
1945
|
### Frontend view — `setup_frontend_view`
|
|
1906
1946
|
|
|
1907
1947
|
`setup_frontend_view(self)` opens the **gobj tree of the app's own yuno** in a
|