@yuneta/gobj-ui 7.23.195 → 7.23.197
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 +42 -11
- package/dist/gobj-ui.cjs.js +336 -161
- package/dist/gobj-ui.es.js +336 -161
- package/package.json +1 -1
- package/src/c_yui_schema_editor.js +57 -122
- package/src/schema_to_c.js +49 -9
- package/src/schema_to_c.test.js +21 -3
- package/src/schema_to_diagram.js +301 -0
- package/src/schema_to_diagram.test.js +107 -0
- package/src/schema_validate.js +5 -17
- package/src/schema_validate.test.js +4 -24
- package/src/schema_version_bump.test.js +14 -71
package/README.md
CHANGED
|
@@ -2003,16 +2003,17 @@ columns**, each in its declared `order`, with the storage composed underneath
|
|
|
2003
2003
|
the qualified id, the fkey to the parent, the place among the siblings, and the
|
|
2004
2004
|
versions that publish the change.
|
|
2005
2005
|
|
|
2006
|
-
**
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2006
|
+
**An edit here is a draft** (7.23.196, with the SDK's M36 design). A write moves
|
|
2007
|
+
no version and reaches no treedb. The HOST publishes it with `C_TREEDB`'s
|
|
2008
|
+
`save-schema`, which raises the `topic_version` of each topic that changed
|
|
2009
|
+
(the one that regenerates `topic_cols.json`) and the `schema_version` (the one
|
|
2010
|
+
that makes the schema file win over the literal), once, and puts it in use with
|
|
2011
|
+
`apply-schema` and a restart of the owning yuno. Until 7.23.195 every write
|
|
2012
|
+
here raised both numbers, so an edit half made was already the schema of the
|
|
2013
|
+
next start. The topic list marks what this session wrote and has not saved,
|
|
2014
|
+
and the column screen says so in a banner; the host sends `EV_REFRESH` after a
|
|
2015
|
+
save, and the reload forgets the drafts. The export (C literal and JSON) warns
|
|
2016
|
+
while there are drafts: the literal carries the versions a save publishes.
|
|
2016
2017
|
|
|
2017
2018
|
What the screens offer:
|
|
2018
2019
|
|
|
@@ -2083,7 +2084,37 @@ The logic is pure and tested apart from the view: `schema_model.js` (the three
|
|
|
2083
2084
|
lists regrouped — grouping follows the **fkey**, not a split of the qualified
|
|
2084
2085
|
id on `.`, which works right up to the first name that carries one),
|
|
2085
2086
|
`schema_validate.js`, `schema_descs.js`, `schema_to_c.js`, `schema_import.js`,
|
|
2086
|
-
`schema_flags.js`, `schema_write_options.js`. Since 6.1.0.
|
|
2087
|
+
`schema_flags.js`, `schema_write_options.js`, `schema_to_diagram.js`. Since 6.1.0.
|
|
2088
|
+
|
|
2089
|
+
**The export is the whole `treedb_schema_<db>.c`.** `schema_to_c()` writes the
|
|
2090
|
+
graph of the schema as a comment — one box per topic, `*` required, `=`
|
|
2091
|
+
inherited, `(2)` pkey2, `(t)` tkey, the hook markers `{}` `[]` `()` and the
|
|
2092
|
+
fkey markers `(↖)` `[↖]` `{↖}`, and a line from each hook's row to the row of
|
|
2093
|
+
the fkey it fills — and then the literal, and that is all such a file holds:
|
|
2094
|
+
an edit made in the editor goes back into the source by replacing the file
|
|
2095
|
+
whole. The graph is `schema_to_diagram()`, derived and never drawn by hand;
|
|
2096
|
+
`json_to_c()` writes the same file from the literal's own JSON (the yunetas
|
|
2097
|
+
script `scripts/schema_diagram.mjs` uses it to keep the files in the repo
|
|
2098
|
+
equal to what an export would give). `with_diagram: false` gives the literal
|
|
2099
|
+
alone. Since 7.23.197.
|
|
2100
|
+
|
|
2101
|
+
```c
|
|
2102
|
+
/*
|
|
2103
|
+
Generated from the literal below by schema_to_diagram() (gobj-ui).
|
|
2104
|
+
...
|
|
2105
|
+
users
|
|
2106
|
+
┌───────────────────────────┐
|
|
2107
|
+
│* id │
|
|
2108
|
+
│ name (2) │
|
|
2109
|
+
│ departments [↖] │ ──────┘
|
|
2110
|
+
└───────────────────────────┘
|
|
2111
|
+
*/
|
|
2112
|
+
|
|
2113
|
+
static char treedb_schema_sample[]= "\
|
|
2114
|
+
{ \n\
|
|
2115
|
+
'id': 'treedb_sample', \n\
|
|
2116
|
+
...
|
|
2117
|
+
```
|
|
2087
2118
|
|
|
2088
2119
|
**A drag can be undone.** Reordering a column is a WRITE — `order` is a field —
|
|
2089
2120
|
so the drop lands in the store the moment you let go. The toolbar grows an
|