@reticular/speakable 1.5.0 → 1.7.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/README.md +86 -2
- package/dist/browser/index.d.ts +58 -0
- package/dist/browser/index.js +3978 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/chunk-WYFXGXYU.js +87 -0
- package/dist/chunk-WYFXGXYU.js.map +1 -0
- package/dist/cli.js +40 -19
- package/dist/cli.js.map +1 -1
- package/dist/harness/index.d.ts +57 -0
- package/dist/harness/index.js +176 -0
- package/dist/harness/index.js.map +1 -0
- package/dist/index.js +44 -22
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +40 -19
- package/dist/mcp.js.map +1 -1
- package/dist/speakable-browser.global.js +10 -0
- package/dist/speakable-browser.global.js.map +1 -0
- package/dist/storybook/dist/chunk-3SVI6IQE.js +86 -0
- package/dist/storybook/dist/chunk-JSBRDJBE.js +30 -0
- package/dist/storybook/dist/chunk-QVJRQZT5.js +16 -0
- package/dist/storybook/dist/index.js +17 -0
- package/dist/storybook/dist/manager.js +701 -0
- package/dist/storybook/dist/preset.js +38 -0
- package/dist/storybook/dist/preview.js +4199 -0
- package/dist/storybook/dist/upgrade-5GL42JH4.js +7 -0
- package/dist/types-Blh0EnZF.d.ts +213 -0
- package/dist/upgrade-53M5VYGH.js +7 -0
- package/dist/upgrade-53M5VYGH.js.map +1 -0
- package/package.json +28 -3
package/dist/mcp.js
CHANGED
|
@@ -849,17 +849,54 @@ function processChildNode(node, children, warnings) {
|
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
851
|
function collectChildrenFromRolelessElement(element, warnings) {
|
|
852
|
+
return collectAccessibleChildren(element, warnings);
|
|
853
|
+
}
|
|
854
|
+
function collectAccessibleChildren(element, warnings) {
|
|
852
855
|
const children = [];
|
|
853
856
|
if (element.shadowRoot) {
|
|
854
857
|
for (const child of Array.from(element.shadowRoot.childNodes)) {
|
|
855
|
-
|
|
858
|
+
processShadowNode(child, children, warnings);
|
|
856
859
|
}
|
|
860
|
+
return children;
|
|
861
|
+
}
|
|
862
|
+
if (element.localName && element.localName.includes("-") && element.childNodes.length === 0) {
|
|
863
|
+
warnings.push({
|
|
864
|
+
message: `Custom element <${element.localName}> has no accessible children and may have a closed shadow root; its content could not be analyzed.`,
|
|
865
|
+
element
|
|
866
|
+
});
|
|
857
867
|
}
|
|
858
868
|
for (const child of Array.from(element.childNodes)) {
|
|
859
869
|
processChildNode(child, children, warnings);
|
|
860
870
|
}
|
|
861
871
|
return children;
|
|
862
872
|
}
|
|
873
|
+
function processShadowNode(node, children, warnings) {
|
|
874
|
+
if (node.nodeType === 1) {
|
|
875
|
+
const element = node;
|
|
876
|
+
if (element.localName === "slot") {
|
|
877
|
+
const slot = element;
|
|
878
|
+
let assigned = [];
|
|
879
|
+
if (typeof slot.assignedNodes === "function") {
|
|
880
|
+
try {
|
|
881
|
+
assigned = Array.from(slot.assignedNodes({ flatten: true }));
|
|
882
|
+
} catch {
|
|
883
|
+
assigned = [];
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
if (assigned.length > 0) {
|
|
887
|
+
for (const assignedNode of assigned) {
|
|
888
|
+
processChildNode(assignedNode, children, warnings);
|
|
889
|
+
}
|
|
890
|
+
} else {
|
|
891
|
+
for (const child of Array.from(slot.childNodes)) {
|
|
892
|
+
processShadowNode(child, children, warnings);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
processChildNode(node, children, warnings);
|
|
899
|
+
}
|
|
863
900
|
function buildAccessibilityTree(rootElement, sourceHash) {
|
|
864
901
|
const warnings = [];
|
|
865
902
|
if (isHidden(rootElement)) {
|
|
@@ -952,15 +989,7 @@ function buildNodeRecursive(element, warnings) {
|
|
|
952
989
|
element: w.element
|
|
953
990
|
})));
|
|
954
991
|
const focusInfo = extractFocusInfo(element);
|
|
955
|
-
const children =
|
|
956
|
-
if (element.shadowRoot) {
|
|
957
|
-
for (const child of Array.from(element.shadowRoot.childNodes)) {
|
|
958
|
-
processChildNode(child, children, warnings);
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
for (const child of Array.from(element.childNodes)) {
|
|
962
|
-
processChildNode(child, children, warnings);
|
|
963
|
-
}
|
|
992
|
+
const children = collectAccessibleChildren(element, warnings);
|
|
964
993
|
const node = {
|
|
965
994
|
role: roleResult.role,
|
|
966
995
|
name: nameResult.name,
|
|
@@ -973,15 +1002,7 @@ function buildNodeRecursive(element, warnings) {
|
|
|
973
1002
|
return node;
|
|
974
1003
|
}
|
|
975
1004
|
function createGenericContainer(rootElement, warnings) {
|
|
976
|
-
const children =
|
|
977
|
-
if (rootElement.shadowRoot) {
|
|
978
|
-
for (const child of Array.from(rootElement.shadowRoot.childNodes)) {
|
|
979
|
-
processChildNode(child, children, warnings);
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
for (const child of Array.from(rootElement.childNodes)) {
|
|
983
|
-
processChildNode(child, children, warnings);
|
|
984
|
-
}
|
|
1005
|
+
const children = collectAccessibleChildren(rootElement, warnings);
|
|
985
1006
|
return {
|
|
986
1007
|
role: "generic",
|
|
987
1008
|
name: "",
|