@react-native-windows/automation-commands 0.1.90 → 0.1.91
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.
|
@@ -22,7 +22,7 @@ export type UIElement = {
|
|
|
22
22
|
Height?: number | null;
|
|
23
23
|
BorderBrush?: string | null;
|
|
24
24
|
VerticalAlignment?: string | null;
|
|
25
|
-
|
|
25
|
+
HorizontalAlignment?: string | null;
|
|
26
26
|
Clip?: string | null;
|
|
27
27
|
FlowDirection?: string | null;
|
|
28
28
|
Name?: string | null;
|
|
@@ -41,7 +41,7 @@ function pruneCollapsedElements(element) {
|
|
|
41
41
|
element.children.forEach(pruneCollapsedElements);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* Removes trees of properties that are not
|
|
44
|
+
* Removes trees of properties that are not deterministic
|
|
45
45
|
*/
|
|
46
46
|
function removeNonDeterministicProps(element) {
|
|
47
47
|
if (element.RenderSize) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dumpVisualTree.js","sourceRoot":"","sources":["../src/dumpVisualTree.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAkCH;;GAEG;AACY,KAAK,UAAU,cAAc,CAC1C,eAAuB,EACvB,IAIC;IAED,IAAI,CAAC,gBAAgB,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;KAC9C;IAED,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC,MAAM,CAAC,gBAAgB,EAAE;QACnE,eAAe;QACf,GAAG,IAAI;KACR,CAAC,CAAC;IAEH,IAAI,YAAY,CAAC,IAAI,KAAK,OAAO,EAAE;QACjC,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;KACvC;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC;IAEpC,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,cAAc,MAAK,KAAK,EAAE;QAClC,sBAAsB,CAAC,OAAO,CAAC,CAAC;KACjC;IAED,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,iBAAiB,MAAK,KAAK,EAAE;QACrC,2BAA2B,CAAC,OAAO,CAAC,CAAC;KACtC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAhCD,iCAgCC;AAED;;GAEG;AACH,SAAS,sBAAsB,CAAC,OAAkB;IAChD,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QACrB,OAAO;KACR;IAED,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CACxC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,WAAW,CAC1C,CAAC;IAEF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,SAAS,2BAA2B,CAAC,OAAkB;IACrD,IAAI,OAAO,CAAC,UAAU,EAAE;QACtB,2EAA2E;QAC3E,8CAA8C;QAC9C,OAAO,OAAO,CAAC,UAAU,CAAC;KAC3B;IAED,IAAI,OAAO,CAAC,QAAQ,EAAE;QACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;KACvD;AACH,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport {AutomationClient} from '@react-native-windows/automation-channel';\n\n/**\n * Schema of tree dumped node\n */\nexport type UIElement = {\n XamlType: string;\n Foreground?: string | null;\n Background?: string | null;\n Padding?: string | null;\n Margin?: string | null;\n RenderSize?: number[] | null;\n Visibility?: 'Collapsed' | 'Visible' | null;\n CornerRadius?: string | null;\n BorderThickness?: string | null;\n Width?: number | null;\n Height?: number | null;\n BorderBrush?: string | null;\n VerticalAlignment?: string | null;\n
|
|
1
|
+
{"version":3,"file":"dumpVisualTree.js","sourceRoot":"","sources":["../src/dumpVisualTree.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C;KAC3B;IAED,IAAI,OAAO,CAAC,QAAQ,EAAE;QACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;KACvD;AACH,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport {AutomationClient} from '@react-native-windows/automation-channel';\n\n/**\n * Schema of tree dumped node\n */\nexport type UIElement = {\n XamlType: string;\n Foreground?: string | null;\n Background?: string | null;\n Padding?: string | null;\n Margin?: string | null;\n RenderSize?: number[] | null;\n Visibility?: 'Collapsed' | 'Visible' | null;\n CornerRadius?: string | null;\n BorderThickness?: string | null;\n Width?: number | null;\n Height?: number | null;\n BorderBrush?: string | null;\n VerticalAlignment?: string | null;\n HorizontalAlignment?: string | null;\n Clip?: string | null;\n FlowDirection?: string | null;\n Name?: string | null;\n Text?: string | null;\n children?: UIElement[];\n [index: string]: unknown;\n};\n\ndeclare global {\n const automationClient: AutomationClient | undefined;\n}\n\n/**\n * Dump a section of the native visual tree.\n */\nexport default async function dumpVisualTree(\n accessibilityId: string,\n opts?: {\n pruneCollapsed?: boolean;\n deterministicOnly?: boolean;\n additionalProperties?: string[];\n },\n): Promise<UIElement> {\n if (!automationClient) {\n throw new Error('RPC client is not enabled');\n }\n\n const dumpResponse = await automationClient.invoke('DumpVisualTree', {\n accessibilityId,\n ...opts,\n });\n\n if (dumpResponse.type === 'error') {\n throw new Error(dumpResponse.message);\n }\n\n const element = dumpResponse.result;\n\n if (opts?.pruneCollapsed !== false) {\n pruneCollapsedElements(element);\n }\n\n if (opts?.deterministicOnly !== false) {\n removeNonDeterministicProps(element);\n }\n\n return element;\n}\n\n/**\n * Removes trees of XAML that are not visible.\n */\nfunction pruneCollapsedElements(element: UIElement) {\n if (!element.children) {\n return;\n }\n\n element.children = element.children.filter(\n child => child.Visibility !== 'Collapsed',\n );\n\n element.children.forEach(pruneCollapsedElements);\n}\n\n/**\n * Removes trees of properties that are not deterministic\n */\nfunction removeNonDeterministicProps(element: UIElement) {\n if (element.RenderSize) {\n // RenderSize is subject to rounding, etc and should mostly be derived from\n // other deterministic properties in the tree.\n delete element.RenderSize;\n }\n\n if (element.children) {\n element.children.forEach(removeNonDeterministicProps);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-windows/automation-commands",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.91",
|
|
4
4
|
"description": "Allows controlling your react-native-windows application",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"watch": "rnw-scripts watch"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@react-native-windows/automation-channel": "^0.10.
|
|
21
|
+
"@react-native-windows/automation-channel": "^0.10.19",
|
|
22
22
|
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
23
23
|
"@typescript-eslint/parser": "^5.30.5"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@jest/types": "^29.2.1",
|
|
27
27
|
"@rnw-scripts/eslint-config": "1.1.16",
|
|
28
|
-
"@rnw-scripts/just-task": "2.3.
|
|
28
|
+
"@rnw-scripts/just-task": "2.3.8",
|
|
29
29
|
"@rnw-scripts/ts-config": "2.0.4",
|
|
30
30
|
"@types/jest": "^29.2.2",
|
|
31
31
|
"@types/node": "^16.0.0",
|