@@ -191,6 +210,10 @@ export class Violation extends BaseHTMLElement implements IV
+
);
diff --git a/src/elements/index.ts b/src/elements/index.ts
index 101bc25..58beacf 100644
--- a/src/elements/index.ts
+++ b/src/elements/index.ts
@@ -1,5 +1,6 @@
import { NodeResultLink, register as registerNodeLink } from './NodeResultLink/NodeResultLink'
import { Violation, register as registerViolation } from './Violation/Violation'
+import { HiddenViolation, register as registerHiddenViolation } from "./HiddenViolation/HiddenViolation";
import { Checkbox, register as registerCheckbox } from './Checkbox/Checkbox'
import { Results, register as registerResults } from './Results/Results'
import { MiniResults, register as registerMiniResults } from './Results/MiniResults'
@@ -13,11 +14,12 @@ import { FilterSettings, register as registerFilterSettings } from './FilterSett
import { Icon, register as registerIcon } from './Icon/Icon'
import { Overlay, register as registerOverlay } from './Overlay/Overlay'
-export { NodeResultLink, Violation, Checkbox, Results, MiniResults, Window, LibSelection, Switch, SwitchView, Settings, Accordion, FilterSettings, Icon, Overlay }
+export { NodeResultLink, Violation, HiddenViolation, Checkbox, Results, MiniResults, Window, LibSelection, Switch, SwitchView, Settings, Accordion, FilterSettings, Icon, Overlay }
export const register = () => {
registerNodeLink()
registerViolation()
+ registerHiddenViolation()
registerCheckbox()
registerResults()
registerMiniResults()
diff --git a/src/index.tsx b/src/index.tsx
index 42d5e21..98715bd 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -1,6 +1,6 @@
'use strict'
import { register, Results, Settings, Switch, SwitchView, Window, Icon, MiniResults, Overlay } from './elements'
-import { config } from './config'
+import {config, settingNames} from './config'
import { baatSymbol } from './core/BAAT'
import { baact, createRef } from '../baact/baact'
import { BAATEvent, BAATView } from './types'
@@ -30,7 +30,7 @@ const handlePlayClick = () => {
window[baatSymbol].addEventListener(BAATEvent.ChangeCore, () => {
runRef.value.disabled = !axeExists()
- if (window[baatSymbol].getSetting('autorun') && axeExists()) {
+ if (window[baatSymbol].getSetting(settingNames.autorun) && axeExists()) {
settingsRef.value.setAttribute('aria-pressed', 'false')
window[baatSymbol].view = BAATView.Main
}
diff --git a/src/styles/button.ts b/src/styles/button.ts
new file mode 100644
index 0000000..e7fbf1e
--- /dev/null
+++ b/src/styles/button.ts
@@ -0,0 +1,22 @@
+import {theme} from "../theme";
+import {css} from "../util/taggedString";
+
+export const button = css`
+ button {
+ background-color: ${theme.palette.primary};
+ color: ${theme.palette.light};
+ font-size: ${theme.semanticSizing.font.normal};
+ border: none;
+ padding: ${theme.semanticSizing.button.padding};
+ transition: background-color 0.2s ease-in-out;
+ cursor: pointer;
+ }
+
+ button:hover {
+ background-color: ${theme.palette.primaryDark};
+ }
+
+ button:active {
+ background-color: ${theme.palette.primaryLight};
+ }
+`;
\ No newline at end of file
diff --git a/src/theme.ts b/src/theme.ts
index b74367c..996a4c4 100644
--- a/src/theme.ts
+++ b/src/theme.ts
@@ -22,6 +22,8 @@ const palette = {
seriousTransparent: 'rgba(255,208,176,0.25)',
moderateTransparent: 'rgba(255,224,178,0.25)',
minorTransparent: 'rgba(255,236,179,0.25)',
+ green: '#77ad5a',
+ blue: '#5572bd',
}
const sizing = {
diff --git a/src/types.ts b/src/types.ts
index e7dff39..18c5997 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -47,4 +47,14 @@ export interface NodeResult extends axe.NodeResult {
export interface Result extends axe.Result {
nodes: NodeResult[]
-}
\ No newline at end of file
+}
+
+export type HistoryEntry = {
+ id: string
+ nodes: {
+ html: string
+ all: { id: string }[]
+ any: { id: string }[]
+ target: string[]
+ }[]
+}[]
\ No newline at end of file
diff --git a/src/util/history.ts b/src/util/history.ts
new file mode 100644
index 0000000..1ff1fa1
--- /dev/null
+++ b/src/util/history.ts
@@ -0,0 +1,50 @@
+import {HistoryEntry, Result} from "../types";
+
+export const convertViolationToHistoryEntry = (violations: Result[]): HistoryEntry => violations.map((violation) => ({
+ id: violation.id,
+ nodes: violation.nodes.map((nodeResult) => ({
+ target: nodeResult.target,
+ html: nodeResult.html,
+ all: nodeResult.all.map((allResult) => ({
+ id: allResult.id,
+
+ })),
+ any: nodeResult.any.map((anyResult) => ({
+ id: anyResult.id,
+ }))
+ }))
+}));
+
+type HistoryDiff = {
+ newEntries: string[]
+ removedEntries: string[]
+ unchangedEntries: string[]
+}
+
+export const historyEntryDiff = (oldHistory: HistoryEntry, newHistory: HistoryEntry): HistoryDiff => {
+ const newEntries: string[] = [];
+ const removedEntries: string[] = [];
+ const unchangedEntries: string[] = [];
+
+ oldHistory.forEach((historyEntry) => {
+ if (!newHistory.find((entry) => entry.id === historyEntry.id)) {
+ removedEntries.push(historyEntry.id);
+ }
+ });
+
+ newHistory.forEach((historyEntry) => {
+ if (!oldHistory.find((entry) => entry.id === historyEntry.id)) {
+ newEntries.push(historyEntry.id);
+ }
+ });
+
+ if (unchangedEntries.length === 0) {
+ unchangedEntries.push(...oldHistory.filter((entry) => newHistory.find((newEntry) => newEntry.id === entry.id)).map((entry) => entry.id));
+ }
+
+ return {
+ newEntries,
+ removedEntries,
+ unchangedEntries,
+ }
+}
\ No newline at end of file