@uuv/assistant 2.73.0 → 2.73.2

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.
Files changed (55) hide show
  1. package/dist/src/Commons.d.ts +60 -0
  2. package/dist/src/Commons.js +55 -0
  3. package/dist/src/helper/css-helper.d.ts +47 -0
  4. package/dist/src/helper/css-helper.js +83 -0
  5. package/dist/src/helper/highlight/highlight-helper.d.ts +13 -0
  6. package/dist/src/helper/highlight/highlight-helper.js +51 -0
  7. package/dist/src/helper/highlight/inspector-dom.d.ts +7 -0
  8. package/dist/src/helper/highlight/inspector-dom.js +158 -0
  9. package/dist/src/helper/highlight/tooltip-helper.d.ts +2 -0
  10. package/dist/src/helper/highlight/tooltip-helper.js +67 -0
  11. package/dist/src/helper/index.d.ts +1 -0
  12. package/dist/src/helper/index.js +17 -0
  13. package/dist/src/helper/informative-nodes-helper.d.ts +38 -0
  14. package/dist/src/helper/informative-nodes-helper.js +250 -0
  15. package/dist/src/helper/keyboard-navigation-helper.d.ts +21 -0
  16. package/dist/src/helper/keyboard-navigation-helper.js +151 -0
  17. package/dist/src/helper/layer-helper.d.ts +12 -0
  18. package/dist/src/helper/layer-helper.js +149 -0
  19. package/dist/src/helper/result-display-helper.d.ts +2 -0
  20. package/dist/src/helper/result-display-helper.js +20 -0
  21. package/dist/src/helper/result-script-helper.d.ts +1 -0
  22. package/dist/src/helper/result-script-helper.js +30 -0
  23. package/dist/src/helper/selection-helper.d.ts +26 -0
  24. package/dist/src/helper/selection-helper.js +92 -0
  25. package/dist/src/index.d.ts +3 -0
  26. package/dist/src/index.js +19 -0
  27. package/dist/src/service/abstract-component-service.d.ts +21 -0
  28. package/dist/src/service/abstract-component-service.js +107 -0
  29. package/dist/src/service/dialog-service.d.ts +22 -0
  30. package/dist/src/service/dialog-service.js +90 -0
  31. package/dist/src/service/form-completion-service.d.ts +23 -0
  32. package/dist/src/service/form-completion-service.js +72 -0
  33. package/dist/src/service/index.d.ts +4 -0
  34. package/dist/src/service/index.js +20 -0
  35. package/dist/src/service/table-and-grid-service.d.ts +17 -0
  36. package/dist/src/service/table-and-grid-service.js +87 -0
  37. package/dist/src/translator/abstract-translator.d.ts +29 -0
  38. package/dist/src/translator/abstract-translator.js +137 -0
  39. package/dist/src/translator/click-translator.d.ts +21 -0
  40. package/dist/src/translator/click-translator.js +60 -0
  41. package/dist/src/translator/expect-translator.d.ts +23 -0
  42. package/dist/src/translator/expect-translator.js +157 -0
  43. package/dist/src/translator/index.d.ts +8 -0
  44. package/dist/src/translator/index.js +24 -0
  45. package/dist/src/translator/keyboard-navigation-translator.d.ts +19 -0
  46. package/dist/src/translator/keyboard-navigation-translator.js +42 -0
  47. package/dist/src/translator/model.d.ts +38 -0
  48. package/dist/src/translator/model.js +31 -0
  49. package/dist/src/translator/textual-translator.d.ts +15 -0
  50. package/dist/src/translator/textual-translator.js +64 -0
  51. package/dist/src/translator/type-translator.d.ts +24 -0
  52. package/dist/src/translator/type-translator.js +121 -0
  53. package/dist/src/translator/within-translator.d.ts +19 -0
  54. package/dist/src/translator/within-translator.js +42 -0
  55. package/package.json +5 -4
