@thinkingos/vsl-sdk 0.3.1 → 0.4.0
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/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -137,6 +137,13 @@ function resolveAriaRoleType(role) {
|
|
|
137
137
|
if (!role) return null;
|
|
138
138
|
return ARIA_ROLE_TYPE_MAP[role.toLowerCase()] ?? null;
|
|
139
139
|
}
|
|
140
|
+
function resolveDropdownToggle(attributes) {
|
|
141
|
+
const hasPopup = attributes["aria-haspopup"];
|
|
142
|
+
if (hasPopup === "menu" || hasPopup === "listbox") {
|
|
143
|
+
return "dropdown_toggle";
|
|
144
|
+
}
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
140
147
|
var TRUE = "true";
|
|
141
148
|
function resolveSt(attributes) {
|
|
142
149
|
if (attributes["aria-pressed"] === TRUE) return "checked";
|
|
@@ -270,7 +277,7 @@ function segmentOne(el) {
|
|
|
270
277
|
indexPath: el.indexPath,
|
|
271
278
|
rect: el.rect,
|
|
272
279
|
attributes,
|
|
273
|
-
t: isFileInput ? "file_input" : resolveLevel1Type(el.tag) ?? resolveAriaRoleType(attributes["role"]) ?? resolveLevel3Type(el.css, attributes),
|
|
280
|
+
t: isFileInput ? "file_input" : resolveDropdownToggle(attributes) ?? resolveLevel1Type(el.tag) ?? resolveAriaRoleType(attributes["role"]) ?? resolveLevel3Type(el.css, attributes),
|
|
274
281
|
txt: attributes["aria-label"] ?? el.text,
|
|
275
282
|
st: resolveSt(attributes),
|
|
276
283
|
css: el.css,
|
|
@@ -316,6 +323,8 @@ function defaultActions(t, st, attributes) {
|
|
|
316
323
|
case "link":
|
|
317
324
|
case "tab":
|
|
318
325
|
return ["click"];
|
|
326
|
+
case "dropdown_toggle":
|
|
327
|
+
return ["click", "expand", "collapse"];
|
|
319
328
|
case "modal":
|
|
320
329
|
return ["close"];
|
|
321
330
|
case "input": {
|
|
@@ -405,6 +414,9 @@ function toVslObject(el, viewport, includedChildren, textBlocks, counter) {
|
|
|
405
414
|
if (el.attributes["accept"] !== void 0) object.accept = el.attributes["accept"];
|
|
406
415
|
if (el.attributes["multiple"] !== void 0) object.multiple = true;
|
|
407
416
|
}
|
|
417
|
+
if (t === "dropdown_toggle" && el.attributes["aria-haspopup"] !== void 0) {
|
|
418
|
+
object.hasPopup = el.attributes["aria-haspopup"];
|
|
419
|
+
}
|
|
408
420
|
return object;
|
|
409
421
|
}
|
|
410
422
|
function convert(el, viewport, textBlocks, counter) {
|