@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.d.mts
CHANGED
|
@@ -88,7 +88,7 @@ declare function extractDomTree(root?: Element): ExtractedElement[];
|
|
|
88
88
|
* Семантический тип объекта VSL (поле `t`): L1-теги + L2-роли (T1.1.3/T1.1.4),
|
|
89
89
|
* L3-CSS (T1.5.1), L4-структурные (T1.5.2), L5-vision (T1.5.4).
|
|
90
90
|
*/
|
|
91
|
-
type VslType = 'button' | 'input' | 'file_input' | 'link' | 'nav' | 'header' | 'main' | 'container' | 'image' | 'select' | 'textarea' | 'modal' | 'tab' | 'heading' | 'footer' | 'scrollable_container' | 'toolbar' | 'list' | 'grid' | 'form_field' | 'tab_bar' | 'layout' | 'icon' | 'chart' | 'custom_widget' | 'unknown';
|
|
91
|
+
type VslType = 'button' | 'input' | 'file_input' | 'link' | 'nav' | 'header' | 'main' | 'container' | 'image' | 'select' | 'textarea' | 'modal' | 'tab' | 'dropdown_toggle' | 'heading' | 'footer' | 'scrollable_container' | 'toolbar' | 'list' | 'grid' | 'form_field' | 'tab_bar' | 'layout' | 'icon' | 'chart' | 'custom_widget' | 'unknown';
|
|
92
92
|
/** Состояние объекта VSL (поле `st`) — из ARIA-атрибутов (T1.1.4). */
|
|
93
93
|
type VslState = 'checked' | 'expanded' | 'disabled';
|
|
94
94
|
/** Тип визуального фрагмента — выход классификации vision (§2.2.2 Шаг 2). */
|
|
@@ -189,6 +189,8 @@ interface VslObject {
|
|
|
189
189
|
accept?: string;
|
|
190
190
|
/** Multiple attribute для file_input — разрешена загрузка нескольких файлов. */
|
|
191
191
|
multiple?: boolean;
|
|
192
|
+
/** Атрибут aria-haspopup — указывает на dropdown/menu (для LLM). */
|
|
193
|
+
hasPopup?: string;
|
|
192
194
|
}
|
|
193
195
|
interface VslDocument {
|
|
194
196
|
vsl_version: string;
|
|
@@ -1097,7 +1099,7 @@ declare const ACTION_TOOL_SCHEMA: {
|
|
|
1097
1099
|
action: {
|
|
1098
1100
|
type: string;
|
|
1099
1101
|
description: string;
|
|
1100
|
-
enum: ("select" | "type" | "click" | "close" | "check" | "uncheck" | "clear" | "scroll" | "hover" | "focus" | "blur" | "drag" | "drop" | "submit" | "reset" | "open" | "
|
|
1102
|
+
enum: ("select" | "type" | "click" | "expand" | "collapse" | "close" | "check" | "uncheck" | "clear" | "scroll" | "hover" | "focus" | "blur" | "drag" | "drop" | "submit" | "reset" | "open" | "wait" | "navigate" | "go_back" | "go_forward" | "refresh" | "download")[];
|
|
1101
1103
|
};
|
|
1102
1104
|
target_id: {
|
|
1103
1105
|
type: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ declare function extractDomTree(root?: Element): ExtractedElement[];
|
|
|
88
88
|
* Семантический тип объекта VSL (поле `t`): L1-теги + L2-роли (T1.1.3/T1.1.4),
|
|
89
89
|
* L3-CSS (T1.5.1), L4-структурные (T1.5.2), L5-vision (T1.5.4).
|
|
90
90
|
*/
|
|
91
|
-
type VslType = 'button' | 'input' | 'file_input' | 'link' | 'nav' | 'header' | 'main' | 'container' | 'image' | 'select' | 'textarea' | 'modal' | 'tab' | 'heading' | 'footer' | 'scrollable_container' | 'toolbar' | 'list' | 'grid' | 'form_field' | 'tab_bar' | 'layout' | 'icon' | 'chart' | 'custom_widget' | 'unknown';
|
|
91
|
+
type VslType = 'button' | 'input' | 'file_input' | 'link' | 'nav' | 'header' | 'main' | 'container' | 'image' | 'select' | 'textarea' | 'modal' | 'tab' | 'dropdown_toggle' | 'heading' | 'footer' | 'scrollable_container' | 'toolbar' | 'list' | 'grid' | 'form_field' | 'tab_bar' | 'layout' | 'icon' | 'chart' | 'custom_widget' | 'unknown';
|
|
92
92
|
/** Состояние объекта VSL (поле `st`) — из ARIA-атрибутов (T1.1.4). */
|
|
93
93
|
type VslState = 'checked' | 'expanded' | 'disabled';
|
|
94
94
|
/** Тип визуального фрагмента — выход классификации vision (§2.2.2 Шаг 2). */
|
|
@@ -189,6 +189,8 @@ interface VslObject {
|
|
|
189
189
|
accept?: string;
|
|
190
190
|
/** Multiple attribute для file_input — разрешена загрузка нескольких файлов. */
|
|
191
191
|
multiple?: boolean;
|
|
192
|
+
/** Атрибут aria-haspopup — указывает на dropdown/menu (для LLM). */
|
|
193
|
+
hasPopup?: string;
|
|
192
194
|
}
|
|
193
195
|
interface VslDocument {
|
|
194
196
|
vsl_version: string;
|
|
@@ -1097,7 +1099,7 @@ declare const ACTION_TOOL_SCHEMA: {
|
|
|
1097
1099
|
action: {
|
|
1098
1100
|
type: string;
|
|
1099
1101
|
description: string;
|
|
1100
|
-
enum: ("select" | "type" | "click" | "close" | "check" | "uncheck" | "clear" | "scroll" | "hover" | "focus" | "blur" | "drag" | "drop" | "submit" | "reset" | "open" | "
|
|
1102
|
+
enum: ("select" | "type" | "click" | "expand" | "collapse" | "close" | "check" | "uncheck" | "clear" | "scroll" | "hover" | "focus" | "blur" | "drag" | "drop" | "submit" | "reset" | "open" | "wait" | "navigate" | "go_back" | "go_forward" | "refresh" | "download")[];
|
|
1101
1103
|
};
|
|
1102
1104
|
target_id: {
|
|
1103
1105
|
type: string;
|
package/dist/index.js
CHANGED
|
@@ -198,6 +198,13 @@ function resolveAriaRoleType(role) {
|
|
|
198
198
|
if (!role) return null;
|
|
199
199
|
return ARIA_ROLE_TYPE_MAP[role.toLowerCase()] ?? null;
|
|
200
200
|
}
|
|
201
|
+
function resolveDropdownToggle(attributes) {
|
|
202
|
+
const hasPopup = attributes["aria-haspopup"];
|
|
203
|
+
if (hasPopup === "menu" || hasPopup === "listbox") {
|
|
204
|
+
return "dropdown_toggle";
|
|
205
|
+
}
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
201
208
|
var TRUE = "true";
|
|
202
209
|
function resolveSt(attributes) {
|
|
203
210
|
if (attributes["aria-pressed"] === TRUE) return "checked";
|
|
@@ -331,7 +338,7 @@ function segmentOne(el) {
|
|
|
331
338
|
indexPath: el.indexPath,
|
|
332
339
|
rect: el.rect,
|
|
333
340
|
attributes,
|
|
334
|
-
t: isFileInput ? "file_input" : resolveLevel1Type(el.tag) ?? resolveAriaRoleType(attributes["role"]) ?? resolveLevel3Type(el.css, attributes),
|
|
341
|
+
t: isFileInput ? "file_input" : resolveDropdownToggle(attributes) ?? resolveLevel1Type(el.tag) ?? resolveAriaRoleType(attributes["role"]) ?? resolveLevel3Type(el.css, attributes),
|
|
335
342
|
txt: attributes["aria-label"] ?? el.text,
|
|
336
343
|
st: resolveSt(attributes),
|
|
337
344
|
css: el.css,
|
|
@@ -377,6 +384,8 @@ function defaultActions(t, st, attributes) {
|
|
|
377
384
|
case "link":
|
|
378
385
|
case "tab":
|
|
379
386
|
return ["click"];
|
|
387
|
+
case "dropdown_toggle":
|
|
388
|
+
return ["click", "expand", "collapse"];
|
|
380
389
|
case "modal":
|
|
381
390
|
return ["close"];
|
|
382
391
|
case "input": {
|
|
@@ -466,6 +475,9 @@ function toVslObject(el, viewport, includedChildren, textBlocks, counter) {
|
|
|
466
475
|
if (el.attributes["accept"] !== void 0) object.accept = el.attributes["accept"];
|
|
467
476
|
if (el.attributes["multiple"] !== void 0) object.multiple = true;
|
|
468
477
|
}
|
|
478
|
+
if (t === "dropdown_toggle" && el.attributes["aria-haspopup"] !== void 0) {
|
|
479
|
+
object.hasPopup = el.attributes["aria-haspopup"];
|
|
480
|
+
}
|
|
469
481
|
return object;
|
|
470
482
|
}
|
|
471
483
|
function convert(el, viewport, textBlocks, counter) {
|