@threadlabs/looma 0.49.1 → 0.49.2
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/components/ui-cycle-button/ui-cycle-button.html +5 -3
- package/components/ui-cycle-button/ui-cycle-button.js +3 -2
- package/components/ui-search-result-row/ui-search-result-row.html +1 -1
- package/dist/index.js +1 -1
- package/docs/catalog.json +27 -1
- package/package.json +1 -1
- package/styles/ui-search-result-row.css +1 -1
- package/vanilla/UiCycleButton.d.ts +2 -0
- package/vanilla/UiCycleButton.js +26 -21
package/docs/catalog.json
CHANGED
|
@@ -498,7 +498,7 @@
|
|
|
498
498
|
],
|
|
499
499
|
"schemaVersion": 1,
|
|
500
500
|
"package": "@threadlabs/looma",
|
|
501
|
-
"version": "0.49.
|
|
501
|
+
"version": "0.49.2",
|
|
502
502
|
"groups": [
|
|
503
503
|
{
|
|
504
504
|
"id": "layout",
|
|
@@ -8021,6 +8021,13 @@
|
|
|
8021
8021
|
"shared": []
|
|
8022
8022
|
},
|
|
8023
8023
|
"attributes": [
|
|
8024
|
+
{
|
|
8025
|
+
"name": "description",
|
|
8026
|
+
"property": "description",
|
|
8027
|
+
"description": "Accessible instruction for cycling; accepts localized reader text.",
|
|
8028
|
+
"type": "string",
|
|
8029
|
+
"default": "Activate to choose the next state."
|
|
8030
|
+
},
|
|
8024
8031
|
{
|
|
8025
8032
|
"name": "disabled",
|
|
8026
8033
|
"property": "disabled",
|
|
@@ -8028,6 +8035,13 @@
|
|
|
8028
8035
|
"type": "boolean",
|
|
8029
8036
|
"default": false
|
|
8030
8037
|
},
|
|
8038
|
+
{
|
|
8039
|
+
"name": "empty-label",
|
|
8040
|
+
"property": "emptyLabel",
|
|
8041
|
+
"description": "Selected-state label while no choices are available.",
|
|
8042
|
+
"type": "string",
|
|
8043
|
+
"default": "No choices"
|
|
8044
|
+
},
|
|
8031
8045
|
{
|
|
8032
8046
|
"name": "index",
|
|
8033
8047
|
"property": "index",
|
|
@@ -8091,12 +8105,24 @@
|
|
|
8091
8105
|
}
|
|
8092
8106
|
],
|
|
8093
8107
|
"properties": [
|
|
8108
|
+
{
|
|
8109
|
+
"name": "description",
|
|
8110
|
+
"description": "Accessible instruction for cycling; accepts localized reader text.",
|
|
8111
|
+
"type": "string",
|
|
8112
|
+
"default": "Activate to choose the next state."
|
|
8113
|
+
},
|
|
8094
8114
|
{
|
|
8095
8115
|
"name": "disabled",
|
|
8096
8116
|
"description": "Prevents cycling while keeping the selected state visible.",
|
|
8097
8117
|
"type": "boolean",
|
|
8098
8118
|
"default": false
|
|
8099
8119
|
},
|
|
8120
|
+
{
|
|
8121
|
+
"name": "emptyLabel",
|
|
8122
|
+
"description": "Selected-state label while no choices are available.",
|
|
8123
|
+
"type": "string",
|
|
8124
|
+
"default": "No choices"
|
|
8125
|
+
},
|
|
8100
8126
|
{
|
|
8101
8127
|
"name": "index",
|
|
8102
8128
|
"description": "Initial or externally selected zero-based state. The first state is the default.",
|
package/package.json
CHANGED
|
@@ -11,7 +11,9 @@ export interface UiCycleButtonElement extends HTMLSpanElement {
|
|
|
11
11
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
12
12
|
}
|
|
13
13
|
export interface UiCycleButtonProps {
|
|
14
|
+
description?: string | null;
|
|
14
15
|
disabled?: boolean | null;
|
|
16
|
+
emptyLabel?: string | null;
|
|
15
17
|
index?: number | null;
|
|
16
18
|
items: readonly ({ readonly value: string; readonly label: string; readonly icon: string })[];
|
|
17
19
|
label?: string | null;
|
package/vanilla/UiCycleButton.js
CHANGED
|
@@ -3,10 +3,10 @@ import { attachGeneratedController, stateInitializers, binaryValue, buildTemplat
|
|
|
3
3
|
import * as controller from "../components/ui-cycle-button/ui-cycle-button.js";
|
|
4
4
|
import "../styles/ui-cycle-button.css";
|
|
5
5
|
|
|
6
|
-
const T0 = ["",[],["ui-icon-button",["tone","neutral"
|
|
6
|
+
const T0 = ["",[],["ui-icon-button",["tone","neutral"],["ui-icon",[]]]];
|
|
7
7
|
let P0;
|
|
8
8
|
const S = { n: ["current","selected"], t: ["n","?"], f: import.meta.url, g: "ui-cycle-button", k: 1, d: { "change": [detailCheck(checkObject([["value", checkString, false], ["index", checkNumber, false]], false)), true, true, false] }, x: dispatchDeclared, r: readonlyView, a: (host, I) => C(host, I), b: generatedInputs };
|
|
9
|
-
const D = { g: "ui-cycle-button", props: { "disabled": { "required":false,"default":false, c: checkBoolean, t: "boolean", j: 0, m: "b" }, "index": { "required":false,"default":0, c: checkNumber, t: "number", j: 0, m: "n" }, "items": { "required":true, c: checkList(checkObject([["value", checkString, false], ["label", checkString, false], ["icon", checkString, false]], false)), j: 1, m: ["l",["o",["value","s","label","s","icon","s"]]] }, "label": { "required":false,"default":"State", c: checkString, t: "string", j: 0, m: "s" }, "size": { "required":false,"values":["sm","md","lg"],"default":"md", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "variant": { "required":false,"values":["ghost","outline","solid"],"default":"outline", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] } } };
|
|
9
|
+
const D = { g: "ui-cycle-button", props: { "description": { "required":false,"default":"Activate to choose the next state.", c: checkString, t: "string", j: 0, m: "s" }, "disabled": { "required":false,"default":false, c: checkBoolean, t: "boolean", j: 0, m: "b" }, "emptyLabel": { "required":false,"default":"No choices", c: checkString, t: "string", j: 0, m: "s" }, "index": { "required":false,"default":0, c: checkNumber, t: "number", j: 0, m: "n" }, "items": { "required":true, c: checkList(checkObject([["value", checkString, false], ["label", checkString, false], ["icon", checkString, false]], false)), j: 1, m: ["l",["o",["value","s","label","s","icon","s"]]] }, "label": { "required":false,"default":"State", c: checkString, t: "string", j: 0, m: "s" }, "size": { "required":false,"values":["sm","md","lg"],"default":"md", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "variant": { "required":false,"values":["ghost","outline","solid"],"default":"outline", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] } } };
|
|
10
10
|
const C = (host) => activateModule(controller, host);
|
|
11
11
|
|
|
12
12
|
export function createUiCycleButton(options, html) {
|
|
@@ -18,13 +18,13 @@ export function createUiCycleButton(options, html) {
|
|
|
18
18
|
}
|
|
19
19
|
element.setAttribute("data-component", "ui-cycle-button");
|
|
20
20
|
element.append((P0 ??= buildTemplate(T0)).cloneNode(true));
|
|
21
|
-
const v = [null, undefined, null, null, null, null, null, null];
|
|
21
|
+
const v = [null, undefined, null, null, null, null, null, null, null, null];
|
|
22
22
|
const B = acceptProps(element, D, S.n, v, componentProps, [], html);
|
|
23
23
|
const CS = [];
|
|
24
|
-
const inputStatus = (j) => { if (j === 0) return E.status(j); if (j >= 1 && j < 2) { g(j); return CS[j] ?? UNRESOLVED_INPUT; } if (j === 2) return awaitInput(B, "
|
|
24
|
+
const inputStatus = (j) => { if (j === 0) return E.status(j); if (j >= 1 && j < 2) { g(j); return CS[j] ?? UNRESOLVED_INPUT; } if (j === 2) return awaitInput(B, "description", true); if (j === 3) return awaitInput(B, "disabled", true); if (j === 4) return awaitInput(B, "emptyLabel", true); if (j === 5) return awaitInput(B, "index", true); if (j === 6) return awaitInput(B, "items", true); if (j === 7) return awaitInput(B, "label", true); if (j === 8) return awaitInput(B, "size", true); if (j === 9) return awaitInput(B, "variant", true); return v[j] === undefined ? UNRESOLVED_INPUT : READY_INPUT; };
|
|
25
25
|
const X = { e: 0, g: (j) => g(j), w: new Set(), a: CS, i: inputStatus };
|
|
26
26
|
const ke = [];
|
|
27
|
-
const K = [() => (checkReference(S, v[0], "n", "expression:default($items[default($current, 0)], $items[0]):current", "Reference `current` must satisfy number.") && checkReference(S, readDeclared(v[
|
|
27
|
+
const K = [() => (checkReference(S, v[0], "n", "expression:default($items[default($current, 0)], $items[0]):current", "Reference `current` must satisfy number.") && checkReference(S, readDeclared(v[6], ["0"]), ["o",["value","s","label","s","icon","s"]], "expression:default($items[default($current, 0)], $items[0]):items.0", "Reference `items.0` must satisfy object({ value: string, label: string, icon: string }).") ? inputDefault(() => readIndex(inputRead(v[6], inputStatus(6)), inputDefault(() => inputRead(E.read(0), inputStatus(0)), () => 0, ABSENT)), () => readIndex(inputRead(v[6], inputStatus(6)), 0), ABSENT) : NONCONFORMING)];
|
|
28
28
|
const g = (j) => {
|
|
29
29
|
const i = j - 1;
|
|
30
30
|
if (ke[i] === X.e) return v[j];
|
|
@@ -37,10 +37,10 @@ export function createUiCycleButton(options, html) {
|
|
|
37
37
|
if (!Object.is(previous, next)) { v[j] = next; X.n?.(j, previous, next); }
|
|
38
38
|
return next;
|
|
39
39
|
};
|
|
40
|
-
const E = stateInitializers(S, v, X, { 0: () => inputRead(v[
|
|
40
|
+
const E = stateInitializers(S, v, X, { 0: () => inputRead(v[5], inputStatus(5)) });
|
|
41
41
|
const p0 = (r, c, d) => {
|
|
42
|
-
if (c &
|
|
43
|
-
const x0 = textCall("concat", [v[
|
|
42
|
+
if (c & 1073742033) {
|
|
43
|
+
const x0 = textCall("concat", [v[7], ": ", defaultValue(readFailing(g(1), "label"), v[4])]);
|
|
44
44
|
if (x0 !== NONCONFORMING) {
|
|
45
45
|
const s0 = toAttribute(x0, "label");
|
|
46
46
|
if (s0 !== r.v0) writeAttribute(r.a0, "label", r.v0 = s0);
|
|
@@ -50,36 +50,41 @@ export function createUiCycleButton(options, html) {
|
|
|
50
50
|
if (s1 !== r.v1) writeAttribute(r.a0, "title", r.v1 = s1);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
if (c &
|
|
54
|
-
const x1 = v[
|
|
53
|
+
if (c & 1073742080) {
|
|
54
|
+
const x1 = v[8];
|
|
55
55
|
const s2 = toAttribute(x1, "size");
|
|
56
56
|
if (s2 !== r.v2) writeAttribute(r.a0, "size", r.v2 = s2);
|
|
57
57
|
}
|
|
58
|
-
if (c &
|
|
59
|
-
const x2 = v[
|
|
58
|
+
if (c & 1073742336) {
|
|
59
|
+
const x2 = v[9];
|
|
60
60
|
const s3 = toAttribute(x2, "variant");
|
|
61
61
|
if (s3 !== r.v3) writeAttribute(r.a0, "variant", r.v3 = s3);
|
|
62
62
|
}
|
|
63
|
-
if (c &
|
|
64
|
-
const x3 = (truthy(v[
|
|
63
|
+
if (c & 1073741896) {
|
|
64
|
+
const x3 = (truthy(v[3]) || truthy(binaryValue("<", readMember(v[6], "length"), 2)));
|
|
65
65
|
const s4 = toAttribute(x3, "disabled");
|
|
66
66
|
if (s4 !== r.v4) writeAttribute(r.a0, "disabled", r.v4 = s4);
|
|
67
67
|
}
|
|
68
|
-
if (c &
|
|
69
|
-
const x4 =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
if (c & 4) {
|
|
69
|
+
const x4 = v[2];
|
|
70
|
+
const s5 = toAttribute(x4, "aria-description");
|
|
71
|
+
if (s5 !== r.v5) writeAttribute(r.a0, "aria-description", r.v5 = s5);
|
|
72
|
+
}
|
|
73
|
+
if (c & 1073741889) {
|
|
74
|
+
const x5 = defaultValue(readFailing(g(1), "icon"), "");
|
|
75
|
+
if (x5 !== NONCONFORMING) {
|
|
76
|
+
const s6 = toAttribute(x5, "name");
|
|
77
|
+
if (s6 !== r.v6) writeAttribute(r.a1, "name", r.v6 = s6);
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
};
|
|
76
81
|
const t0 = element.firstChild;
|
|
77
82
|
const t1 = t0.firstChild;
|
|
78
|
-
const R = { a0: t0, a1: t1, v0: null, v1: null, v2: null, v3: null, v4: null, v5: null };
|
|
83
|
+
const R = { a0: t0, a1: t1, v0: null, v1: null, v2: null, v3: null, v4: null, v5: null, v6: null };
|
|
79
84
|
const I = { B, U: E };
|
|
80
85
|
I.R = new Set();
|
|
81
86
|
attachGeneratedController(element, S, v, (c, d) => { ((c, d) => p0(R, c, d))(c, d); for (const f of I.R) f(c, d); }, undefined, X, I);
|
|
82
87
|
manageProps(I);
|
|
83
88
|
return element;
|
|
84
89
|
}
|
|
85
|
-
defineComponent("ui-cycle-button", createUiCycleButton, ["disabled","index","items","label","size","variant"]);
|
|
90
|
+
defineComponent("ui-cycle-button", createUiCycleButton, ["description","disabled","emptyLabel","index","items","label","size","variant"]);
|