@tanstack/devtools-a11y 0.0.1 → 0.1.1
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/LICENSE +21 -0
- package/dist/esm/core/components/IssueCard.d.ts +10 -0
- package/dist/esm/core/components/IssueCard.js +83 -0
- package/dist/esm/core/components/IssueCard.js.map +1 -0
- package/dist/esm/core/components/IssueList.d.ts +6 -0
- package/dist/esm/core/components/IssueList.js +134 -0
- package/dist/esm/core/components/IssueList.js.map +1 -0
- package/dist/esm/core/components/Settings.d.ts +6 -0
- package/dist/esm/core/components/Settings.js +251 -0
- package/dist/esm/core/components/Settings.js.map +1 -0
- package/dist/esm/core/components/Shell.d.ts +2 -0
- package/dist/esm/core/components/Shell.js +214 -0
- package/dist/esm/core/components/Shell.js.map +1 -0
- package/dist/esm/core/components/index.d.ts +2 -0
- package/dist/esm/core/components/index.js +14 -0
- package/dist/esm/core/components/index.js.map +1 -0
- package/dist/esm/core/contexts/allyContext.d.ts +17 -0
- package/dist/esm/core/contexts/allyContext.js +66 -0
- package/dist/esm/core/contexts/allyContext.js.map +1 -0
- package/dist/esm/core/core.d.ts +19 -0
- package/dist/esm/core/core.js +8 -0
- package/dist/esm/core/core.js.map +1 -0
- package/dist/esm/core/index.d.ts +9 -0
- package/dist/esm/core/index.js +9 -0
- package/dist/esm/core/index.js.map +1 -0
- package/dist/esm/core/production.d.ts +2 -0
- package/dist/esm/core/production.js +4 -0
- package/dist/esm/core/styles/styles.d.ts +85 -0
- package/dist/esm/core/styles/styles.js +547 -0
- package/dist/esm/core/styles/styles.js.map +1 -0
- package/dist/esm/core/types/types.d.ts +141 -0
- package/dist/esm/core/utils/ally-audit.utils.d.ts +19 -0
- package/dist/esm/core/utils/ally-audit.utils.js +226 -0
- package/dist/esm/core/utils/ally-audit.utils.js.map +1 -0
- package/dist/esm/core/utils/config.utils.d.ts +17 -0
- package/dist/esm/core/utils/config.utils.js +63 -0
- package/dist/esm/core/utils/config.utils.js.map +1 -0
- package/dist/esm/core/utils/custom-audit.utils.d.ts +13 -0
- package/dist/esm/core/utils/custom-audit.utils.js +426 -0
- package/dist/esm/core/utils/custom-audit.utils.js.map +1 -0
- package/dist/esm/core/utils/export-audit.uitls.d.ts +17 -0
- package/dist/esm/core/utils/export-audit.uitls.js +83 -0
- package/dist/esm/core/utils/export-audit.uitls.js.map +1 -0
- package/dist/esm/core/utils/ui.utils.d.ts +24 -0
- package/dist/esm/core/utils/ui.utils.js +330 -0
- package/dist/esm/core/utils/ui.utils.js.map +1 -0
- package/dist/esm/react/A11yDevtools.d.ts +5 -0
- package/dist/esm/react/A11yDevtools.js +8 -0
- package/dist/esm/react/A11yDevtools.js.map +1 -0
- package/dist/esm/react/index.d.ts +8 -0
- package/dist/esm/react/index.js +11 -0
- package/dist/esm/react/index.js.map +1 -0
- package/dist/esm/react/plugin.d.ts +12 -0
- package/dist/esm/react/plugin.js +11 -0
- package/dist/esm/react/plugin.js.map +1 -0
- package/dist/esm/react/production/A11yDevtools.d.ts +5 -0
- package/dist/esm/react/production/A11yDevtools.js +8 -0
- package/dist/esm/react/production/A11yDevtools.js.map +1 -0
- package/dist/esm/react/production/plugin.d.ts +7 -0
- package/dist/esm/react/production/plugin.js +11 -0
- package/dist/esm/react/production/plugin.js.map +1 -0
- package/dist/esm/react/production.d.ts +3 -0
- package/dist/esm/react/production.js +5 -0
- package/dist/esm/solid/A11yDevtools.d.ts +5 -0
- package/dist/esm/solid/A11yDevtools.js +8 -0
- package/dist/esm/solid/A11yDevtools.js.map +1 -0
- package/dist/esm/solid/index.d.ts +8 -0
- package/dist/esm/solid/index.js +9 -0
- package/dist/esm/solid/index.js.map +1 -0
- package/dist/esm/solid/plugin.d.ts +12 -0
- package/dist/esm/solid/plugin.js +11 -0
- package/dist/esm/solid/plugin.js.map +1 -0
- package/dist/esm/solid/production/A11yDevtools.d.ts +5 -0
- package/dist/esm/solid/production/A11yDevtools.js +8 -0
- package/dist/esm/solid/production/A11yDevtools.js.map +1 -0
- package/dist/esm/solid/production/plugin.d.ts +7 -0
- package/dist/esm/solid/production/plugin.js +11 -0
- package/dist/esm/solid/production/plugin.js.map +1 -0
- package/dist/esm/solid/production.d.ts +3 -0
- package/dist/esm/solid/production.js +3 -0
- package/package.json +110 -7
- package/src/core/components/IssueCard.tsx +75 -0
- package/src/core/components/IssueList.tsx +155 -0
- package/src/core/components/Settings.tsx +221 -0
- package/src/core/components/Shell.tsx +154 -0
- package/src/core/components/index.tsx +12 -0
- package/src/core/contexts/allyContext.tsx +118 -0
- package/src/core/core.tsx +11 -0
- package/src/core/index.ts +10 -0
- package/src/core/production.ts +5 -0
- package/src/core/styles/styles.ts +556 -0
- package/src/core/types/types.ts +177 -0
- package/src/core/utils/ally-audit.utils.ts +345 -0
- package/src/core/utils/config.utils.ts +68 -0
- package/src/core/utils/custom-audit.utils.ts +643 -0
- package/src/core/utils/export-audit.uitls.ts +180 -0
- package/src/core/utils/ui.utils.ts +483 -0
- package/src/react/A11yDevtools.ts +12 -0
- package/src/react/index.ts +16 -0
- package/src/react/plugin.ts +9 -0
- package/src/react/production/A11yDevtools.ts +11 -0
- package/src/react/production/plugin.ts +9 -0
- package/src/react/production.ts +7 -0
- package/src/solid/A11yDevtools.ts +11 -0
- package/src/solid/index.ts +14 -0
- package/src/solid/plugin.ts +9 -0
- package/src/solid/production/A11yDevtools.ts +10 -0
- package/src/solid/production/plugin.ts +9 -0
- package/src/solid/production.ts +5 -0
- package/README.md +0 -45
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
//#region src/core/utils/ui.utils.ts
|
|
2
|
+
function scrollToElement(selector) {
|
|
3
|
+
try {
|
|
4
|
+
const element = document.querySelector(selector);
|
|
5
|
+
if (element) {
|
|
6
|
+
element.scrollIntoView({
|
|
7
|
+
behavior: "smooth",
|
|
8
|
+
block: "start",
|
|
9
|
+
inline: "nearest"
|
|
10
|
+
});
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
} catch (error) {
|
|
14
|
+
console.warn("[A11y Panel] Could not scroll to element:", selector, error);
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
var HIGHLIGHT_CLASS = "tsd-a11y-highlight";
|
|
19
|
+
var HIGHLIGHT_STYLE_ID = "tsd-a11y-highlight-styles";
|
|
20
|
+
var TOOLTIP_CLASS = "tsd-a11y-tooltip";
|
|
21
|
+
var activeTooltips = /* @__PURE__ */ new Map();
|
|
22
|
+
var scrollHandler = null;
|
|
23
|
+
var TOOLTIP_HEIGHT = 28;
|
|
24
|
+
/**
|
|
25
|
+
* Severity levels mapped to numeric values for comparison (higher = more severe)
|
|
26
|
+
*/
|
|
27
|
+
var SEVERITY_ORDER = {
|
|
28
|
+
critical: 4,
|
|
29
|
+
serious: 3,
|
|
30
|
+
moderate: 2,
|
|
31
|
+
minor: 1
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Selectors for devtools elements that should never be highlighted
|
|
35
|
+
*/
|
|
36
|
+
var DEVTOOLS_SELECTORS = [
|
|
37
|
+
"[data-testid=\"tanstack_devtools\"]",
|
|
38
|
+
"[data-devtools]",
|
|
39
|
+
"[data-devtools-panel]",
|
|
40
|
+
"[data-a11y-overlay]"
|
|
41
|
+
];
|
|
42
|
+
/**
|
|
43
|
+
* Check if an element is inside the devtools panel
|
|
44
|
+
*/
|
|
45
|
+
function isInsideDevtools(element) {
|
|
46
|
+
for (const selector of DEVTOOLS_SELECTORS) if (element.closest(selector)) return true;
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
var SEVERITY_LABELS = {
|
|
50
|
+
critical: "Critical",
|
|
51
|
+
serious: "Serious",
|
|
52
|
+
moderate: "Moderate",
|
|
53
|
+
minor: "Minor"
|
|
54
|
+
};
|
|
55
|
+
var RULE_SET_LABELS = {
|
|
56
|
+
wcag2a: "WCAG 2.0 A",
|
|
57
|
+
wcag2aa: "WCAG 2.0 AA",
|
|
58
|
+
wcag21aa: "WCAG 2.1 AA",
|
|
59
|
+
wcag22aa: "WCAG 2.2 AA",
|
|
60
|
+
section508: "Section 508",
|
|
61
|
+
"best-practice": "Best Practice",
|
|
62
|
+
all: "All Rules"
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Color scheme for different severity levels
|
|
66
|
+
*/
|
|
67
|
+
var SEVERITY_COLORS = {
|
|
68
|
+
critical: {
|
|
69
|
+
border: "#dc2626",
|
|
70
|
+
bg: "rgba(220, 38, 38, 0.15)",
|
|
71
|
+
text: "#dc2626"
|
|
72
|
+
},
|
|
73
|
+
serious: {
|
|
74
|
+
border: "#ea580c",
|
|
75
|
+
bg: "rgba(234, 88, 12, 0.15)",
|
|
76
|
+
text: "#ea580c"
|
|
77
|
+
},
|
|
78
|
+
moderate: {
|
|
79
|
+
border: "#ca8a04",
|
|
80
|
+
bg: "rgba(202, 138, 4, 0.15)",
|
|
81
|
+
text: "#ca8a04"
|
|
82
|
+
},
|
|
83
|
+
minor: {
|
|
84
|
+
border: "#2563eb",
|
|
85
|
+
bg: "rgba(37, 99, 235, 0.15)",
|
|
86
|
+
text: "#2563eb"
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Inject overlay styles into the document
|
|
91
|
+
*/
|
|
92
|
+
function injectStyles() {
|
|
93
|
+
if (document.getElementById(HIGHLIGHT_STYLE_ID)) return;
|
|
94
|
+
const style = document.createElement("style");
|
|
95
|
+
style.id = HIGHLIGHT_STYLE_ID;
|
|
96
|
+
style.textContent = `
|
|
97
|
+
.${HIGHLIGHT_CLASS}--critical {
|
|
98
|
+
outline: 3px solid ${SEVERITY_COLORS.critical.border} !important;
|
|
99
|
+
outline-offset: 2px !important;
|
|
100
|
+
background-color: ${SEVERITY_COLORS.critical.bg} !important;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.${HIGHLIGHT_CLASS}--serious {
|
|
104
|
+
outline: 3px solid ${SEVERITY_COLORS.serious.border} !important;
|
|
105
|
+
outline-offset: 2px !important;
|
|
106
|
+
background-color: ${SEVERITY_COLORS.serious.bg} !important;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.${HIGHLIGHT_CLASS}--moderate {
|
|
110
|
+
outline: 2px solid ${SEVERITY_COLORS.moderate.border} !important;
|
|
111
|
+
outline-offset: 2px !important;
|
|
112
|
+
background-color: ${SEVERITY_COLORS.moderate.bg} !important;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.${HIGHLIGHT_CLASS}--minor {
|
|
116
|
+
outline: 2px dashed ${SEVERITY_COLORS.minor.border} !important;
|
|
117
|
+
outline-offset: 2px !important;
|
|
118
|
+
background-color: ${SEVERITY_COLORS.minor.bg} !important;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.${TOOLTIP_CLASS} {
|
|
122
|
+
position: fixed;
|
|
123
|
+
padding: 4px 8px;
|
|
124
|
+
border-radius: 4px;
|
|
125
|
+
font-size: 11px;
|
|
126
|
+
font-weight: 600;
|
|
127
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
128
|
+
white-space: nowrap;
|
|
129
|
+
z-index: 99990;
|
|
130
|
+
pointer-events: none;
|
|
131
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
132
|
+
max-width: 90vw;
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
text-overflow: ellipsis;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.${TOOLTIP_CLASS}--critical {
|
|
138
|
+
background: ${SEVERITY_COLORS.critical.border};
|
|
139
|
+
color: white;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.${TOOLTIP_CLASS}--serious {
|
|
143
|
+
background: ${SEVERITY_COLORS.serious.border};
|
|
144
|
+
color: white;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.${TOOLTIP_CLASS}--moderate {
|
|
148
|
+
background: ${SEVERITY_COLORS.moderate.border};
|
|
149
|
+
color: white;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.${TOOLTIP_CLASS}--minor {
|
|
153
|
+
background: ${SEVERITY_COLORS.minor.border};
|
|
154
|
+
color: white;
|
|
155
|
+
}
|
|
156
|
+
`;
|
|
157
|
+
document.head.appendChild(style);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Calculate optimal tooltip position, ensuring it's always visible in viewport
|
|
161
|
+
*/
|
|
162
|
+
function calculateTooltipPosition(targetElement, tooltip) {
|
|
163
|
+
const rect = targetElement.getBoundingClientRect();
|
|
164
|
+
const tooltipHeight = TOOLTIP_HEIGHT;
|
|
165
|
+
const gap = 4;
|
|
166
|
+
const viewportPadding = 8;
|
|
167
|
+
let top = rect.top - tooltipHeight - gap;
|
|
168
|
+
let flipped = false;
|
|
169
|
+
if (top < viewportPadding) {
|
|
170
|
+
const belowTop = rect.top + gap + viewportPadding;
|
|
171
|
+
if (rect.bottom + gap + tooltipHeight < window.innerHeight) {
|
|
172
|
+
top = rect.bottom + gap;
|
|
173
|
+
flipped = true;
|
|
174
|
+
} else if (belowTop + tooltipHeight < window.innerHeight) {
|
|
175
|
+
top = belowTop;
|
|
176
|
+
flipped = true;
|
|
177
|
+
} else {
|
|
178
|
+
top = viewportPadding;
|
|
179
|
+
flipped = true;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
let left = rect.left;
|
|
183
|
+
const tooltipWidth = tooltip.offsetWidth || 150;
|
|
184
|
+
if (left + tooltipWidth > window.innerWidth) left = Math.max(viewportPadding, window.innerWidth - tooltipWidth - viewportPadding);
|
|
185
|
+
if (left < viewportPadding) left = viewportPadding;
|
|
186
|
+
return {
|
|
187
|
+
top,
|
|
188
|
+
left,
|
|
189
|
+
flipped
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Update all tooltip positions based on their target elements
|
|
194
|
+
*/
|
|
195
|
+
function updateTooltipPositions() {
|
|
196
|
+
activeTooltips.forEach((targetElement, tooltip) => {
|
|
197
|
+
const { top, left } = calculateTooltipPosition(targetElement, tooltip);
|
|
198
|
+
tooltip.style.top = `${top}px`;
|
|
199
|
+
tooltip.style.left = `${left}px`;
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Start listening for scroll events to update tooltip positions
|
|
204
|
+
*/
|
|
205
|
+
function startScrollListener() {
|
|
206
|
+
if (scrollHandler) return;
|
|
207
|
+
scrollHandler = () => {
|
|
208
|
+
requestAnimationFrame(updateTooltipPositions);
|
|
209
|
+
};
|
|
210
|
+
window.addEventListener("scroll", scrollHandler, true);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Stop listening for scroll events
|
|
214
|
+
*/
|
|
215
|
+
function stopScrollListener() {
|
|
216
|
+
if (scrollHandler) {
|
|
217
|
+
window.removeEventListener("scroll", scrollHandler, true);
|
|
218
|
+
scrollHandler = null;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Create a tooltip element for issues and position it above the target element
|
|
223
|
+
*/
|
|
224
|
+
function createTooltip(issues, targetElement) {
|
|
225
|
+
if (issues.length === 0) return null;
|
|
226
|
+
const sortedIssues = [...issues].sort((a, b) => SEVERITY_ORDER[b.impact] - SEVERITY_ORDER[a.impact]);
|
|
227
|
+
const firstIssue = sortedIssues[0];
|
|
228
|
+
if (!firstIssue) return null;
|
|
229
|
+
const mostSevere = firstIssue.impact;
|
|
230
|
+
const tooltip = document.createElement("div");
|
|
231
|
+
tooltip.className = `${TOOLTIP_CLASS} ${TOOLTIP_CLASS}--${mostSevere}`;
|
|
232
|
+
if (sortedIssues.length === 1) tooltip.textContent = `${mostSevere.toUpperCase()}: ${firstIssue.ruleId}`;
|
|
233
|
+
else {
|
|
234
|
+
const issueList = sortedIssues.map((issue) => `${issue.impact.charAt(0).toUpperCase()}: ${issue.ruleId}`).join(" | ");
|
|
235
|
+
tooltip.textContent = `${sortedIssues.length} issues: ${issueList}`;
|
|
236
|
+
}
|
|
237
|
+
tooltip.setAttribute("data-a11y-overlay", "true");
|
|
238
|
+
activeTooltips.set(tooltip, targetElement);
|
|
239
|
+
if (activeTooltips.size === 1) startScrollListener();
|
|
240
|
+
const { top, left } = calculateTooltipPosition(targetElement, tooltip);
|
|
241
|
+
tooltip.style.top = `${top}px`;
|
|
242
|
+
tooltip.style.left = `${left}px`;
|
|
243
|
+
return tooltip;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Highlight a single element with the specified severity
|
|
247
|
+
*/
|
|
248
|
+
function highlightElement(selector, impact = "serious", options = {}) {
|
|
249
|
+
const { showTooltip = true, ruleId } = options;
|
|
250
|
+
try {
|
|
251
|
+
injectStyles();
|
|
252
|
+
const elements = document.querySelectorAll(selector);
|
|
253
|
+
if (elements.length === 0) {
|
|
254
|
+
console.warn(`[A11y Overlay] No elements found for selector: ${selector}`);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
let highlightedCount = 0;
|
|
258
|
+
elements.forEach((el) => {
|
|
259
|
+
if (isInsideDevtools(el)) return;
|
|
260
|
+
el.classList.add(HIGHLIGHT_CLASS, `${HIGHLIGHT_CLASS}--${impact}`);
|
|
261
|
+
if (showTooltip && highlightedCount === 0 && ruleId) {
|
|
262
|
+
const tooltip = createTooltip([{
|
|
263
|
+
ruleId,
|
|
264
|
+
impact
|
|
265
|
+
}], el);
|
|
266
|
+
if (tooltip) document.body.appendChild(tooltip);
|
|
267
|
+
}
|
|
268
|
+
highlightedCount++;
|
|
269
|
+
});
|
|
270
|
+
if (highlightedCount > 0) console.log(`[A11y Overlay] Highlighted ${highlightedCount} element(s) with selector: ${selector}`);
|
|
271
|
+
} catch (error) {
|
|
272
|
+
console.error("[A11y Overlay] Error highlighting element:", error);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Highlight all elements with issues.
|
|
277
|
+
* Shows all issues per element in the tooltip, using the most severe for highlighting.
|
|
278
|
+
*/
|
|
279
|
+
function highlightAllIssues(issues) {
|
|
280
|
+
injectStyles();
|
|
281
|
+
clearHighlights();
|
|
282
|
+
const selectorIssues = /* @__PURE__ */ new Map();
|
|
283
|
+
for (const issue of issues) for (const node of issue.nodes) {
|
|
284
|
+
const selector = node.selector;
|
|
285
|
+
const impact = issue.impact ?? "minor";
|
|
286
|
+
const existing = selectorIssues.get(selector) || [];
|
|
287
|
+
if (!existing.some((e) => e.ruleId === issue.ruleId)) {
|
|
288
|
+
existing.push({
|
|
289
|
+
ruleId: issue.ruleId,
|
|
290
|
+
impact
|
|
291
|
+
});
|
|
292
|
+
selectorIssues.set(selector, existing);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
for (const [selector, issueList] of selectorIssues) {
|
|
296
|
+
if (issueList.length === 0) continue;
|
|
297
|
+
const mostSevereImpact = issueList.reduce((max, issue) => SEVERITY_ORDER[issue.impact] > SEVERITY_ORDER[max.impact] ? issue : max).impact;
|
|
298
|
+
try {
|
|
299
|
+
const elements = document.querySelectorAll(selector);
|
|
300
|
+
if (elements.length === 0) continue;
|
|
301
|
+
let highlightedCount = 0;
|
|
302
|
+
elements.forEach((el) => {
|
|
303
|
+
if (isInsideDevtools(el)) return;
|
|
304
|
+
el.classList.add(HIGHLIGHT_CLASS, `${HIGHLIGHT_CLASS}--${mostSevereImpact}`);
|
|
305
|
+
if (highlightedCount === 0) {
|
|
306
|
+
const tooltip = createTooltip(issueList, el);
|
|
307
|
+
if (tooltip) document.body.appendChild(tooltip);
|
|
308
|
+
}
|
|
309
|
+
highlightedCount++;
|
|
310
|
+
});
|
|
311
|
+
} catch (error) {
|
|
312
|
+
console.error("[A11y Overlay] Error highlighting element:", error);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Clear all highlights from the page
|
|
318
|
+
*/
|
|
319
|
+
function clearHighlights() {
|
|
320
|
+
document.querySelectorAll(`.${HIGHLIGHT_CLASS}`).forEach((el) => {
|
|
321
|
+
el.classList.remove(HIGHLIGHT_CLASS, `${HIGHLIGHT_CLASS}--critical`, `${HIGHLIGHT_CLASS}--serious`, `${HIGHLIGHT_CLASS}--moderate`, `${HIGHLIGHT_CLASS}--minor`);
|
|
322
|
+
});
|
|
323
|
+
document.querySelectorAll(`.${TOOLTIP_CLASS}`).forEach((el) => el.remove());
|
|
324
|
+
activeTooltips.clear();
|
|
325
|
+
stopScrollListener();
|
|
326
|
+
}
|
|
327
|
+
//#endregion
|
|
328
|
+
export { RULE_SET_LABELS, SEVERITY_LABELS, SEVERITY_ORDER, clearHighlights, highlightAllIssues, highlightElement, scrollToElement };
|
|
329
|
+
|
|
330
|
+
//# sourceMappingURL=ui.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.utils.js","names":[],"sources":["../../../../src/core/utils/ui.utils.ts"],"sourcesContent":["// types\nimport type {\n A11yIssue,\n RuleSetPreset,\n SeverityThreshold,\n} from '../types/types'\n\nexport function scrollToElement(selector: string): boolean {\n try {\n const element = document.querySelector(selector)\n if (element) {\n element.scrollIntoView({\n behavior: 'smooth',\n block: 'start',\n inline: 'nearest',\n })\n return true\n }\n } catch (error) {\n console.warn('[A11y Panel] Could not scroll to element:', selector, error)\n }\n return false\n}\n\nconst HIGHLIGHT_CLASS = 'tsd-a11y-highlight'\nconst HIGHLIGHT_STYLE_ID = 'tsd-a11y-highlight-styles'\nconst TOOLTIP_CLASS = 'tsd-a11y-tooltip'\n\n// Track active tooltips and their target elements for scroll updates\nconst activeTooltips = new Map<HTMLElement, Element>()\nlet scrollHandler: (() => void) | null = null\n\n// Tooltip height (padding + font size + some buffer)\nconst TOOLTIP_HEIGHT = 28\n\n/**\n * Severity levels mapped to numeric values for comparison (higher = more severe)\n */\nexport const SEVERITY_ORDER: Record<SeverityThreshold, number> = {\n critical: 4,\n serious: 3,\n moderate: 2,\n minor: 1,\n}\n\n/**\n * Selectors for devtools elements that should never be highlighted\n */\nconst DEVTOOLS_SELECTORS = [\n '[data-testid=\"tanstack_devtools\"]',\n '[data-devtools]',\n '[data-devtools-panel]',\n '[data-a11y-overlay]',\n]\n\n/**\n * Check if an element is inside the devtools panel\n */\nfunction isInsideDevtools(element: Element): boolean {\n for (const selector of DEVTOOLS_SELECTORS) {\n if (element.closest(selector)) {\n return true\n }\n }\n return false\n}\n\nexport const SEVERITY_LABELS: Record<SeverityThreshold, string> = {\n critical: 'Critical',\n serious: 'Serious',\n moderate: 'Moderate',\n minor: 'Minor',\n}\n\nexport const RULE_SET_LABELS: Record<RuleSetPreset, string> = {\n wcag2a: 'WCAG 2.0 A',\n wcag2aa: 'WCAG 2.0 AA',\n wcag21aa: 'WCAG 2.1 AA',\n wcag22aa: 'WCAG 2.2 AA',\n section508: 'Section 508',\n 'best-practice': 'Best Practice',\n all: 'All Rules',\n}\n\n/**\n * Color scheme for different severity levels\n */\nconst SEVERITY_COLORS: Record<\n SeverityThreshold,\n { border: string; bg: string; text: string }\n> = {\n critical: {\n border: '#dc2626',\n bg: 'rgba(220, 38, 38, 0.15)',\n text: '#dc2626',\n },\n serious: {\n border: '#ea580c',\n bg: 'rgba(234, 88, 12, 0.15)',\n text: '#ea580c',\n },\n moderate: {\n border: '#ca8a04',\n bg: 'rgba(202, 138, 4, 0.15)',\n text: '#ca8a04',\n },\n minor: { border: '#2563eb', bg: 'rgba(37, 99, 235, 0.15)', text: '#2563eb' },\n}\n\n/**\n * Inject overlay styles into the document\n */\nfunction injectStyles(): void {\n if (document.getElementById(HIGHLIGHT_STYLE_ID)) {\n return\n }\n\n const style = document.createElement('style')\n style.id = HIGHLIGHT_STYLE_ID\n // Highlights use outline which doesn't affect layout\n // Tooltips use fixed positioning to avoid layout shifts\n style.textContent = `\n .${HIGHLIGHT_CLASS}--critical {\n outline: 3px solid ${SEVERITY_COLORS.critical.border} !important;\n outline-offset: 2px !important;\n background-color: ${SEVERITY_COLORS.critical.bg} !important;\n }\n\n .${HIGHLIGHT_CLASS}--serious {\n outline: 3px solid ${SEVERITY_COLORS.serious.border} !important;\n outline-offset: 2px !important;\n background-color: ${SEVERITY_COLORS.serious.bg} !important;\n }\n\n .${HIGHLIGHT_CLASS}--moderate {\n outline: 2px solid ${SEVERITY_COLORS.moderate.border} !important;\n outline-offset: 2px !important;\n background-color: ${SEVERITY_COLORS.moderate.bg} !important;\n }\n\n .${HIGHLIGHT_CLASS}--minor {\n outline: 2px dashed ${SEVERITY_COLORS.minor.border} !important;\n outline-offset: 2px !important;\n background-color: ${SEVERITY_COLORS.minor.bg} !important;\n }\n\n .${TOOLTIP_CLASS} {\n position: fixed;\n padding: 4px 8px;\n border-radius: 4px;\n font-size: 11px;\n font-weight: 600;\n font-family: system-ui, -apple-system, sans-serif;\n white-space: nowrap;\n z-index: 99990;\n pointer-events: none;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n max-width: 90vw;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .${TOOLTIP_CLASS}--critical {\n background: ${SEVERITY_COLORS.critical.border};\n color: white;\n }\n\n .${TOOLTIP_CLASS}--serious {\n background: ${SEVERITY_COLORS.serious.border};\n color: white;\n }\n\n .${TOOLTIP_CLASS}--moderate {\n background: ${SEVERITY_COLORS.moderate.border};\n color: white;\n }\n\n .${TOOLTIP_CLASS}--minor {\n background: ${SEVERITY_COLORS.minor.border};\n color: white;\n }\n `\n document.head.appendChild(style)\n}\n\n/**\n * Calculate optimal tooltip position, ensuring it's always visible in viewport\n */\nfunction calculateTooltipPosition(\n targetElement: Element,\n tooltip: HTMLElement,\n): { top: number; left: number; flipped: boolean } {\n const rect = targetElement.getBoundingClientRect()\n const tooltipHeight = TOOLTIP_HEIGHT\n const gap = 4 // Small gap between tooltip and element\n const viewportPadding = 8 // Minimum distance from viewport edge\n\n // Default: position above the element\n let top = rect.top - tooltipHeight - gap\n let flipped = false\n\n // If tooltip would be above viewport, we need to find a visible position\n if (top < viewportPadding) {\n // Try positioning below the element's top edge (inside the element but visible)\n const belowTop = rect.top + gap + viewportPadding\n\n // If the element's bottom is within the viewport, position below the element\n if (rect.bottom + gap + tooltipHeight < window.innerHeight) {\n top = rect.bottom + gap\n flipped = true\n }\n // Otherwise, position at the top of the viewport (for large elements like <main>)\n else if (belowTop + tooltipHeight < window.innerHeight) {\n top = belowTop\n flipped = true\n }\n // Fallback: just keep it at the top of the viewport\n else {\n top = viewportPadding\n flipped = true\n }\n }\n\n // Also handle horizontal overflow - keep tooltip within viewport\n let left = rect.left\n const tooltipWidth = tooltip.offsetWidth || 150 // Estimate if not yet rendered\n if (left + tooltipWidth > window.innerWidth) {\n left = Math.max(\n viewportPadding,\n window.innerWidth - tooltipWidth - viewportPadding,\n )\n }\n if (left < viewportPadding) {\n left = viewportPadding\n }\n\n return { top, left, flipped }\n}\n\n/**\n * Update all tooltip positions based on their target elements\n */\nfunction updateTooltipPositions(): void {\n activeTooltips.forEach((targetElement, tooltip) => {\n const { top, left } = calculateTooltipPosition(targetElement, tooltip)\n tooltip.style.top = `${top}px`\n tooltip.style.left = `${left}px`\n })\n}\n\n/**\n * Start listening for scroll events to update tooltip positions\n */\nfunction startScrollListener(): void {\n if (scrollHandler) return\n\n scrollHandler = () => {\n requestAnimationFrame(updateTooltipPositions)\n }\n\n window.addEventListener('scroll', scrollHandler, true) // capture phase to catch all scrolls\n}\n\n/**\n * Stop listening for scroll events\n */\nfunction stopScrollListener(): void {\n if (scrollHandler) {\n window.removeEventListener('scroll', scrollHandler, true)\n scrollHandler = null\n }\n}\n\n/**\n * Issue info for tooltip display\n */\ninterface TooltipIssue {\n ruleId: string\n impact: SeverityThreshold\n}\n\n/**\n * Create a tooltip element for issues and position it above the target element\n */\nfunction createTooltip(\n issues: Array<TooltipIssue>,\n targetElement: Element,\n): HTMLElement | null {\n if (issues.length === 0) {\n return null\n }\n\n // Sort issues by severity (most severe first)\n const sortedIssues = [...issues].sort(\n (a, b) => SEVERITY_ORDER[b.impact] - SEVERITY_ORDER[a.impact],\n )\n\n const firstIssue = sortedIssues[0]\n if (!firstIssue) {\n return null\n }\n\n const mostSevere = firstIssue.impact\n const tooltip = document.createElement('div')\n tooltip.className = `${TOOLTIP_CLASS} ${TOOLTIP_CLASS}--${mostSevere}`\n\n // Build tooltip content showing all issues\n if (sortedIssues.length === 1) {\n tooltip.textContent = `${mostSevere.toUpperCase()}: ${firstIssue.ruleId}`\n } else {\n // Multiple issues - show count and list\n const issueList = sortedIssues\n .map(\n (issue) => `${issue.impact.charAt(0).toUpperCase()}: ${issue.ruleId}`,\n )\n .join(' | ')\n tooltip.textContent = `${sortedIssues.length} issues: ${issueList}`\n }\n\n // Mark as overlay element so it's excluded from a11y scans\n tooltip.setAttribute('data-a11y-overlay', 'true')\n\n // Track this tooltip for scroll updates (need to add before positioning)\n activeTooltips.set(tooltip, targetElement)\n\n // Start scroll listener if not already running\n if (activeTooltips.size === 1) {\n startScrollListener()\n }\n\n // Position the tooltip - will flip below element if above viewport\n const { top, left } = calculateTooltipPosition(targetElement, tooltip)\n tooltip.style.top = `${top}px`\n tooltip.style.left = `${left}px`\n\n return tooltip\n}\n\n/**\n * Highlight a single element with the specified severity\n */\nexport function highlightElement(\n selector: string,\n impact: SeverityThreshold = 'serious',\n options: { showTooltip?: boolean; ruleId?: string } = {},\n): void {\n const { showTooltip = true, ruleId } = options\n\n try {\n injectStyles()\n\n const elements = document.querySelectorAll(selector)\n if (elements.length === 0) {\n console.warn(`[A11y Overlay] No elements found for selector: ${selector}`)\n return\n }\n\n let highlightedCount = 0\n elements.forEach((el) => {\n // Skip elements inside devtools\n if (isInsideDevtools(el)) {\n return\n }\n\n el.classList.add(HIGHLIGHT_CLASS, `${HIGHLIGHT_CLASS}--${impact}`)\n\n // Add tooltip to first highlighted element only\n if (showTooltip && highlightedCount === 0 && ruleId) {\n const tooltip = createTooltip([{ ruleId, impact }], el)\n if (tooltip) {\n document.body.appendChild(tooltip)\n }\n }\n\n highlightedCount++\n })\n\n if (highlightedCount > 0) {\n console.log(\n `[A11y Overlay] Highlighted ${highlightedCount} element(s) with selector: ${selector}`,\n )\n }\n } catch (error) {\n console.error('[A11y Overlay] Error highlighting element:', error)\n }\n}\n\n/**\n * Highlight all elements with issues.\n * Shows all issues per element in the tooltip, using the most severe for highlighting.\n */\nexport function highlightAllIssues(issues: Array<A11yIssue>): void {\n injectStyles()\n clearHighlights()\n\n // Track ALL issues for each selector\n // Map: selector -> Array<{ ruleId, impact }>\n const selectorIssues = new Map<string, Array<TooltipIssue>>()\n\n // Collect all issues per selector\n for (const issue of issues) {\n for (const node of issue.nodes) {\n const selector = node.selector\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const impact = issue.impact ?? 'minor'\n\n const existing = selectorIssues.get(selector) || []\n // Avoid duplicate rule IDs for the same selector\n if (!existing.some((e) => e.ruleId === issue.ruleId)) {\n existing.push({ ruleId: issue.ruleId, impact })\n selectorIssues.set(selector, existing)\n }\n }\n }\n\n // Highlight each selector with its most severe issue, but show all in tooltip\n for (const [selector, issueList] of selectorIssues) {\n // Skip empty lists (shouldn't happen, but guards against undefined)\n if (issueList.length === 0) {\n continue\n }\n\n // Find most severe impact for highlighting\n const mostSevereImpact = issueList.reduce((max, issue) =>\n SEVERITY_ORDER[issue.impact] > SEVERITY_ORDER[max.impact] ? issue : max,\n ).impact\n\n try {\n const elements = document.querySelectorAll(selector)\n if (elements.length === 0) {\n continue\n }\n\n let highlightedCount = 0\n elements.forEach((el) => {\n // Skip elements inside devtools\n if (isInsideDevtools(el)) {\n return\n }\n\n el.classList.add(\n HIGHLIGHT_CLASS,\n `${HIGHLIGHT_CLASS}--${mostSevereImpact}`,\n )\n\n // Add tooltip to first highlighted element only, showing ALL issues\n if (highlightedCount === 0) {\n const tooltip = createTooltip(issueList, el)\n if (tooltip) {\n document.body.appendChild(tooltip)\n }\n }\n\n highlightedCount++\n })\n } catch (error) {\n console.error('[A11y Overlay] Error highlighting element:', error)\n }\n }\n}\n\n/**\n * Clear all highlights from the page\n */\nexport function clearHighlights(): void {\n // Remove highlight classes\n const highlighted = document.querySelectorAll(`.${HIGHLIGHT_CLASS}`)\n highlighted.forEach((el) => {\n el.classList.remove(\n HIGHLIGHT_CLASS,\n `${HIGHLIGHT_CLASS}--critical`,\n `${HIGHLIGHT_CLASS}--serious`,\n `${HIGHLIGHT_CLASS}--moderate`,\n `${HIGHLIGHT_CLASS}--minor`,\n )\n })\n\n // Remove tooltips and clear tracking\n const tooltips = document.querySelectorAll(`.${TOOLTIP_CLASS}`)\n tooltips.forEach((el) => el.remove())\n activeTooltips.clear()\n stopScrollListener()\n}\n"],"mappings":";AAOA,SAAgB,gBAAgB,UAA2B;AACzD,KAAI;EACF,MAAM,UAAU,SAAS,cAAc,SAAS;AAChD,MAAI,SAAS;AACX,WAAQ,eAAe;IACrB,UAAU;IACV,OAAO;IACP,QAAQ;IACT,CAAC;AACF,UAAO;;UAEF,OAAO;AACd,UAAQ,KAAK,6CAA6C,UAAU,MAAM;;AAE5E,QAAO;;AAGT,IAAM,kBAAkB;AACxB,IAAM,qBAAqB;AAC3B,IAAM,gBAAgB;AAGtB,IAAM,iCAAiB,IAAI,KAA2B;AACtD,IAAI,gBAAqC;AAGzC,IAAM,iBAAiB;;;;AAKvB,IAAa,iBAAoD;CAC/D,UAAU;CACV,SAAS;CACT,UAAU;CACV,OAAO;CACR;;;;AAKD,IAAM,qBAAqB;CACzB;CACA;CACA;CACA;CACD;;;;AAKD,SAAS,iBAAiB,SAA2B;AACnD,MAAK,MAAM,YAAY,mBACrB,KAAI,QAAQ,QAAQ,SAAS,CAC3B,QAAO;AAGX,QAAO;;AAGT,IAAa,kBAAqD;CAChE,UAAU;CACV,SAAS;CACT,UAAU;CACV,OAAO;CACR;AAED,IAAa,kBAAiD;CAC5D,QAAQ;CACR,SAAS;CACT,UAAU;CACV,UAAU;CACV,YAAY;CACZ,iBAAiB;CACjB,KAAK;CACN;;;;AAKD,IAAM,kBAGF;CACF,UAAU;EACR,QAAQ;EACR,IAAI;EACJ,MAAM;EACP;CACD,SAAS;EACP,QAAQ;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E,QAAQ,MAAM;IAAQ;IAAQ,CAAC;AAC/C,kBAAe,IAAI,UAAU,SAAS;;;AAM5C,MAAK,MAAM,CAAC,UAAU,cAAc,gBAAgB;AAElD,MAAI,UAAU,WAAW,EACvB;EAIF,MAAM,mBAAmB,UAAU,QAAQ,KAAK,UAC9C,eAAe,MAAM,UAAU,eAAe,IAAI,UAAU,QAAQ,IACrE,CAAC;AAEF,MAAI;GACF,MAAM,WAAW,SAAS,iBAAiB,SAAS;AACpD,OAAI,SAAS,WAAW,EACtB;GAGF,IAAI,mBAAmB;AACvB,YAAS,SAAS,OAAO;AAEvB,QAAI,iBAAiB,GAAG,CACtB;AAGF,OAAG,UAAU,IACX,iBACA,GAAG,gBAAgB,IAAI,mBACxB;AAGD,QAAI,qBAAqB,GAAG;KAC1B,MAAM,UAAU,cAAc,WAAW,GAAG;AAC5C,SAAI,QACF,UAAS,KAAK,YAAY,QAAQ;;AAItC;KACA;WACK,OAAO;AACd,WAAQ,MAAM,8CAA8C,MAAM;;;;;;;AAQxE,SAAgB,kBAAwB;AAElB,UAAS,iBAAiB,IAAI,kBAAkB,CACxD,SAAS,OAAO;AAC1B,KAAG,UAAU,OACX,iBACA,GAAG,gBAAgB,aACnB,GAAG,gBAAgB,YACnB,GAAG,gBAAgB,aACnB,GAAG,gBAAgB,SACpB;GACD;AAGe,UAAS,iBAAiB,IAAI,gBAAgB,CACtD,SAAS,OAAO,GAAG,QAAQ,CAAC;AACrC,gBAAe,OAAO;AACtB,qBAAoB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DevtoolsPanelProps } from '@tanstack/devtools-utils/react';
|
|
2
|
+
export interface A11yDevtoolsReactInit extends DevtoolsPanelProps {
|
|
3
|
+
}
|
|
4
|
+
declare const A11yDevtoolsPanel: (props: import('@tanstack/devtools').TanStackDevtoolsPluginProps) => import("react/jsx-runtime").JSX.Element, A11yDevtoolsPanelNoOp: (_props: import('@tanstack/devtools').TanStackDevtoolsPluginProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export { A11yDevtoolsPanel, A11yDevtoolsPanelNoOp };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { A11yDevtoolsCore } from "../core/index.js";
|
|
2
|
+
import { createReactPanel } from "@tanstack/devtools-utils/react";
|
|
3
|
+
//#region src/react/A11yDevtools.ts
|
|
4
|
+
var [A11yDevtoolsPanel, A11yDevtoolsPanelNoOp] = createReactPanel(A11yDevtoolsCore);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { A11yDevtoolsPanel, A11yDevtoolsPanelNoOp };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=A11yDevtools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A11yDevtools.js","names":[],"sources":["../../../src/react/A11yDevtools.ts"],"sourcesContent":["import { createReactPanel } from '@tanstack/devtools-utils/react'\nimport { A11yDevtoolsCore } from '../core'\n\n// type\nimport type { DevtoolsPanelProps } from '@tanstack/devtools-utils/react'\n\nexport interface A11yDevtoolsReactInit extends DevtoolsPanelProps {}\n\nconst [A11yDevtoolsPanel, A11yDevtoolsPanelNoOp] =\n createReactPanel(A11yDevtoolsCore)\n\nexport { A11yDevtoolsPanel, A11yDevtoolsPanelNoOp }\n"],"mappings":";;;AAQA,IAAM,CAAC,mBAAmB,yBACxB,iBAAiB,iBAAiB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const A11yDevtoolsPanel: (props: import('@tanstack/devtools').TanStackDevtoolsPluginProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const a11yDevtoolsPlugin: () => {
|
|
3
|
+
render: (_el: HTMLElement, props: import('@tanstack/devtools').TanStackDevtoolsPluginProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
name: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type { A11yDevtoolsReactInit } from './A11yDevtools.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { A11yDevtoolsPanel as A11yDevtoolsPanel$1, A11yDevtoolsPanelNoOp } from "./A11yDevtools.js";
|
|
4
|
+
import { a11yDevtoolsNoOpPlugin, a11yDevtoolsPlugin as a11yDevtoolsPlugin$1 } from "./plugin.js";
|
|
5
|
+
//#region src/react/index.ts
|
|
6
|
+
var A11yDevtoolsPanel = process.env.NODE_ENV !== "development" ? A11yDevtoolsPanelNoOp : A11yDevtoolsPanel$1;
|
|
7
|
+
var a11yDevtoolsPlugin = process.env.NODE_ENV !== "development" ? a11yDevtoolsNoOpPlugin : a11yDevtoolsPlugin$1;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { A11yDevtoolsPanel, a11yDevtoolsPlugin };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/react/index.ts"],"sourcesContent":["'use client'\n\nimport * as Devtools from './A11yDevtools'\nimport * as plugin from './plugin'\n\nexport const A11yDevtoolsPanel =\n process.env.NODE_ENV !== 'development'\n ? Devtools.A11yDevtoolsPanelNoOp\n : Devtools.A11yDevtoolsPanel\n\nexport const a11yDevtoolsPlugin =\n process.env.NODE_ENV !== 'development'\n ? plugin.a11yDevtoolsNoOpPlugin\n : plugin.a11yDevtoolsPlugin\n\nexport type { A11yDevtoolsReactInit } from './A11yDevtools'\n"],"mappings":";;;;;AAKA,IAAA,oBAAA,QAAA,IAAA,aAAA,gBAAA,wBAAA;AAKA,IAAA,qBAAA,QAAA,IAAA,aAAA,gBAAA,yBAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const a11yDevtoolsPlugin: () => {
|
|
2
|
+
render: (_el: HTMLElement, props: import('@tanstack/devtools').TanStackDevtoolsPluginProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
name: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
}, a11yDevtoolsNoOpPlugin: () => {
|
|
7
|
+
render: (_el: HTMLElement, _props: import('@tanstack/devtools').TanStackDevtoolsPluginProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
name: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export { a11yDevtoolsPlugin, a11yDevtoolsNoOpPlugin };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { A11yDevtoolsPanel } from "./A11yDevtools.js";
|
|
2
|
+
import { createReactPlugin } from "@tanstack/devtools-utils/react";
|
|
3
|
+
//#region src/react/plugin.ts
|
|
4
|
+
var [a11yDevtoolsPlugin, a11yDevtoolsNoOpPlugin] = createReactPlugin({
|
|
5
|
+
name: "TanStack A11y",
|
|
6
|
+
Component: A11yDevtoolsPanel
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { a11yDevtoolsNoOpPlugin, a11yDevtoolsPlugin };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","names":[],"sources":["../../../src/react/plugin.ts"],"sourcesContent":["import { createReactPlugin } from '@tanstack/devtools-utils/react'\nimport { A11yDevtoolsPanel } from './A11yDevtools'\n\nconst [a11yDevtoolsPlugin, a11yDevtoolsNoOpPlugin] = createReactPlugin({\n name: 'TanStack A11y',\n Component: A11yDevtoolsPanel,\n})\n\nexport { a11yDevtoolsPlugin, a11yDevtoolsNoOpPlugin }\n"],"mappings":";;;AAGA,IAAM,CAAC,oBAAoB,0BAA0B,kBAAkB;CACrE,MAAM;CACN,WAAW;CACZ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DevtoolsPanelProps } from '@tanstack/devtools-utils/react';
|
|
2
|
+
export interface A11yDevtoolsReactInit extends DevtoolsPanelProps {
|
|
3
|
+
}
|
|
4
|
+
declare const A11yDevtoolsPanel: (props: import('@tanstack/devtools').TanStackDevtoolsPluginProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export { A11yDevtoolsPanel };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { A11yDevtoolsCore } from "../../core/index.js";
|
|
2
|
+
import { createReactPanel } from "@tanstack/devtools-utils/react";
|
|
3
|
+
//#region src/react/production/A11yDevtools.ts
|
|
4
|
+
var [A11yDevtoolsPanel] = createReactPanel(A11yDevtoolsCore);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { A11yDevtoolsPanel };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=A11yDevtools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A11yDevtools.js","names":[],"sources":["../../../../src/react/production/A11yDevtools.ts"],"sourcesContent":["import { createReactPanel } from '@tanstack/devtools-utils/react'\nimport { A11yDevtoolsCore } from '../../core'\n\n// type\nimport type { DevtoolsPanelProps } from '@tanstack/devtools-utils/react'\n\nexport interface A11yDevtoolsReactInit extends DevtoolsPanelProps {}\n\nconst [A11yDevtoolsPanel] = createReactPanel(A11yDevtoolsCore)\n\nexport { A11yDevtoolsPanel }\n"],"mappings":";;;AAQA,IAAM,CAAC,qBAAqB,iBAAiB,iBAAiB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const a11yDevtoolsPlugin: () => {
|
|
2
|
+
render: (_el: HTMLElement, props: import('@tanstack/devtools').TanStackDevtoolsPluginProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
name: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export { a11yDevtoolsPlugin };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { A11yDevtoolsPanel } from "./A11yDevtools.js";
|
|
2
|
+
import { createReactPlugin } from "@tanstack/devtools-utils/react";
|
|
3
|
+
//#region src/react/production/plugin.ts
|
|
4
|
+
var [a11yDevtoolsPlugin] = createReactPlugin({
|
|
5
|
+
name: "TanStack A11y",
|
|
6
|
+
Component: A11yDevtoolsPanel
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { a11yDevtoolsPlugin };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","names":[],"sources":["../../../../src/react/production/plugin.ts"],"sourcesContent":["import { createReactPlugin } from '@tanstack/devtools-utils/react'\nimport { A11yDevtoolsPanel } from './A11yDevtools'\n\nconst [a11yDevtoolsPlugin] = createReactPlugin({\n name: 'TanStack A11y',\n Component: A11yDevtoolsPanel,\n})\n\nexport { a11yDevtoolsPlugin }\n"],"mappings":";;;AAGA,IAAM,CAAC,sBAAsB,kBAAkB;CAC7C,MAAM;CACN,WAAW;CACZ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DevtoolsPanelProps } from '@tanstack/devtools-utils/solid';
|
|
2
|
+
declare const A11yDevtoolsPanel: (props: DevtoolsPanelProps) => import("solid-js").JSX.Element, A11yDevtoolsPanelNoOp: (_props: DevtoolsPanelProps) => import("solid-js").JSX.Element;
|
|
3
|
+
export interface A11yDevtoolsSolidInit extends DevtoolsPanelProps {
|
|
4
|
+
}
|
|
5
|
+
export { A11yDevtoolsPanel, A11yDevtoolsPanelNoOp };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { A11yDevtoolsCore } from "../core/index.js";
|
|
2
|
+
import { createSolidPanel } from "@tanstack/devtools-utils/solid";
|
|
3
|
+
//#region src/solid/A11yDevtools.ts
|
|
4
|
+
var [A11yDevtoolsPanel, A11yDevtoolsPanelNoOp] = createSolidPanel(A11yDevtoolsCore);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { A11yDevtoolsPanel, A11yDevtoolsPanelNoOp };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=A11yDevtools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A11yDevtools.js","names":[],"sources":["../../../src/solid/A11yDevtools.ts"],"sourcesContent":["import { createSolidPanel } from '@tanstack/devtools-utils/solid'\nimport { A11yDevtoolsCore } from '../core'\n\nimport type { DevtoolsPanelProps } from '@tanstack/devtools-utils/solid'\n\nconst [A11yDevtoolsPanel, A11yDevtoolsPanelNoOp] =\n createSolidPanel(A11yDevtoolsCore)\n\nexport interface A11yDevtoolsSolidInit extends DevtoolsPanelProps {}\n\nexport { A11yDevtoolsPanel, A11yDevtoolsPanelNoOp }\n"],"mappings":";;;AAKA,IAAM,CAAC,mBAAmB,yBACxB,iBAAiB,iBAAiB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const A11yDevtools: (props: import('@tanstack/devtools-utils/solid').DevtoolsPanelProps) => import("solid-js").JSX.Element;
|
|
2
|
+
export declare const a11yDevtoolsPlugin: () => {
|
|
3
|
+
render: (_el: HTMLElement, props: import('@tanstack/devtools').TanStackDevtoolsPluginProps) => import("solid-js").JSX.Element;
|
|
4
|
+
name: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type { A11yDevtoolsSolidInit } from './A11yDevtools.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { A11yDevtoolsPanel, A11yDevtoolsPanelNoOp } from "./A11yDevtools.js";
|
|
2
|
+
import { a11yDevtoolsNoOpPlugin, a11yDevtoolsPlugin as a11yDevtoolsPlugin$1 } from "./plugin.js";
|
|
3
|
+
//#region src/solid/index.ts
|
|
4
|
+
var A11yDevtools = process.env.NODE_ENV !== "development" ? A11yDevtoolsPanelNoOp : A11yDevtoolsPanel;
|
|
5
|
+
var a11yDevtoolsPlugin = process.env.NODE_ENV !== "development" ? a11yDevtoolsNoOpPlugin : a11yDevtoolsPlugin$1;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { A11yDevtools, a11yDevtoolsPlugin };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/solid/index.ts"],"sourcesContent":["import * as Devtools from './A11yDevtools'\nimport * as plugin from './plugin'\n\nexport const A11yDevtools =\n process.env.NODE_ENV !== 'development'\n ? Devtools.A11yDevtoolsPanelNoOp\n : Devtools.A11yDevtoolsPanel\n\nexport const a11yDevtoolsPlugin =\n process.env.NODE_ENV !== 'development'\n ? plugin.a11yDevtoolsNoOpPlugin\n : plugin.a11yDevtoolsPlugin\n\nexport type { A11yDevtoolsSolidInit } from './A11yDevtools'\n"],"mappings":";;;AAGA,IAAa,eAAA,QAAA,IAAA,aACc,gBACrB,wBACA;AAEN,IAAa,qBAAA,QAAA,IAAA,aACc,gBACrB,yBACA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const a11yDevtoolsPlugin: () => {
|
|
2
|
+
render: (_el: HTMLElement, props: import('@tanstack/devtools').TanStackDevtoolsPluginProps) => import("solid-js").JSX.Element;
|
|
3
|
+
name: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
}, a11yDevtoolsNoOpPlugin: () => {
|
|
7
|
+
render: (_el: HTMLElement, _props: import('@tanstack/devtools').TanStackDevtoolsPluginProps) => import("solid-js").JSX.Element;
|
|
8
|
+
name: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export { a11yDevtoolsPlugin, a11yDevtoolsNoOpPlugin };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { A11yDevtoolsPanel } from "./A11yDevtools.js";
|
|
2
|
+
import { createSolidPlugin } from "@tanstack/devtools-utils/solid";
|
|
3
|
+
//#region src/solid/plugin.ts
|
|
4
|
+
var [a11yDevtoolsPlugin, a11yDevtoolsNoOpPlugin] = createSolidPlugin({
|
|
5
|
+
name: "TanStack A11y",
|
|
6
|
+
Component: A11yDevtoolsPanel
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { a11yDevtoolsNoOpPlugin, a11yDevtoolsPlugin };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","names":[],"sources":["../../../src/solid/plugin.ts"],"sourcesContent":["import { createSolidPlugin } from '@tanstack/devtools-utils/solid'\nimport { A11yDevtoolsPanel } from './A11yDevtools'\n\nconst [a11yDevtoolsPlugin, a11yDevtoolsNoOpPlugin] = createSolidPlugin({\n name: 'TanStack A11y',\n Component: A11yDevtoolsPanel,\n})\n\nexport { a11yDevtoolsPlugin, a11yDevtoolsNoOpPlugin }\n"],"mappings":";;;AAGA,IAAM,CAAC,oBAAoB,0BAA0B,kBAAkB;CACrE,MAAM;CACN,WAAW;CACZ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DevtoolsPanelProps } from '@tanstack/devtools-utils/solid';
|
|
2
|
+
declare const A11yDevtoolsPanel: (props: DevtoolsPanelProps) => import("solid-js").JSX.Element;
|
|
3
|
+
export interface A11yDevtoolsSolidInit extends DevtoolsPanelProps {
|
|
4
|
+
}
|
|
5
|
+
export { A11yDevtoolsPanel };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { A11yDevtoolsCore } from "../../core/index.js";
|
|
2
|
+
import { createSolidPanel } from "@tanstack/devtools-utils/solid";
|
|
3
|
+
//#region src/solid/production/A11yDevtools.ts
|
|
4
|
+
var [A11yDevtoolsPanel] = createSolidPanel(A11yDevtoolsCore);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { A11yDevtoolsPanel };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=A11yDevtools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A11yDevtools.js","names":[],"sources":["../../../../src/solid/production/A11yDevtools.ts"],"sourcesContent":["import { createSolidPanel } from '@tanstack/devtools-utils/solid'\nimport { A11yDevtoolsCore } from '../../core'\n\nimport type { DevtoolsPanelProps } from '@tanstack/devtools-utils/solid'\n\nconst [A11yDevtoolsPanel] = createSolidPanel(A11yDevtoolsCore)\n\nexport interface A11yDevtoolsSolidInit extends DevtoolsPanelProps {}\n\nexport { A11yDevtoolsPanel }\n"],"mappings":";;;AAKA,IAAM,CAAC,qBAAqB,iBAAiB,iBAAiB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { A11yDevtoolsPanel } from "./A11yDevtools.js";
|
|
2
|
+
import { createSolidPlugin } from "@tanstack/devtools-utils/solid";
|
|
3
|
+
//#region src/solid/production/plugin.ts
|
|
4
|
+
var [a11yDevtoolsPlugin] = createSolidPlugin({
|
|
5
|
+
name: "TanStack A11y",
|
|
6
|
+
Component: A11yDevtoolsPanel
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { a11yDevtoolsPlugin };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","names":[],"sources":["../../../../src/solid/production/plugin.ts"],"sourcesContent":["import { createSolidPlugin } from '@tanstack/devtools-utils/solid'\nimport { A11yDevtoolsPanel } from './A11yDevtools'\n\nconst [a11yDevtoolsPlugin] = createSolidPlugin({\n name: 'TanStack A11y',\n Component: A11yDevtoolsPanel,\n})\n\nexport { a11yDevtoolsPlugin }\n"],"mappings":";;;AAGA,IAAM,CAAC,sBAAsB,kBAAkB;CAC7C,MAAM;CACN,WAAW;CACZ,CAAC"}
|