@yuneta/gobj-ui 7.26.8 → 7.26.9
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 +53 -0
- package/dist/gobj-ui.cjs.js +164 -59
- package/dist/gobj-ui.es.js +164 -59
- package/package.json +2 -2
- package/src/c_g6_nodes_tree.js +37 -7
- package/src/c_yui_form.js +39 -6
- package/src/c_yui_gclass.js +1 -1
- package/src/c_yui_gobj_tree_js.js +6 -2
- package/src/c_yui_nav.js +2 -2
- package/src/c_yui_schema_editor.js +22 -22
- package/src/c_yui_shell.js +57 -3
- package/src/c_yui_treedb_topic_with_form.js +4 -4
- package/src/c_yui_treedb_topics.js +9 -9
- package/src/c_yui_window.js +1 -1
- package/src/form_toolbar_plan.js +5 -5
- package/src/map_stop_windows.wiring.test.js +112 -0
- package/src/overlay_marker_after_back.wiring.test.js +212 -0
- package/src/shell_modals.js +2 -2
- package/src/vite_plugin_yuneta_html.test.js +17 -2
- package/src/yui_asset.js +3 -2
- package/src/yui_data_color.js +33 -0
- package/src/yui_data_color.test.js +27 -0
- package/src/yui_dev.js +2 -2
- package/src/yui_text.js +12 -0
- package/src/yui_text.test.js +29 -1
- package/vite-plugin-yuneta-html.js +15 -1
package/README.md
CHANGED
|
@@ -3309,6 +3309,59 @@ text is in the yunetas `CLAUDE.md` ("JS GUI conventions"); in short:
|
|
|
3309
3309
|
reuse a glyph because it is there.
|
|
3310
3310
|
- **Bulma helpers carry `!important`** (`.is-hidden`, `.is-flex`): toggle
|
|
3311
3311
|
`is-hidden`, or use `style.setProperty('display', 'none', 'important')`.
|
|
3312
|
+
- **Data goes into the DOM as text, never as a string.** `createElement2()`
|
|
3313
|
+
parses a string that starts with `<` as markup, and Tabulator puts a string
|
|
3314
|
+
column title in with `innerHTML`. A value from outside (a backend answer, a
|
|
3315
|
+
treedb node, a schema `header`, a name somebody typed) goes in as a Text
|
|
3316
|
+
node, in the CONTENT slot of a description (gobj-js before 7.26.2 drops a
|
|
3317
|
+
Text node inside a children array):
|
|
3318
|
+
|
|
3319
|
+
```js
|
|
3320
|
+
import {text_node, text_title_formatter} from "@yuneta/gobj-ui/src/yui_text.js";
|
|
3321
|
+
createElement2(["span", {class: "FOO_NAME", i18n: name}, text_node(name)]);
|
|
3322
|
+
columns.push({field: "x", title: header, titleFormatter: text_title_formatter});
|
|
3323
|
+
```
|
|
3324
|
+
|
|
3325
|
+
### `index.html`: title, metadata and the Content-Security-Policy
|
|
3326
|
+
|
|
3327
|
+
The vite plugin `yunetaHtmlPlugin` (`vite-plugin-yuneta-html.js`) fills
|
|
3328
|
+
`index.html` from the app's `config.json` at build time. The page needs the
|
|
3329
|
+
three placeholders `<title></title>`, `<!-- METADATA_PLACEHOLDER -->` and
|
|
3330
|
+
`<!-- CSP_PLACEHOLDER -->`.
|
|
3331
|
+
|
|
3332
|
+
```js
|
|
3333
|
+
// vite.config.js
|
|
3334
|
+
import { yunetaHtmlPlugin } from "@yuneta/gobj-ui/vite-plugin-yuneta-html.js";
|
|
3335
|
+
export default { plugins: [ yunetaHtmlPlugin({ defaultTitle: "My App" }) ] };
|
|
3336
|
+
```
|
|
3337
|
+
|
|
3338
|
+
```json
|
|
3339
|
+
{
|
|
3340
|
+
"title": "My App",
|
|
3341
|
+
"metadata": {"description": "What the app does"},
|
|
3342
|
+
"csp_connect_src": [
|
|
3343
|
+
"_comment: the backend this SPA talks to",
|
|
3344
|
+
"wss://my.host:1620",
|
|
3345
|
+
"https://auth.my.host"
|
|
3346
|
+
]
|
|
3347
|
+
}
|
|
3348
|
+
```
|
|
3349
|
+
|
|
3350
|
+
- **The policy is always emitted** (since 7.26.7). Without `csp_connect_src`,
|
|
3351
|
+
or without a `config.json` at all, the page gets the same policy with
|
|
3352
|
+
`connect-src 'self'` only, and the build prints a warning. So a page that
|
|
3353
|
+
talks to a backend on another origin must declare that origin here, or
|
|
3354
|
+
the browser refuses the connection.
|
|
3355
|
+
- **`csp_connect_src` is a list of CSP sources**, one per entry: an origin
|
|
3356
|
+
(`wss://host:port`) or a scheme (`wss:`). An entry that starts with
|
|
3357
|
+
`_comment` is ignored. An entry that holds a `;`, a `,` or a space is
|
|
3358
|
+
refused with an error (since 7.26.9): it is not one source, and a `;`
|
|
3359
|
+
would add a directive of its own (`wss://a; base-uri *`).
|
|
3360
|
+
- The rest of the policy is fixed: `script-src 'self'` (no inline script:
|
|
3361
|
+
put pre-paint code in `public/<name>.js` and load it with `<script src>`),
|
|
3362
|
+
`style-src 'self' 'unsafe-inline'`, and `blob:`/`data:` where workers,
|
|
3363
|
+
images, media and fonts need them.
|
|
3364
|
+
- Every text from `config.json` is escaped where it lands in the markup.
|
|
3312
3365
|
|
|
3313
3366
|
### Releasing
|
|
3314
3367
|
|