@@ -0,0 +1,60 @@
1
+ import React from "react";
2
+ export declare const UUV_ASSISTANT_BAR_WIDTH = 60;
3
+ export type ResultSentence = {
4
+ key: React.Key;
5
+ result: string;
6
+ };
7
+ export declare class Suggestion {
8
+ accessibleAttribute: string;
9
+ accessibleValue: string;
10
+ code: string;
11
+ sentenceAfterCorrection: string[];
12
+ constructor(accessibleAttribute?: string, accessibleValue?: string, code?: string, sentenceAfterCorrection?: string[]);
13
+ }
14
+ export declare enum VisibilityEnum {
15
+ HIDE = "hide",
16
+ WITH_RESULT = "withResult",
17
+ WITHOUT_RESULT = "withoutResult",
18
+ SETTINGS = "settings"
19
+ }
20
+ export declare enum ActionEnum {
21
+ NONE = "No action",
22
+ WITHIN = "Within",
23
+ EXPECT = "Expect",
24
+ CLICK = "Click",
25
+ TYPE = "Type",
26
+ KEYBOARD_GLOBAL_NAVIGATION = "Keyboard Navigation",
27
+ FORM_COMPLETION_MOUSE = "Form Mouse Completion",
28
+ TABLE_AND_GRID_EXPECT = "Table and Grid Expect",
29
+ DIALOG_EXPECT = "Dialog Expect",
30
+ FORM_COMPLETION_KEYBOARD = "Form Keyboard Completion",
31
+ RECORD = "Record"
32
+ }
33
+ export declare enum KeyboardNavigationModeEnum {
34
+ NONE = "No navigation",
35
+ CURRENT_NAVIGATION = "currentNavigation",
36
+ EXPECTED_NAVIGATION = "expectedNavigation"
37
+ }
38
+ export declare enum AdditionalLayerEnum {
39
+ CURRENT_NAVIGATION = "keyboard-layer-current-navigation",
40
+ EXPECTED_NAVIGATION = "keyboard-layer-expected-navigation",
41
+ FORM_COMPLETION = "form-layer-completion",
42
+ DIALOG_COMPLETION = "dialog-layer-completion",
43
+ ARRAY_COMPLETION = "array-layer-completion"
44
+ }
45
+ export declare const UUV_DISABLED_CLASS = "uuv-is-disabled";
46
+ export declare const PENDING_VALUE = "pending";
47
+ export type UuvAssistantResultAIAnalysisType = {
48
+ mode: AIAnalysisModeEnum;
49
+ available_image_descriptions?: string[] | typeof PENDING_VALUE;
50
+ onDescriptionSelected?: (selectedImageDescription: string) => void;
51
+ is_decorative: boolean | typeof PENDING_VALUE;
52
+ confidence: number | typeof PENDING_VALUE;
53
+ image_description: string | typeof PENDING_VALUE;
54
+ analysis_details: string | typeof PENDING_VALUE;
55
+ duration?: number;
56
+ };
57
+ export declare enum AIAnalysisModeEnum {
58
+ UNIFIED = 0,
59
+ STEP_BY_STEP = 1
60
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AIAnalysisModeEnum = exports.PENDING_VALUE = exports.UUV_DISABLED_CLASS = exports.AdditionalLayerEnum = exports.KeyboardNavigationModeEnum = exports.ActionEnum = exports.VisibilityEnum = exports.Suggestion = exports.UUV_ASSISTANT_BAR_WIDTH = void 0;
4
+ exports.UUV_ASSISTANT_BAR_WIDTH = 60;
5
+ class Suggestion {
6
+ constructor(accessibleAttribute = "", accessibleValue = "", code = "", sentenceAfterCorrection = []) {
7
+ this.accessibleAttribute = accessibleAttribute;
8
+ this.accessibleValue = accessibleValue;
9
+ this.code = code;
10
+ this.sentenceAfterCorrection = sentenceAfterCorrection;
11
+ }
12
+ }
13
+ exports.Suggestion = Suggestion;
14
+ var VisibilityEnum;
15
+ (function (VisibilityEnum) {
16
+ VisibilityEnum["HIDE"] = "hide";
17
+ VisibilityEnum["WITH_RESULT"] = "withResult";
18
+ VisibilityEnum["WITHOUT_RESULT"] = "withoutResult";
19
+ VisibilityEnum["SETTINGS"] = "settings";
20
+ })(VisibilityEnum || (exports.VisibilityEnum = VisibilityEnum = {}));
21
+ var ActionEnum;
22
+ (function (ActionEnum) {
23
+ ActionEnum["NONE"] = "No action";
24
+ ActionEnum["WITHIN"] = "Within";
25
+ ActionEnum["EXPECT"] = "Expect";
26
+ ActionEnum["CLICK"] = "Click";
27
+ ActionEnum["TYPE"] = "Type";
28
+ ActionEnum["KEYBOARD_GLOBAL_NAVIGATION"] = "Keyboard Navigation";
29
+ ActionEnum["FORM_COMPLETION_MOUSE"] = "Form Mouse Completion";
30
+ ActionEnum["TABLE_AND_GRID_EXPECT"] = "Table and Grid Expect";
31
+ ActionEnum["DIALOG_EXPECT"] = "Dialog Expect";
32
+ ActionEnum["FORM_COMPLETION_KEYBOARD"] = "Form Keyboard Completion";
33
+ ActionEnum["RECORD"] = "Record";
34
+ })(ActionEnum || (exports.ActionEnum = ActionEnum = {}));
35
+ var KeyboardNavigationModeEnum;
36
+ (function (KeyboardNavigationModeEnum) {
37
+ KeyboardNavigationModeEnum["NONE"] = "No navigation";
38
+ KeyboardNavigationModeEnum["CURRENT_NAVIGATION"] = "currentNavigation";
39
+ KeyboardNavigationModeEnum["EXPECTED_NAVIGATION"] = "expectedNavigation";
40
+ })(KeyboardNavigationModeEnum || (exports.KeyboardNavigationModeEnum = KeyboardNavigationModeEnum = {}));
41
+ var AdditionalLayerEnum;
42
+ (function (AdditionalLayerEnum) {
43
+ AdditionalLayerEnum["CURRENT_NAVIGATION"] = "keyboard-layer-current-navigation";
44
+ AdditionalLayerEnum["EXPECTED_NAVIGATION"] = "keyboard-layer-expected-navigation";
45
+ AdditionalLayerEnum["FORM_COMPLETION"] = "form-layer-completion";
46
+ AdditionalLayerEnum["DIALOG_COMPLETION"] = "dialog-layer-completion";
47
+ AdditionalLayerEnum["ARRAY_COMPLETION"] = "array-layer-completion";
48
+ })(AdditionalLayerEnum || (exports.AdditionalLayerEnum = AdditionalLayerEnum = {}));
49
+ exports.UUV_DISABLED_CLASS = "uuv-is-disabled";
50
+ exports.PENDING_VALUE = "pending";
51
+ var AIAnalysisModeEnum;
52
+ (function (AIAnalysisModeEnum) {
53
+ AIAnalysisModeEnum[AIAnalysisModeEnum["UNIFIED"] = 0] = "UNIFIED";
54
+ AIAnalysisModeEnum[AIAnalysisModeEnum["STEP_BY_STEP"] = 1] = "STEP_BY_STEP";
55
+ })(AIAnalysisModeEnum || (exports.AIAnalysisModeEnum = AIAnalysisModeEnum = {}));
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Software Name : UUV
3
+ *
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * This software is distributed under the MIT License,
7
+ * see the "LICENSE" file for more details
8
+ *
9
+ * Authors: NJAKO MOLOM Louis Fredice & SERVICAL Stanley
10
+ * Software description: Make test writing fast, understandable by any human
11
+ * understanding English or French.
12
+ */
13
+ export interface HtmlElementProps {
14
+ color?: string;
15
+ background?: string;
16
+ url?: string;
17
+ shadow?: string;
18
+ rotate?: number;
19
+ }
20
+ export declare enum MimeTypeEnum {
21
+ IMAGE_BMP = "image/bmp",
22
+ TEXT_CSS = "text/css",
23
+ TEXT_CSV = "text/csv",
24
+ IMAGE_GIF = "image/gif",
25
+ TEXT_HTML = "text/html",
26
+ IMAGE_X_ICON = "image/x-icon",
27
+ IMAGE_JPEG = "image/jpeg",
28
+ APPLICATION_JAVASCRIPT = "application/javascript",
29
+ APPLICATION_JSON = "application/json",
30
+ IMAGE_PNG = "image/png",
31
+ APPLICATION_PDF = "application/pdf",
32
+ APPLICATION_RTF = "application/rtf",
33
+ IMAGE_SVG_XML = "image/svg+xml",
34
+ APPLICATION_TYPESCRIPT = "application/typescript",
35
+ IMAGE_WEBP = "image/webp",
36
+ FONT_WOFF = "font/woff",
37
+ FONT_WOFF2 = "font/woff2",
38
+ APPLICATION_XHTML_XML = "application/xhtml+xml",
39
+ APPLICATION_XML = "application/xml",
40
+ APPLICATION_ZIP = "application/zip"
41
+ }
42
+ export declare class CssHelper {
43
+ static buttonConfig: (isDark: boolean) => HtmlElementProps;
44
+ static expanderConfig: (isDark: boolean, isExtended: boolean) => HtmlElementProps;
45
+ static getBase64File(file: any): string;
46
+ static iconConfig: (isDark: boolean) => HtmlElementProps;
47
+ }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /**
3
+ * Software Name : UUV
4
+ *
5
+ * SPDX-License-Identifier: MIT
6
+ *
7
+ * This software is distributed under the MIT License,
8
+ * see the "LICENSE" file for more details
9
+ *
10
+ * Authors: NJAKO MOLOM Louis Fredice & SERVICAL Stanley
11
+ * Software description: Make test writing fast, understandable by any human
12
+ * understanding English or French.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.CssHelper = exports.MimeTypeEnum = void 0;
16
+ const antd_1 = require("antd");
17
+ var MimeTypeEnum;
18
+ (function (MimeTypeEnum) {
19
+ MimeTypeEnum["IMAGE_BMP"] = "image/bmp";
20
+ MimeTypeEnum["TEXT_CSS"] = "text/css";
21
+ MimeTypeEnum["TEXT_CSV"] = "text/csv";
22
+ MimeTypeEnum["IMAGE_GIF"] = "image/gif";
23
+ MimeTypeEnum["TEXT_HTML"] = "text/html";
24
+ MimeTypeEnum["IMAGE_X_ICON"] = "image/x-icon";
25
+ MimeTypeEnum["IMAGE_JPEG"] = "image/jpeg";
26
+ MimeTypeEnum["APPLICATION_JAVASCRIPT"] = "application/javascript";
27
+ MimeTypeEnum["APPLICATION_JSON"] = "application/json";
28
+ MimeTypeEnum["IMAGE_PNG"] = "image/png";
29
+ MimeTypeEnum["APPLICATION_PDF"] = "application/pdf";
30
+ MimeTypeEnum["APPLICATION_RTF"] = "application/rtf";
31
+ MimeTypeEnum["IMAGE_SVG_XML"] = "image/svg+xml";
32
+ MimeTypeEnum["APPLICATION_TYPESCRIPT"] = "application/typescript";
33
+ MimeTypeEnum["IMAGE_WEBP"] = "image/webp";
34
+ MimeTypeEnum["FONT_WOFF"] = "font/woff";
35
+ MimeTypeEnum["FONT_WOFF2"] = "font/woff2";
36
+ MimeTypeEnum["APPLICATION_XHTML_XML"] = "application/xhtml+xml";
37
+ MimeTypeEnum["APPLICATION_XML"] = "application/xml";
38
+ MimeTypeEnum["APPLICATION_ZIP"] = "application/zip";
39
+ })(MimeTypeEnum || (exports.MimeTypeEnum = MimeTypeEnum = {}));
40
+ class CssHelper {
41
+ /* eslint-disable @typescript-eslint/no-explicit-any */
42
+ static getBase64File(file) {
43
+ if (!Object.values(MimeTypeEnum).includes(file.mime)) {
44
+ antd_1.notification.error({
45
+ message: "Error",
46
+ description: `The mimetype '${file.mime}' of resource is not configured`
47
+ });
48
+ }
49
+ return `data:${file.mime};base64,${file.data}`;
50
+ }
51
+ }
52
+ exports.CssHelper = CssHelper;
53
+ CssHelper.buttonConfig = (isDark) => {
54
+ return isDark ? {
55
+ background: "#0b4c89",
56
+ color: "#FFF"
57
+ } : {
58
+ background: "#d6e4ff",
59
+ color: "#000"
60
+ };
61
+ };
62
+ CssHelper.expanderConfig = (isDark, isExtended) => {
63
+ return isDark ? {
64
+ background: "#0b4c89",
65
+ shadow: "rgba(250, 250, 250, 0.16) 0px 10px 36px 0px, rgba(250, 250, 250, 0.06) 0px 0px 0px 1px",
66
+ rotate: isExtended ? 180 : 0,
67
+ color: "white"
68
+ } : {
69
+ background: "#d6e4ff",
70
+ shadow: "rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px",
71
+ rotate: isExtended ? 180 : 0,
72
+ color: "black"
73
+ };
74
+ };
75
+ CssHelper.iconConfig = (isDark) => {
76
+ return isDark ? {
77
+ background: "rgb(31, 31, 31)",
78
+ color: "#FFF"
79
+ } : {
80
+ color: "#000",
81
+ background: "#FFF",
82
+ };
83
+ };
@@ -0,0 +1,13 @@
1
+ export declare const HIGHLIGHT_ORANGE_PROPS: {
2
+ width: number;
3
+ borderColor: string;
4
+ };
5
+ export declare class HighlightHelper {
6
+ private onSelect;
7
+ private inspector;
8
+ constructor(onSelect: (el: HTMLElement) => void);
9
+ private createInspector;
10
+ enableBasicHighlight(): void;
11
+ enableRefinedHighlight(): void;
12
+ cancel(): void;
13
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.HighlightHelper = exports.HIGHLIGHT_ORANGE_PROPS = void 0;
7
+ const inspector_dom_1 = __importDefault(require("./inspector-dom"));
8
+ const informative_nodes_helper_1 = require("../informative-nodes-helper");
9
+ exports.HIGHLIGHT_ORANGE_PROPS = {
10
+ width: 4,
11
+ borderColor: "orange"
12
+ };
13
+ class HighlightHelper {
14
+ constructor(onSelect) {
15
+ this.onSelect = onSelect;
16
+ }
17
+ createInspector(onMouseOver, onMouseOut) {
18
+ this.inspector = (0, inspector_dom_1.default)({
19
+ root: "body",
20
+ outlineStyle: "2px solid red",
21
+ onClick: (el) => {
22
+ this.onSelect(el);
23
+ this.inspector.cancel();
24
+ },
25
+ onMouseOver,
26
+ onMouseOut
27
+ });
28
+ }
29
+ enableBasicHighlight() {
30
+ this.createInspector(el => this.inspector.highlight(el), el => this.inspector.removeHighlight(el));
31
+ this.inspector.enable();
32
+ }
33
+ enableRefinedHighlight() {
34
+ const informativeNodesHelper = new informative_nodes_helper_1.InformativeNodesHelper();
35
+ const nodesWithInfo = informativeNodesHelper.getAvailableNodes();
36
+ this.createInspector(el => {
37
+ if (nodesWithInfo.includes(el)) {
38
+ this.inspector.highlight(el);
39
+ }
40
+ }, el => {
41
+ if (nodesWithInfo.includes(el)) {
42
+ this.inspector.removeHighlight(el);
43
+ }
44
+ });
45
+ this.inspector.enable();
46
+ }
47
+ cancel() {
48
+ this.inspector.cancel();
49
+ }
50
+ }
51
+ exports.HighlightHelper = HighlightHelper;
@@ -0,0 +1,7 @@
1
+ export default Inspector;
2
+ declare function Inspector(props?: {}): {
3
+ enable: (onClickCallback: any) => void;
4
+ cancel: () => void;
5
+ removeHighlight: (el: any) => void;
6
+ highlight: (el: any) => void;
7
+ };
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const dom_accessibility_api_1 = require("dom-accessibility-api");
4
+ const tooltip_helper_1 = require("./tooltip-helper");
5
+ const abstract_translator_1 = require("../../translator/abstract-translator");
6
+ const VALID_CLASSNAME = /^[_a-zA-Z\- ]*$/;
7
+ var defaultProps = {
8
+ root: "body",
9
+ outlineStyle: "5px solid rgba(204, 146, 62, 0.3)",
10
+ onClick: (el) => console.log("Element was clicked:", abstract_translator_1.Translator.getSelector(el)),
11
+ };
12
+ var Inspector = (props = {}) => {
13
+ // @ts-ignore
14
+ const { root, excluded, outlineStyle } = Object.assign(Object.assign({}, defaultProps), props);
15
+ let onClick = props.onClick || defaultProps.onClick;
16
+ let onMouseOver = props.onMouseOver;
17
+ let onMouseOut = props.onMouseOut;
18
+ let selected, excludedElements, activeOverlay;
19
+ const highlight = (el) => {
20
+ el.style.outline = outlineStyle;
21
+ el.style.outlineOffset = `-${el.style.outlineWidth}`;
22
+ if (activeOverlay) {
23
+ removeHighlightOverlay(activeOverlay);
24
+ }
25
+ activeOverlay = applyHighlightOverlay(el);
26
+ const name = (0, dom_accessibility_api_1.computeAccessibleName)(el);
27
+ const role = (0, dom_accessibility_api_1.getRole)(el);
28
+ const content = [];
29
+ let state;
30
+ if (name && role) {
31
+ content.push("✅ Good");
32
+ state = "good";
33
+ }
34
+ else if (name || role) {
35
+ content.push("⚠️ Warning");
36
+ state = "warning";
37
+ }
38
+ else {
39
+ content.push("❌ Danger");
40
+ state = "danger";
41
+ }
42
+ const selector = `<label><b>Selector: </b></label><span style="text-wrap: wrap">${abstract_translator_1.Translator.getSelector(el)}</span>`;
43
+ const tagName = `<label><b>Tag name: </b></label><span>${el.tagName.toLowerCase()}</span>`;
44
+ const type = el.type ? `<div><label><b>Type: </b></label><span>${el.type}</span></div>` : "";
45
+ content.push(`<p><div>${tagName}</div><div>${type}</div><div>${selector}</div></p>`);
46
+ content.push(`<div><div><label><b>Name: </b></label><span>${name}</span></div><div><label><b>Role: </b></label><span>${role || ""}</span></div></div>`);
47
+ (0, tooltip_helper_1.showTooltip)(el, content.join("<hr style='opacity: 0.3' />"), state);
48
+ };
49
+ const removeHighlight = (el) => {
50
+ if (el) {
51
+ el.style.outline = "none";
52
+ if (activeOverlay) {
53
+ removeHighlightOverlay(activeOverlay);
54
+ activeOverlay = null;
55
+ }
56
+ }
57
+ (0, tooltip_helper_1.removeTooltip)();
58
+ };
59
+ // @ts-ignore
60
+ const shouldBeExcluded = (ev) => {
61
+ if (excludedElements &&
62
+ excludedElements.length &&
63
+ excludedElements.some((parent) => parent === ev.target || parent.contains(ev.target))) {
64
+ return true;
65
+ }
66
+ };
67
+ let handleMouseOver = (ev) => {
68
+ if (shouldBeExcluded(ev)) {
69
+ return;
70
+ }
71
+ selected = ev.target;
72
+ onMouseOver(ev.target);
73
+ };
74
+ let handleMouseOut = (ev) => {
75
+ if (shouldBeExcluded(ev)) {
76
+ return;
77
+ }
78
+ onMouseOut(ev.target);
79
+ };
80
+ const handleClick = (ev) => {
81
+ if (shouldBeExcluded(ev)) {
82
+ return;
83
+ }
84
+ ev.preventDefault();
85
+ ev.stopPropagation();
86
+ onClick(ev.target);
87
+ return false;
88
+ };
89
+ const prepareExcluded = (rootEl) => {
90
+ if (!excluded.length) {
91
+ return [];
92
+ }
93
+ // @ts-ignore
94
+ const excludedNested = excluded.flatMap((element) => {
95
+ if (typeof element === "string" || element instanceof String) {
96
+ return Array.from(rootEl.querySelectorAll(element));
97
+ }
98
+ else if (element instanceof Element) {
99
+ return [element];
100
+ }
101
+ else if (element.length > 0 && element[0] instanceof Element) {
102
+ return Array.from(element);
103
+ }
104
+ });
105
+ return Array.from(excludedNested).flat();
106
+ };
107
+ const enable = (onClickCallback) => {
108
+ const rootEl = document.querySelector(root);
109
+ if (!rootEl) {
110
+ return;
111
+ }
112
+ if (excluded) {
113
+ excludedElements = prepareExcluded(rootEl);
114
+ }
115
+ rootEl.addEventListener("mouseover", handleMouseOver, true);
116
+ rootEl.addEventListener("mouseout", handleMouseOut, true);
117
+ rootEl.addEventListener("click", handleClick, true);
118
+ if (onClickCallback) {
119
+ onClick = onClickCallback;
120
+ }
121
+ };
122
+ const cancel = () => {
123
+ const rootEl = document.querySelector(root);
124
+ if (!rootEl) {
125
+ return;
126
+ }
127
+ rootEl.removeEventListener("mouseover", handleMouseOver, true);
128
+ rootEl.removeEventListener("mouseout", handleMouseOut, true);
129
+ rootEl.removeEventListener("click", handleClick, true);
130
+ removeHighlight(selected);
131
+ };
132
+ return {
133
+ enable,
134
+ cancel,
135
+ removeHighlight,
136
+ highlight,
137
+ };
138
+ };
139
+ function applyHighlightOverlay(target) {
140
+ const rect = target.getBoundingClientRect();
141
+ const overlay = document.createElement("div");
142
+ overlay.style.position = "absolute";
143
+ overlay.style.top = `${rect.top + window.scrollY}px`;
144
+ overlay.style.left = `${rect.left + window.scrollX}px`;
145
+ overlay.style.width = `${rect.width}px`;
146
+ overlay.style.height = `${rect.height}px`;
147
+ overlay.style.background = "rgba(255, 0, 0, 0.05)";
148
+ overlay.style.pointerEvents = "none";
149
+ overlay.style.zIndex = "9999998";
150
+ document.body.appendChild(overlay);
151
+ return overlay;
152
+ }
153
+ function removeHighlightOverlay(overlay) {
154
+ if (overlay) {
155
+ overlay.remove();
156
+ }
157
+ }
158
+ exports.default = Inspector;
@@ -0,0 +1,2 @@
1
+ export function showTooltip(el: any, content: any, state: any): void;
2
+ export function removeTooltip(): void;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.showTooltip = showTooltip;
4
+ exports.removeTooltip = removeTooltip;
5
+ let tooltipEl = null;
6
+ function showTooltip(el, content, state) {
7
+ removeTooltip();
8
+ tooltipEl = document.createElement("div");
9
+ tooltipEl.className = "tooltip-highlight";
10
+ tooltipEl.innerHTML = content;
11
+ tooltipEl.style.position = "absolute";
12
+ tooltipEl.style.border = "2px solid black";
13
+ switch (state) {
14
+ case "good":
15
+ tooltipEl.style.background = "rgba(23,62,23,0.85)";
16
+ tooltipEl.style.border = "2px solid rgb(23,62,23)";
17
+ break;
18
+ case "warning":
19
+ tooltipEl.style.background = "rgba(87,65,18,0.85)";
20
+ tooltipEl.style.border = "2px solid rgb(87,65,18)";
21
+ break;
22
+ case "danger":
23
+ tooltipEl.style.background = "rgba(78,11,11,0.85)";
24
+ tooltipEl.style.border = "2px solid rgb(78,11,11)";
25
+ break;
26
+ default:
27
+ tooltipEl.style.background = "rgba(0,0,0, 0.85)";
28
+ tooltipEl.style.border = "2px solid black";
29
+ }
30
+ tooltipEl.style.color = "#fff";
31
+ tooltipEl.style.padding = "6px 10px";
32
+ tooltipEl.style.borderRadius = "4px";
33
+ tooltipEl.style.fontSize = "14px";
34
+ tooltipEl.style.zIndex = "9999999";
35
+ tooltipEl.style.whiteSpace = "nowrap";
36
+ tooltipEl.style.boxShadow = "0 0 6px rgba(0,0,0,0.2)";
37
+ tooltipEl.style.pointerEvents = "none";
38
+ tooltipEl.style.transition = "opacity 0.2s";
39
+ tooltipEl.style.width = "300px";
40
+ tooltipEl.style.maxWidth = "300px";
41
+ document.body.appendChild(tooltipEl);
42
+ positionTooltip(el);
43
+ }
44
+ function removeTooltip() {
45
+ if (tooltipEl) {
46
+ tooltipEl.remove();
47
+ tooltipEl = null;
48
+ }
49
+ }
50
+ function positionTooltip(targetElement) {
51
+ const elRect = targetElement.getBoundingClientRect();
52
+ const tooltipRect = tooltipEl.getBoundingClientRect();
53
+ let y = elRect.top + window.scrollY - tooltipRect.height; // Above
54
+ let x = elRect.left + window.scrollX + (elRect.width - tooltipRect.width) / 2;
55
+ if (y < window.scrollY) {
56
+ y = elRect.bottom + window.scrollY;
57
+ }
58
+ if (x < 8) {
59
+ x = 8;
60
+ }
61
+ const maxLeft = window.scrollX + document.documentElement.clientWidth - tooltipRect.width;
62
+ if (x > maxLeft) {
63
+ x = maxLeft;
64
+ }
65
+ tooltipEl.style.left = `${x}px`;
66
+ tooltipEl.style.top = `${y}px`;
67
+ }
@@ -0,0 +1 @@
1
+ export * from "./result-script-helper";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./result-script-helper"), exports);
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Software Name : UUV
3
+ *
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * This software is distributed under the MIT License,
7
+ * see the "LICENSE" file for more details
8
+ *
9
+ * Authors: NJAKO MOLOM Louis Fredice & SERVICAL Stanley
10
+ * Software description: Make test writing fast, understandable by any human
11
+ * understanding English or French.
12
+ */
13
+ export declare class InformativeNodesHelper {
14
+ private readonly TAGS_WITH_NATIVE_ACCESSIBILITY_DATA;
15
+ private readonly INTERESTING_TAGS;
16
+ private readonly candidatesWithNativeAccessibleData;
17
+ private readonly candidatesWithCustomAccessibleData;
18
+ constructor();
19
+ /**
20
+ * Trouve l'élément parent le plus pertinent pour l'analyse d'accessibilité
21
+ * @param {HTMLElement} element - L'élément de départ
22
+ * @returns {HTMLElement|null} - L'élément parent pertinent ou null si non trouvé
23
+ */
24
+ findRelevantAccessibilityParent(element: any): HTMLElement | null;
25
+ extractContextForElement(element: Element): {
26
+ parentElement: HTMLElement | null;
27
+ htmlContext: string;
28
+ siblingText: string;
29
+ };
30
+ getSiblingsFragment(element: Element, maxSiblings?: number): string;
31
+ private extractInterestingChildren;
32
+ private isStructuralOnly;
33
+ private findInformativeElements;
34
+ getAvailableNodes(): Element[];
35
+ getAvailableChildren(node: HTMLElement | Element): Promise<Element[]>;
36
+ private hasInformativeAttributes;
37
+ getDialogName(node: Element): string | null;
38
+ }