auto-webmcp 0.2.7 → 0.2.8
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/analyzer.d.ts.map +1 -1
- package/dist/auto-webmcp.cjs.js +67 -5
- package/dist/auto-webmcp.cjs.js.map +2 -2
- package/dist/auto-webmcp.esm.js +67 -5
- package/dist/auto-webmcp.esm.js.map +2 -2
- package/dist/auto-webmcp.iife.js +2 -2
- package/dist/auto-webmcp.iife.js.map +3 -3
- package/dist/schema.d.ts +1 -0
- package/dist/schema.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/analyzer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAA8H,MAAM,aAAa,CAAC;AACrK,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC;IACxB,6FAA6F;IAC7F,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAKD,iDAAiD;AACjD,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED,gDAAgD;AAChD,wBAAgB,WAAW,CAAC,IAAI,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,YAAY,GAAG,YAAY,CAMxF;
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAA8H,MAAM,aAAa,CAAC;AACrK,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC;IACxB,6FAA6F;IAC7F,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAKD,iDAAiD;AACjD,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED,gDAAgD;AAChD,wBAAgB,WAAW,CAAC,IAAI,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,YAAY,GAAG,YAAY,CAMxF;AAgcD;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,KAAK,CAAC,gBAAgB,GAAG,mBAAmB,GAAG,iBAAiB,CAAC,EACzE,SAAS,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,IAAI,GACrD,YAAY,CAKd"}
|
package/dist/auto-webmcp.cjs.js
CHANGED
|
@@ -189,15 +189,55 @@ function buildStringSchema(input) {
|
|
|
189
189
|
prop.maxLength = input.maxLength;
|
|
190
190
|
if (input.pattern)
|
|
191
191
|
prop.pattern = input.pattern;
|
|
192
|
+
const listId = input.getAttribute("list");
|
|
193
|
+
if (listId) {
|
|
194
|
+
const datalist = input.ownerDocument.getElementById(listId);
|
|
195
|
+
if (datalist instanceof HTMLDataListElement) {
|
|
196
|
+
const options = Array.from(datalist.options).filter(
|
|
197
|
+
(o) => !o.disabled && o.value.trim() !== ""
|
|
198
|
+
);
|
|
199
|
+
if (options.length > 0) {
|
|
200
|
+
prop.enum = options.map((o) => o.value.trim());
|
|
201
|
+
prop.oneOf = options.map((o) => ({
|
|
202
|
+
const: o.value.trim(),
|
|
203
|
+
title: o.textContent?.trim() || o.value.trim()
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
192
208
|
return prop;
|
|
193
209
|
}
|
|
194
210
|
function mapSelectElement(select) {
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
211
|
+
const enumValues = [];
|
|
212
|
+
const oneOf = [];
|
|
213
|
+
for (const child of Array.from(select.children)) {
|
|
214
|
+
if (child instanceof HTMLOptGroupElement) {
|
|
215
|
+
if (child.disabled)
|
|
216
|
+
continue;
|
|
217
|
+
const groupLabel = child.label?.trim() ?? "";
|
|
218
|
+
for (const opt of Array.from(child.children)) {
|
|
219
|
+
if (!(opt instanceof HTMLOptionElement))
|
|
220
|
+
continue;
|
|
221
|
+
if (opt.disabled || opt.value === "")
|
|
222
|
+
continue;
|
|
223
|
+
enumValues.push(opt.value);
|
|
224
|
+
const entry = {
|
|
225
|
+
const: opt.value,
|
|
226
|
+
title: opt.text.trim() || opt.value
|
|
227
|
+
};
|
|
228
|
+
if (groupLabel)
|
|
229
|
+
entry.group = groupLabel;
|
|
230
|
+
oneOf.push(entry);
|
|
231
|
+
}
|
|
232
|
+
} else if (child instanceof HTMLOptionElement) {
|
|
233
|
+
if (child.disabled || child.value === "")
|
|
234
|
+
continue;
|
|
235
|
+
enumValues.push(child.value);
|
|
236
|
+
oneOf.push({ const: child.value, title: child.text.trim() || child.value });
|
|
237
|
+
}
|
|
198
238
|
}
|
|
199
|
-
|
|
200
|
-
|
|
239
|
+
if (enumValues.length === 0)
|
|
240
|
+
return { type: "string" };
|
|
201
241
|
return { type: "string", enum: enumValues, oneOf };
|
|
202
242
|
}
|
|
203
243
|
function collectRadioEnum(form, name) {
|
|
@@ -404,6 +444,8 @@ function buildSchema(form) {
|
|
|
404
444
|
const schemaProp = inputTypeToSchema(control);
|
|
405
445
|
if (!schemaProp)
|
|
406
446
|
continue;
|
|
447
|
+
if (!isControlVisible(control))
|
|
448
|
+
continue;
|
|
407
449
|
schemaProp.title = inferFieldTitle(control);
|
|
408
450
|
const desc = inferFieldDescription(control);
|
|
409
451
|
if (desc)
|
|
@@ -597,6 +639,24 @@ function labelTextWithoutNested(label) {
|
|
|
597
639
|
function humanizeName(raw) {
|
|
598
640
|
return raw.replace(/[-_]/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").trim().replace(/\b\w/g, (c) => c.toUpperCase());
|
|
599
641
|
}
|
|
642
|
+
function isControlVisible(el) {
|
|
643
|
+
const style = window.getComputedStyle(el);
|
|
644
|
+
if (style.display === "none")
|
|
645
|
+
return false;
|
|
646
|
+
if (style.visibility === "hidden")
|
|
647
|
+
return false;
|
|
648
|
+
if (el.offsetParent === null && style.position !== "fixed")
|
|
649
|
+
return false;
|
|
650
|
+
let node = el;
|
|
651
|
+
while (node && node !== document.body) {
|
|
652
|
+
if (node.getAttribute("aria-hidden") === "true")
|
|
653
|
+
return false;
|
|
654
|
+
node = node.parentElement;
|
|
655
|
+
}
|
|
656
|
+
if (el.closest("fieldset")?.disabled)
|
|
657
|
+
return false;
|
|
658
|
+
return true;
|
|
659
|
+
}
|
|
600
660
|
function analyzeOrphanInputGroup(container, inputs, submitBtn) {
|
|
601
661
|
const name = inferOrphanToolName(container, submitBtn);
|
|
602
662
|
const description = inferOrphanToolDescription(container);
|
|
@@ -667,6 +727,8 @@ function buildSchemaFromInputs(inputs) {
|
|
|
667
727
|
const schemaProp = inputTypeToSchema(control);
|
|
668
728
|
if (!schemaProp)
|
|
669
729
|
continue;
|
|
730
|
+
if (!isControlVisible(control))
|
|
731
|
+
continue;
|
|
670
732
|
schemaProp.title = inferFieldTitle(control);
|
|
671
733
|
const desc = inferFieldDescription(control);
|
|
672
734
|
if (desc)
|