@yuneta/gobj-ui 7.23.113 → 7.23.115

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.
@@ -34979,7 +34979,7 @@ var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
34979
34979
  var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
34980
34980
  var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
34981
34981
  var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
34982
- var named = {
34982
+ var named$1 = {
34983
34983
  aliceblue: 15792383,
34984
34984
  antiquewhite: 16444375,
34985
34985
  aqua: 65535,
@@ -35158,7 +35158,7 @@ function color_formatRgb() {
35158
35158
  function color(format) {
35159
35159
  var m, l;
35160
35160
  format = (format + "").trim().toLowerCase();
35161
- return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
35161
+ return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named$1.hasOwnProperty(format) ? rgbn(named$1[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
35162
35162
  }
35163
35163
  function rgbn(n) {
35164
35164
  return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
@@ -68242,7 +68242,42 @@ function open_dialog(gobj, $content, title, logical, title_prefix) {
68242
68242
  * carries its name, so reading the form back is one query and
68243
68243
  * a language change does not have to know the form exists.
68244
68244
  ***************************************************************/
68245
+ /***************************************************************
68246
+ * Put a NAME on the control of a field, from the label's key.
68247
+ *
68248
+ * It DESCENDS: `select_input()` hands back Bulma's wrapper
68249
+ * (`<div class="select"><select>`), so a check on the outer tag
68250
+ * named the div -- which names nothing -- and every select of
68251
+ * the two forms stayed anonymous while the inputs beside them
68252
+ * were fixed. Measured on a deployed schema: `SELECT[type]` with
68253
+ * no `aria-label` while `INPUT[header]` had one.
68254
+ *
68255
+ * The first control found is the one named: a field has one, and
68256
+ * where it has two (the hook's topic and column) they are named
68257
+ * where they are built, because "hook" would not tell them apart.
68258
+ ***************************************************************/
68259
+ function named($spec, label) {
68260
+ name_control($spec, label);
68261
+ return $spec;
68262
+ }
68263
+ function name_control($spec, label) {
68264
+ if (!(0, _yuneta_gobj_js.is_array)($spec) || !(0, _yuneta_gobj_js.is_object)($spec[1])) return false;
68265
+ if ([
68266
+ "input",
68267
+ "select",
68268
+ "textarea"
68269
+ ].includes($spec[0])) {
68270
+ if (!$spec[1]["aria-label"]) {
68271
+ $spec[1]["aria-label"] = (0, i18next.t)(label);
68272
+ $spec[1]["data-i18n-aria-label"] = label;
68273
+ }
68274
+ return true;
68275
+ }
68276
+ for (let child of $spec[2] || []) if (name_control(child, label)) return true;
68277
+ return false;
68278
+ }
68245
68279
  function field(logical, name, label, $control, help) {
68280
+ name_control($control, label);
68246
68281
  return [
68247
68282
  "div",
68248
68283
  { class: `${logical} field mb-3` },
@@ -68465,7 +68500,7 @@ function open_column_form(gobj, topic, col, prefill) {
68465
68500
  class: "is-flex",
68466
68501
  style: "gap:.4rem;"
68467
68502
  },
68468
- [select_input("hook_topic", hook_topic, [""].concat(sibling_topics)), text_input("hook_col", hook_col, (0, i18next.t)("the fkey column of the child"))]
68503
+ [named(select_input("hook_topic", hook_topic, [""].concat(sibling_topics)), "hook topic"), named(text_input("hook_col", hook_col, (0, i18next.t)("the fkey column of the child")), "hook column")]
68469
68504
  ],
68470
68505
  [
68471
68506
  "p",
@@ -34974,7 +34974,7 @@ var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
34974
34974
  var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
34975
34975
  var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
34976
34976
  var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
34977
- var named = {
34977
+ var named$1 = {
34978
34978
  aliceblue: 15792383,
34979
34979
  antiquewhite: 16444375,
34980
34980
  aqua: 65535,
@@ -35153,7 +35153,7 @@ function color_formatRgb() {
35153
35153
  function color(format) {
35154
35154
  var m, l;
35155
35155
  format = (format + "").trim().toLowerCase();
35156
- return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
35156
+ return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named$1.hasOwnProperty(format) ? rgbn(named$1[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
35157
35157
  }
35158
35158
  function rgbn(n) {
35159
35159
  return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
@@ -68237,7 +68237,42 @@ function open_dialog(gobj, $content, title, logical, title_prefix) {
68237
68237
  * carries its name, so reading the form back is one query and
68238
68238
  * a language change does not have to know the form exists.
68239
68239
  ***************************************************************/
68240
+ /***************************************************************
68241
+ * Put a NAME on the control of a field, from the label's key.
68242
+ *
68243
+ * It DESCENDS: `select_input()` hands back Bulma's wrapper
68244
+ * (`<div class="select"><select>`), so a check on the outer tag
68245
+ * named the div -- which names nothing -- and every select of
68246
+ * the two forms stayed anonymous while the inputs beside them
68247
+ * were fixed. Measured on a deployed schema: `SELECT[type]` with
68248
+ * no `aria-label` while `INPUT[header]` had one.
68249
+ *
68250
+ * The first control found is the one named: a field has one, and
68251
+ * where it has two (the hook's topic and column) they are named
68252
+ * where they are built, because "hook" would not tell them apart.
68253
+ ***************************************************************/
68254
+ function named($spec, label) {
68255
+ name_control($spec, label);
68256
+ return $spec;
68257
+ }
68258
+ function name_control($spec, label) {
68259
+ if (!is_array($spec) || !is_object($spec[1])) return false;
68260
+ if ([
68261
+ "input",
68262
+ "select",
68263
+ "textarea"
68264
+ ].includes($spec[0])) {
68265
+ if (!$spec[1]["aria-label"]) {
68266
+ $spec[1]["aria-label"] = t(label);
68267
+ $spec[1]["data-i18n-aria-label"] = label;
68268
+ }
68269
+ return true;
68270
+ }
68271
+ for (let child of $spec[2] || []) if (name_control(child, label)) return true;
68272
+ return false;
68273
+ }
68240
68274
  function field(logical, name, label, $control, help) {
68275
+ name_control($control, label);
68241
68276
  return [
68242
68277
  "div",
68243
68278
  { class: `${logical} field mb-3` },
@@ -68460,7 +68495,7 @@ function open_column_form(gobj, topic, col, prefill) {
68460
68495
  class: "is-flex",
68461
68496
  style: "gap:.4rem;"
68462
68497
  },
68463
- [select_input("hook_topic", hook_topic, [""].concat(sibling_topics)), text_input("hook_col", hook_col, t("the fkey column of the child"))]
68498
+ [named(select_input("hook_topic", hook_topic, [""].concat(sibling_topics)), "hook topic"), named(text_input("hook_col", hook_col, t("the fkey column of the child")), "hook column")]
68464
68499
  ],
68465
68500
  [
68466
68501
  "p",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.113",
3
+ "version": "7.23.115",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -107,6 +107,7 @@ import {
107
107
  kw_get_str,
108
108
  kw_get_dict,
109
109
  is_object,
110
+ is_array,
110
111
  empty_string,
111
112
  } from "@yuneta/gobj-js";
112
113
  import {yui_tint} from "./bulma_tint.js";
@@ -1555,8 +1556,54 @@ function open_dialog(gobj, $content, title, logical, title_prefix)
1555
1556
  * carries its name, so reading the form back is one query and
1556
1557
  * a language change does not have to know the form exists.
1557
1558
  ***************************************************************/
1559
+ /***************************************************************
1560
+ * Put a NAME on the control of a field, from the label's key.
1561
+ *
1562
+ * It DESCENDS: `select_input()` hands back Bulma's wrapper
1563
+ * (`<div class="select"><select>`), so a check on the outer tag
1564
+ * named the div -- which names nothing -- and every select of
1565
+ * the two forms stayed anonymous while the inputs beside them
1566
+ * were fixed. Measured on a deployed schema: `SELECT[type]` with
1567
+ * no `aria-label` while `INPUT[header]` had one.
1568
+ *
1569
+ * The first control found is the one named: a field has one, and
1570
+ * where it has two (the hook's topic and column) they are named
1571
+ * where they are built, because "hook" would not tell them apart.
1572
+ ***************************************************************/
1573
+ function named($spec, label)
1574
+ {
1575
+ name_control($spec, label);
1576
+ return $spec;
1577
+ }
1578
+
1579
+ function name_control($spec, label)
1580
+ {
1581
+ if(!is_array($spec) || !is_object($spec[1])) {
1582
+ return false;
1583
+ }
1584
+ if(["input", "select", "textarea"].includes($spec[0])) {
1585
+ if(!$spec[1]["aria-label"]) {
1586
+ $spec[1]["aria-label"] = t(label);
1587
+ $spec[1]["data-i18n-aria-label"] = label;
1588
+ }
1589
+ return true;
1590
+ }
1591
+ for(let child of ($spec[2] || [])) {
1592
+ if(name_control(child, label)) {
1593
+ return true;
1594
+ }
1595
+ }
1596
+ return false;
1597
+ }
1598
+
1558
1599
  function field(logical, name, label, $control, help)
1559
1600
  {
1601
+ /* The label is a SIBLING of the control -- Bulma's `field` shape --
1602
+ * so it names it for the eye and for nothing else: no `for`, no
1603
+ * wrapping, and a reader announces the box as unlabelled. The name
1604
+ * is put on the control itself, from the label's own key, so the
1605
+ * two cannot drift and a language change reaches both. */
1606
+ name_control($control, label);
1560
1607
  return ["div", {class: `${logical} field mb-3`}, [
1561
1608
  ["label", {class: "label", i18n: label}, t(label)],
1562
1609
  ["div", {class: "control"}, [$control]],
@@ -1721,9 +1768,13 @@ function open_column_form(gobj, topic, col, prefill)
1721
1768
  ]],
1722
1769
  ["div", {class: "SCHEMA_COL_FORM_HOOK field mb-3"}, [
1723
1770
  ["label", {class: "label", i18n: "hook"}, t("hook")],
1771
+ /* TWO controls in one field, so each says which half it
1772
+ * is: `hook` alone would name them both the same. */
1724
1773
  ["div", {class: "is-flex", style: "gap:.4rem;"}, [
1725
- select_input("hook_topic", hook_topic, [""].concat(sibling_topics)),
1726
- text_input("hook_col", hook_col, t("the fkey column of the child"))
1774
+ named(select_input("hook_topic", hook_topic,
1775
+ [""].concat(sibling_topics)), "hook topic"),
1776
+ named(text_input("hook_col", hook_col,
1777
+ t("the fkey column of the child")), "hook column")
1727
1778
  ]],
1728
1779
  ["p", {class: "help", i18n: "a hook names the child topic and the column of the child that points back"},
1729
1780
  t("a hook names the child topic and the column of the child that points back")]