@yuneta/gobj-ui 7.23.114 → 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,15 +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
- function field(logical, name, label, $control, help) {
68246
- if ((0, _yuneta_gobj_js.is_array)($control) && (0, _yuneta_gobj_js.is_object)($control[1]) && [
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 ([
68247
68266
  "input",
68248
68267
  "select",
68249
68268
  "textarea"
68250
- ].includes($control[0]) && !$control[1]["aria-label"]) {
68251
- $control[1]["aria-label"] = (0, i18next.t)(label);
68252
- $control[1]["data-i18n-aria-label"] = label;
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;
68253
68275
  }
68276
+ for (let child of $spec[2] || []) if (name_control(child, label)) return true;
68277
+ return false;
68278
+ }
68279
+ function field(logical, name, label, $control, help) {
68280
+ name_control($control, label);
68254
68281
  return [
68255
68282
  "div",
68256
68283
  { class: `${logical} field mb-3` },
@@ -68473,7 +68500,7 @@ function open_column_form(gobj, topic, col, prefill) {
68473
68500
  class: "is-flex",
68474
68501
  style: "gap:.4rem;"
68475
68502
  },
68476
- [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")]
68477
68504
  ],
68478
68505
  [
68479
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,15 +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
- function field(logical, name, label, $control, help) {
68241
- if (is_array($control) && is_object($control[1]) && [
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 ([
68242
68261
  "input",
68243
68262
  "select",
68244
68263
  "textarea"
68245
- ].includes($control[0]) && !$control[1]["aria-label"]) {
68246
- $control[1]["aria-label"] = t(label);
68247
- $control[1]["data-i18n-aria-label"] = label;
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;
68248
68270
  }
68271
+ for (let child of $spec[2] || []) if (name_control(child, label)) return true;
68272
+ return false;
68273
+ }
68274
+ function field(logical, name, label, $control, help) {
68275
+ name_control($control, label);
68249
68276
  return [
68250
68277
  "div",
68251
68278
  { class: `${logical} field mb-3` },
@@ -68468,7 +68495,7 @@ function open_column_form(gobj, topic, col, prefill) {
68468
68495
  class: "is-flex",
68469
68496
  style: "gap:.4rem;"
68470
68497
  },
68471
- [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")]
68472
68499
  ],
68473
68500
  [
68474
68501
  "p",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.114",
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",
@@ -1556,6 +1556,46 @@ function open_dialog(gobj, $content, title, logical, title_prefix)
1556
1556
  * carries its name, so reading the form back is one query and
1557
1557
  * a language change does not have to know the form exists.
1558
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
+
1559
1599
  function field(logical, name, label, $control, help)
1560
1600
  {
1561
1601
  /* The label is a SIBLING of the control -- Bulma's `field` shape --
@@ -1563,12 +1603,7 @@ function field(logical, name, label, $control, help)
1563
1603
  * wrapping, and a reader announces the box as unlabelled. The name
1564
1604
  * is put on the control itself, from the label's own key, so the
1565
1605
  * two cannot drift and a language change reaches both. */
1566
- if(is_array($control) && is_object($control[1]) &&
1567
- ["input", "select", "textarea"].includes($control[0]) &&
1568
- !$control[1]["aria-label"]) {
1569
- $control[1]["aria-label"] = t(label);
1570
- $control[1]["data-i18n-aria-label"] = label;
1571
- }
1606
+ name_control($control, label);
1572
1607
  return ["div", {class: `${logical} field mb-3`}, [
1573
1608
  ["label", {class: "label", i18n: label}, t(label)],
1574
1609
  ["div", {class: "control"}, [$control]],
@@ -1733,9 +1768,13 @@ function open_column_form(gobj, topic, col, prefill)
1733
1768
  ]],
1734
1769
  ["div", {class: "SCHEMA_COL_FORM_HOOK field mb-3"}, [
1735
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. */
1736
1773
  ["div", {class: "is-flex", style: "gap:.4rem;"}, [
1737
- select_input("hook_topic", hook_topic, [""].concat(sibling_topics)),
1738
- 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")
1739
1778
  ]],
1740
1779
  ["p", {class: "help", i18n: "a hook names the child topic and the column of the child that points back"},
1741
1780
  t("a hook names the child topic and the column of the child that points back")]