aria-ease 6.3.0 → 6.4.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.
@@ -1,21 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
-
19
1
  // src/utils/test/contract/contract.json
20
2
  var contract_default = {
21
3
  menu: {
@@ -302,8 +284,6 @@ async function closeSharedBrowser() {
302
284
  }
303
285
 
304
286
  export {
305
- __export,
306
- __reExport,
307
287
  contract_default,
308
288
  ContractReporter,
309
289
  createTestPage,
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  ContractReporter,
3
- __export,
4
- __reExport,
5
3
  contract_default,
6
4
  createTestPage
7
- } from "./chunk-RDEAG4KE.js";
5
+ } from "./chunk-XLG3MIPQ.js";
6
+ import {
7
+ __export,
8
+ __reExport
9
+ } from "./chunk-I2KLQ2HA.js";
8
10
 
9
11
  // node_modules/@playwright/test/index.mjs
10
12
  var test_exports = {};
package/dist/index.cjs CHANGED
@@ -969,6 +969,120 @@ var init_contractTestRunnerPlaywright = __esm({
969
969
  }
970
970
  });
971
971
 
972
+ // src/utils/cli/badgeHelper.ts
973
+ var badgeHelper_exports = {};
974
+ __export(badgeHelper_exports, {
975
+ BADGE_CONFIGS: () => BADGE_CONFIGS,
976
+ displayAllBadges: () => displayAllBadges,
977
+ displayBadgeInfo: () => displayBadgeInfo,
978
+ getBadgeMarkdown: () => getBadgeMarkdown,
979
+ promptAddBadge: () => promptAddBadge
980
+ });
981
+ function getBadgeMarkdown(badgeType) {
982
+ const config = BADGE_CONFIGS[badgeType];
983
+ return `[![${config.label}](${config.markdownUrl})](https://github.com/aria-ease/aria-ease)`;
984
+ }
985
+ function displayBadgeInfo(badgeType) {
986
+ const markdown = getBadgeMarkdown(badgeType);
987
+ console.log(import_chalk.default.cyan("\n\u{1F3C5} Show your accessibility commitment!"));
988
+ console.log(import_chalk.default.white(" Add this badge to your README.md:\n"));
989
+ console.log(import_chalk.default.green(" " + markdown));
990
+ console.log(import_chalk.default.dim("\n This helps others discover accessibility tools and shows you care!\n"));
991
+ }
992
+ async function promptAddBadge(badgeType, cwd = process.cwd()) {
993
+ const readmePath = import_path.default.join(cwd, "README.md");
994
+ const readmeExists = await import_fs_extra.default.pathExists(readmePath);
995
+ if (!readmeExists) {
996
+ console.log(import_chalk.default.yellow(" \u2139\uFE0F No README.md found in current directory"));
997
+ return;
998
+ }
999
+ const readmeContent = await import_fs_extra.default.readFile(readmePath, "utf-8");
1000
+ const markdown = getBadgeMarkdown(badgeType);
1001
+ if (readmeContent.includes(markdown) || readmeContent.includes(BADGE_CONFIGS[badgeType].fileName)) {
1002
+ console.log(import_chalk.default.gray(" \u2713 Badge already in README.md"));
1003
+ return;
1004
+ }
1005
+ const rl = import_readline.default.createInterface({
1006
+ input: process.stdin,
1007
+ output: process.stdout
1008
+ });
1009
+ const answer = await new Promise((resolve) => {
1010
+ rl.question(import_chalk.default.cyan(" Add badge to README.md now? (y/n): "), (ans) => {
1011
+ rl.close();
1012
+ resolve(ans.toLowerCase().trim());
1013
+ });
1014
+ });
1015
+ if (answer === "y" || answer === "yes") {
1016
+ await addBadgeToReadme(readmePath, readmeContent, markdown);
1017
+ console.log(import_chalk.default.green(" \u2713 Badge added to README.md!"));
1018
+ } else {
1019
+ console.log(import_chalk.default.gray(" Skipped. You can add it manually anytime."));
1020
+ }
1021
+ }
1022
+ async function addBadgeToReadme(readmePath, content, badge) {
1023
+ const lines = content.split("\n");
1024
+ let insertIndex = 0;
1025
+ for (let i = 0; i < lines.length; i++) {
1026
+ const line = lines[i].trim();
1027
+ if (line.startsWith("[![") || line.startsWith("[!")) {
1028
+ insertIndex = i + 1;
1029
+ continue;
1030
+ }
1031
+ if (insertIndex > 0 && !line.startsWith("[![") && !line.startsWith("[!") && line.length > 0) {
1032
+ break;
1033
+ }
1034
+ if (insertIndex === 0 && line.startsWith("#")) {
1035
+ insertIndex = i + 2;
1036
+ break;
1037
+ }
1038
+ }
1039
+ if (insertIndex === 0) {
1040
+ insertIndex = 1;
1041
+ }
1042
+ lines.splice(insertIndex, 0, badge);
1043
+ await import_fs_extra.default.writeFile(readmePath, lines.join("\n"), "utf-8");
1044
+ }
1045
+ function displayAllBadges() {
1046
+ console.log(import_chalk.default.cyan("\n\u{1F4CD} Available badges:"));
1047
+ console.log(import_chalk.default.white("\n For audits:"));
1048
+ console.log(import_chalk.default.green(" " + getBadgeMarkdown("audit")));
1049
+ console.log(import_chalk.default.white("\n For component testing:"));
1050
+ console.log(import_chalk.default.green(" " + getBadgeMarkdown("component")));
1051
+ console.log(import_chalk.default.white("\n For both (verified):"));
1052
+ console.log(import_chalk.default.green(" " + getBadgeMarkdown("verified")));
1053
+ console.log("");
1054
+ }
1055
+ var import_fs_extra, import_path, import_chalk, import_readline, BADGE_CONFIGS;
1056
+ var init_badgeHelper = __esm({
1057
+ "src/utils/cli/badgeHelper.ts"() {
1058
+ "use strict";
1059
+ import_fs_extra = __toESM(require("fs-extra"), 1);
1060
+ import_path = __toESM(require("path"), 1);
1061
+ import_chalk = __toESM(require("chalk"), 1);
1062
+ import_readline = __toESM(require("readline"), 1);
1063
+ BADGE_CONFIGS = {
1064
+ audit: {
1065
+ type: "audit",
1066
+ fileName: "audited-by-aria-ease.svg",
1067
+ label: "Audited by aria-ease",
1068
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/audited-by-aria-ease.svg"
1069
+ },
1070
+ component: {
1071
+ type: "component",
1072
+ fileName: "components-tested-aria-ease.svg",
1073
+ label: "Components tested: aria-ease",
1074
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/components-tested-aria-ease.svg"
1075
+ },
1076
+ verified: {
1077
+ type: "verified",
1078
+ fileName: "verified-by-aria-ease.svg",
1079
+ label: "Verified by aria-ease",
1080
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/verified-aria-ease.svg"
1081
+ }
1082
+ };
1083
+ }
1084
+ });
1085
+
972
1086
  // index.ts
973
1087
  var index_exports = {};
974
1088
  __export(index_exports, {
@@ -1023,7 +1137,9 @@ function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allo
1023
1137
  }
1024
1138
  trigger.setAttribute("aria-controls", panel.id);
1025
1139
  trigger.setAttribute("aria-expanded", "false");
1026
- panel.setAttribute("role", "region");
1140
+ if (!allowMultipleOpen || triggers.length <= 6) {
1141
+ panel.setAttribute("role", "region");
1142
+ }
1027
1143
  panel.setAttribute("aria-labelledby", trigger.id);
1028
1144
  panel.style.display = "none";
1029
1145
  });
@@ -1160,13 +1276,7 @@ function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allo
1160
1276
  }
1161
1277
  initialize();
1162
1278
  addListeners();
1163
- return {
1164
- expandItem,
1165
- collapseItem,
1166
- toggleItem,
1167
- cleanup,
1168
- refresh
1169
- };
1279
+ return { expandItem, collapseItem, toggleItem, cleanup, refresh };
1170
1280
  }
1171
1281
 
1172
1282
  // src/utils/handleKeyPress/handleKeyPress.ts
@@ -2588,16 +2698,31 @@ if (typeof window === "undefined") {
2588
2698
  console.log(`\u{1F680} Running component accessibility tests...
2589
2699
  `);
2590
2700
  const { exec } = await import("child_process");
2701
+ const chalk2 = (await import("chalk")).default;
2591
2702
  exec(
2592
2703
  `npx vitest --run --reporter verbose`,
2593
2704
  { cwd: process.cwd() },
2594
- (error, stdout, stderr) => {
2705
+ async (error, stdout, stderr) => {
2595
2706
  if (stdout) {
2596
2707
  console.log(stdout);
2597
2708
  }
2598
2709
  if (stderr) {
2599
2710
  console.error(stderr);
2600
2711
  }
2712
+ if (!error || error.code === 0) {
2713
+ try {
2714
+ const { displayBadgeInfo: displayBadgeInfo2, promptAddBadge: promptAddBadge2 } = await Promise.resolve().then(() => (init_badgeHelper(), badgeHelper_exports));
2715
+ displayBadgeInfo2("component");
2716
+ await promptAddBadge2("component", process.cwd());
2717
+ console.log(chalk2.dim("\n" + "\u2500".repeat(60)));
2718
+ console.log(chalk2.cyan("\u{1F499} Found aria-ease helpful?"));
2719
+ console.log(chalk2.white(" \u2022 Star us on GitHub: ") + chalk2.blue.underline("https://github.com/aria-ease/aria-ease"));
2720
+ console.log(chalk2.white(" \u2022 Share feedback: ") + chalk2.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
2721
+ console.log(chalk2.dim("\u2500".repeat(60) + "\n"));
2722
+ } catch (badgeError) {
2723
+ console.error("Warning: Could not display badge prompt:", badgeError);
2724
+ }
2725
+ }
2601
2726
  if (error && error.code) {
2602
2727
  process.exit(error.code);
2603
2728
  }
package/dist/index.js CHANGED
@@ -2,7 +2,8 @@ import {
2
2
  ContractReporter,
3
3
  closeSharedBrowser,
4
4
  contract_default
5
- } from "./chunk-RDEAG4KE.js";
5
+ } from "./chunk-XLG3MIPQ.js";
6
+ import "./chunk-I2KLQ2HA.js";
6
7
 
7
8
  // src/accordion/src/makeAccordionAccessible/makeAccordionAccessible.ts
8
9
  function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allowMultipleOpen = false, callback }) {
@@ -42,7 +43,9 @@ function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allo
42
43
  }
43
44
  trigger.setAttribute("aria-controls", panel.id);
44
45
  trigger.setAttribute("aria-expanded", "false");
45
- panel.setAttribute("role", "region");
46
+ if (!allowMultipleOpen || triggers.length <= 6) {
47
+ panel.setAttribute("role", "region");
48
+ }
46
49
  panel.setAttribute("aria-labelledby", trigger.id);
47
50
  panel.style.display = "none";
48
51
  });
@@ -179,13 +182,7 @@ function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allo
179
182
  }
180
183
  initialize();
181
184
  addListeners();
182
- return {
183
- expandItem,
184
- collapseItem,
185
- toggleItem,
186
- cleanup,
187
- refresh
188
- };
185
+ return { expandItem, collapseItem, toggleItem, cleanup, refresh };
189
186
  }
190
187
 
191
188
  // src/utils/handleKeyPress/handleKeyPress.ts
@@ -1542,7 +1539,7 @@ Error: ${error instanceof Error ? error.message : String(error)}`
1542
1539
  const devServerUrl = await checkDevServer(url);
1543
1540
  if (devServerUrl) {
1544
1541
  console.log(`\u{1F3AD} Running Playwright tests on ${devServerUrl}`);
1545
- const { runContractTestsPlaywright } = await import("./contractTestRunnerPlaywright-EUXD6ZZK.js");
1542
+ const { runContractTestsPlaywright } = await import("./contractTestRunnerPlaywright-JXQUUKFO.js");
1546
1543
  contract = await runContractTestsPlaywright(componentName, devServerUrl);
1547
1544
  } else {
1548
1545
  throw new Error(
@@ -1603,16 +1600,31 @@ if (typeof window === "undefined") {
1603
1600
  console.log(`\u{1F680} Running component accessibility tests...
1604
1601
  `);
1605
1602
  const { exec } = await import("child_process");
1603
+ const chalk = (await import("chalk")).default;
1606
1604
  exec(
1607
1605
  `npx vitest --run --reporter verbose`,
1608
1606
  { cwd: process.cwd() },
1609
- (error, stdout, stderr) => {
1607
+ async (error, stdout, stderr) => {
1610
1608
  if (stdout) {
1611
1609
  console.log(stdout);
1612
1610
  }
1613
1611
  if (stderr) {
1614
1612
  console.error(stderr);
1615
1613
  }
1614
+ if (!error || error.code === 0) {
1615
+ try {
1616
+ const { displayBadgeInfo, promptAddBadge } = await import("./badgeHelper-Z2LF5OYS.js");
1617
+ displayBadgeInfo("component");
1618
+ await promptAddBadge("component", process.cwd());
1619
+ console.log(chalk.dim("\n" + "\u2500".repeat(60)));
1620
+ console.log(chalk.cyan("\u{1F499} Found aria-ease helpful?"));
1621
+ console.log(chalk.white(" \u2022 Star us on GitHub: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease"));
1622
+ console.log(chalk.white(" \u2022 Share feedback: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
1623
+ console.log(chalk.dim("\u2500".repeat(60) + "\n"));
1624
+ } catch (badgeError) {
1625
+ console.error("Warning: Could not display badge prompt:", badgeError);
1626
+ }
1627
+ }
1616
1628
  if (error && error.code) {
1617
1629
  process.exit(error.code);
1618
1630
  }
@@ -38,7 +38,9 @@ function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allo
38
38
  }
39
39
  trigger.setAttribute("aria-controls", panel.id);
40
40
  trigger.setAttribute("aria-expanded", "false");
41
- panel.setAttribute("role", "region");
41
+ if (!allowMultipleOpen || triggers.length <= 6) {
42
+ panel.setAttribute("role", "region");
43
+ }
42
44
  panel.setAttribute("aria-labelledby", trigger.id);
43
45
  panel.style.display = "none";
44
46
  });
@@ -175,13 +177,7 @@ function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allo
175
177
  }
176
178
  initialize();
177
179
  addListeners();
178
- return {
179
- expandItem,
180
- collapseItem,
181
- toggleItem,
182
- cleanup,
183
- refresh
184
- };
180
+ return { expandItem, collapseItem, toggleItem, cleanup, refresh };
185
181
  }
186
182
 
187
183
  exports.makeAccordionAccessible = makeAccordionAccessible;
@@ -36,7 +36,9 @@ function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allo
36
36
  }
37
37
  trigger.setAttribute("aria-controls", panel.id);
38
38
  trigger.setAttribute("aria-expanded", "false");
39
- panel.setAttribute("role", "region");
39
+ if (!allowMultipleOpen || triggers.length <= 6) {
40
+ panel.setAttribute("role", "region");
41
+ }
40
42
  panel.setAttribute("aria-labelledby", trigger.id);
41
43
  panel.style.display = "none";
42
44
  });
@@ -173,13 +175,7 @@ function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allo
173
175
  }
174
176
  initialize();
175
177
  addListeners();
176
- return {
177
- expandItem,
178
- collapseItem,
179
- toggleItem,
180
- cleanup,
181
- refresh
182
- };
178
+ return { expandItem, collapseItem, toggleItem, cleanup, refresh };
183
179
  }
184
180
 
185
181
  export { makeAccordionAccessible };
@@ -0,0 +1,102 @@
1
+ import fs from 'fs-extra';
2
+ import path from 'path';
3
+ import chalk from 'chalk';
4
+ import readline from 'readline';
5
+
6
+ // src/utils/cli/badgeHelper.ts
7
+ var BADGE_CONFIGS = {
8
+ audit: {
9
+ type: "audit",
10
+ fileName: "audited-by-aria-ease.svg",
11
+ label: "Audited by aria-ease",
12
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/audited-by-aria-ease.svg"
13
+ },
14
+ component: {
15
+ type: "component",
16
+ fileName: "components-tested-aria-ease.svg",
17
+ label: "Components tested: aria-ease",
18
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/components-tested-aria-ease.svg"
19
+ },
20
+ verified: {
21
+ type: "verified",
22
+ fileName: "verified-by-aria-ease.svg",
23
+ label: "Verified by aria-ease",
24
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/verified-aria-ease.svg"
25
+ }
26
+ };
27
+ function getBadgeMarkdown(badgeType) {
28
+ const config = BADGE_CONFIGS[badgeType];
29
+ return `[![${config.label}](${config.markdownUrl})](https://github.com/aria-ease/aria-ease)`;
30
+ }
31
+ function displayBadgeInfo(badgeType) {
32
+ const markdown = getBadgeMarkdown(badgeType);
33
+ console.log(chalk.cyan("\n\u{1F3C5} Show your accessibility commitment!"));
34
+ console.log(chalk.white(" Add this badge to your README.md:\n"));
35
+ console.log(chalk.green(" " + markdown));
36
+ console.log(chalk.dim("\n This helps others discover accessibility tools and shows you care!\n"));
37
+ }
38
+ async function promptAddBadge(badgeType, cwd = process.cwd()) {
39
+ const readmePath = path.join(cwd, "README.md");
40
+ const readmeExists = await fs.pathExists(readmePath);
41
+ if (!readmeExists) {
42
+ console.log(chalk.yellow(" \u2139\uFE0F No README.md found in current directory"));
43
+ return;
44
+ }
45
+ const readmeContent = await fs.readFile(readmePath, "utf-8");
46
+ const markdown = getBadgeMarkdown(badgeType);
47
+ if (readmeContent.includes(markdown) || readmeContent.includes(BADGE_CONFIGS[badgeType].fileName)) {
48
+ console.log(chalk.gray(" \u2713 Badge already in README.md"));
49
+ return;
50
+ }
51
+ const rl = readline.createInterface({
52
+ input: process.stdin,
53
+ output: process.stdout
54
+ });
55
+ const answer = await new Promise((resolve) => {
56
+ rl.question(chalk.cyan(" Add badge to README.md now? (y/n): "), (ans) => {
57
+ rl.close();
58
+ resolve(ans.toLowerCase().trim());
59
+ });
60
+ });
61
+ if (answer === "y" || answer === "yes") {
62
+ await addBadgeToReadme(readmePath, readmeContent, markdown);
63
+ console.log(chalk.green(" \u2713 Badge added to README.md!"));
64
+ } else {
65
+ console.log(chalk.gray(" Skipped. You can add it manually anytime."));
66
+ }
67
+ }
68
+ async function addBadgeToReadme(readmePath, content, badge) {
69
+ const lines = content.split("\n");
70
+ let insertIndex = 0;
71
+ for (let i = 0; i < lines.length; i++) {
72
+ const line = lines[i].trim();
73
+ if (line.startsWith("[![") || line.startsWith("[!")) {
74
+ insertIndex = i + 1;
75
+ continue;
76
+ }
77
+ if (insertIndex > 0 && !line.startsWith("[![") && !line.startsWith("[!") && line.length > 0) {
78
+ break;
79
+ }
80
+ if (insertIndex === 0 && line.startsWith("#")) {
81
+ insertIndex = i + 2;
82
+ break;
83
+ }
84
+ }
85
+ if (insertIndex === 0) {
86
+ insertIndex = 1;
87
+ }
88
+ lines.splice(insertIndex, 0, badge);
89
+ await fs.writeFile(readmePath, lines.join("\n"), "utf-8");
90
+ }
91
+ function displayAllBadges() {
92
+ console.log(chalk.cyan("\n\u{1F4CD} Available badges:"));
93
+ console.log(chalk.white("\n For audits:"));
94
+ console.log(chalk.green(" " + getBadgeMarkdown("audit")));
95
+ console.log(chalk.white("\n For component testing:"));
96
+ console.log(chalk.green(" " + getBadgeMarkdown("component")));
97
+ console.log(chalk.white("\n For both (verified):"));
98
+ console.log(chalk.green(" " + getBadgeMarkdown("verified")));
99
+ console.log("");
100
+ }
101
+
102
+ export { BADGE_CONFIGS, displayAllBadges, displayBadgeInfo, getBadgeMarkdown, promptAddBadge };
@@ -3,12 +3,20 @@
3
3
  var playwright = require('playwright');
4
4
  var test = require('@playwright/test');
5
5
  var fs = require('fs');
6
+ var fs2 = require('fs-extra');
7
+ var path = require('path');
8
+ var chalk = require('chalk');
9
+ var readline = require('readline');
6
10
  var jestAxe = require('jest-axe');
7
11
  var fs$1 = require('fs/promises');
8
12
 
9
13
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
10
14
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
15
 
16
+ var fs2__default = /*#__PURE__*/_interopDefault(fs2);
17
+ var path__default = /*#__PURE__*/_interopDefault(path);
18
+ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
19
+ var readline__default = /*#__PURE__*/_interopDefault(readline);
12
20
  var fs__default = /*#__PURE__*/_interopDefault(fs$1);
13
21
 
14
22
  var __defProp = Object.defineProperty;
@@ -935,6 +943,115 @@ var init_contractTestRunnerPlaywright = __esm({
935
943
  }
936
944
  });
937
945
 
946
+ // src/utils/cli/badgeHelper.ts
947
+ var badgeHelper_exports = {};
948
+ __export(badgeHelper_exports, {
949
+ BADGE_CONFIGS: () => BADGE_CONFIGS,
950
+ displayAllBadges: () => displayAllBadges,
951
+ displayBadgeInfo: () => displayBadgeInfo,
952
+ getBadgeMarkdown: () => getBadgeMarkdown,
953
+ promptAddBadge: () => promptAddBadge
954
+ });
955
+ function getBadgeMarkdown(badgeType) {
956
+ const config = BADGE_CONFIGS[badgeType];
957
+ return `[![${config.label}](${config.markdownUrl})](https://github.com/aria-ease/aria-ease)`;
958
+ }
959
+ function displayBadgeInfo(badgeType) {
960
+ const markdown = getBadgeMarkdown(badgeType);
961
+ console.log(chalk__default.default.cyan("\n\u{1F3C5} Show your accessibility commitment!"));
962
+ console.log(chalk__default.default.white(" Add this badge to your README.md:\n"));
963
+ console.log(chalk__default.default.green(" " + markdown));
964
+ console.log(chalk__default.default.dim("\n This helps others discover accessibility tools and shows you care!\n"));
965
+ }
966
+ async function promptAddBadge(badgeType, cwd = process.cwd()) {
967
+ const readmePath = path__default.default.join(cwd, "README.md");
968
+ const readmeExists = await fs2__default.default.pathExists(readmePath);
969
+ if (!readmeExists) {
970
+ console.log(chalk__default.default.yellow(" \u2139\uFE0F No README.md found in current directory"));
971
+ return;
972
+ }
973
+ const readmeContent = await fs2__default.default.readFile(readmePath, "utf-8");
974
+ const markdown = getBadgeMarkdown(badgeType);
975
+ if (readmeContent.includes(markdown) || readmeContent.includes(BADGE_CONFIGS[badgeType].fileName)) {
976
+ console.log(chalk__default.default.gray(" \u2713 Badge already in README.md"));
977
+ return;
978
+ }
979
+ const rl = readline__default.default.createInterface({
980
+ input: process.stdin,
981
+ output: process.stdout
982
+ });
983
+ const answer = await new Promise((resolve) => {
984
+ rl.question(chalk__default.default.cyan(" Add badge to README.md now? (y/n): "), (ans) => {
985
+ rl.close();
986
+ resolve(ans.toLowerCase().trim());
987
+ });
988
+ });
989
+ if (answer === "y" || answer === "yes") {
990
+ await addBadgeToReadme(readmePath, readmeContent, markdown);
991
+ console.log(chalk__default.default.green(" \u2713 Badge added to README.md!"));
992
+ } else {
993
+ console.log(chalk__default.default.gray(" Skipped. You can add it manually anytime."));
994
+ }
995
+ }
996
+ async function addBadgeToReadme(readmePath, content, badge) {
997
+ const lines = content.split("\n");
998
+ let insertIndex = 0;
999
+ for (let i = 0; i < lines.length; i++) {
1000
+ const line = lines[i].trim();
1001
+ if (line.startsWith("[![") || line.startsWith("[!")) {
1002
+ insertIndex = i + 1;
1003
+ continue;
1004
+ }
1005
+ if (insertIndex > 0 && !line.startsWith("[![") && !line.startsWith("[!") && line.length > 0) {
1006
+ break;
1007
+ }
1008
+ if (insertIndex === 0 && line.startsWith("#")) {
1009
+ insertIndex = i + 2;
1010
+ break;
1011
+ }
1012
+ }
1013
+ if (insertIndex === 0) {
1014
+ insertIndex = 1;
1015
+ }
1016
+ lines.splice(insertIndex, 0, badge);
1017
+ await fs2__default.default.writeFile(readmePath, lines.join("\n"), "utf-8");
1018
+ }
1019
+ function displayAllBadges() {
1020
+ console.log(chalk__default.default.cyan("\n\u{1F4CD} Available badges:"));
1021
+ console.log(chalk__default.default.white("\n For audits:"));
1022
+ console.log(chalk__default.default.green(" " + getBadgeMarkdown("audit")));
1023
+ console.log(chalk__default.default.white("\n For component testing:"));
1024
+ console.log(chalk__default.default.green(" " + getBadgeMarkdown("component")));
1025
+ console.log(chalk__default.default.white("\n For both (verified):"));
1026
+ console.log(chalk__default.default.green(" " + getBadgeMarkdown("verified")));
1027
+ console.log("");
1028
+ }
1029
+ var BADGE_CONFIGS;
1030
+ var init_badgeHelper = __esm({
1031
+ "src/utils/cli/badgeHelper.ts"() {
1032
+ BADGE_CONFIGS = {
1033
+ audit: {
1034
+ type: "audit",
1035
+ fileName: "audited-by-aria-ease.svg",
1036
+ label: "Audited by aria-ease",
1037
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/audited-by-aria-ease.svg"
1038
+ },
1039
+ component: {
1040
+ type: "component",
1041
+ fileName: "components-tested-aria-ease.svg",
1042
+ label: "Components tested: aria-ease",
1043
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/components-tested-aria-ease.svg"
1044
+ },
1045
+ verified: {
1046
+ type: "verified",
1047
+ fileName: "verified-by-aria-ease.svg",
1048
+ label: "Verified by aria-ease",
1049
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/verified-aria-ease.svg"
1050
+ }
1051
+ };
1052
+ }
1053
+ });
1054
+
938
1055
  // src/utils/test/contract/contractTestRunner.ts
939
1056
  init_contract();
940
1057
  init_ContractReporter();
@@ -1104,16 +1221,31 @@ if (typeof window === "undefined") {
1104
1221
  console.log(`\u{1F680} Running component accessibility tests...
1105
1222
  `);
1106
1223
  const { exec } = await import('child_process');
1224
+ const chalk2 = (await import('chalk')).default;
1107
1225
  exec(
1108
1226
  `npx vitest --run --reporter verbose`,
1109
1227
  { cwd: process.cwd() },
1110
- (error, stdout, stderr) => {
1228
+ async (error, stdout, stderr) => {
1111
1229
  if (stdout) {
1112
1230
  console.log(stdout);
1113
1231
  }
1114
1232
  if (stderr) {
1115
1233
  console.error(stderr);
1116
1234
  }
1235
+ if (!error || error.code === 0) {
1236
+ try {
1237
+ const { displayBadgeInfo: displayBadgeInfo2, promptAddBadge: promptAddBadge2 } = await Promise.resolve().then(() => (init_badgeHelper(), badgeHelper_exports));
1238
+ displayBadgeInfo2("component");
1239
+ await promptAddBadge2("component", process.cwd());
1240
+ console.log(chalk2.dim("\n" + "\u2500".repeat(60)));
1241
+ console.log(chalk2.cyan("\u{1F499} Found aria-ease helpful?"));
1242
+ console.log(chalk2.white(" \u2022 Star us on GitHub: ") + chalk2.blue.underline("https://github.com/aria-ease/aria-ease"));
1243
+ console.log(chalk2.white(" \u2022 Share feedback: ") + chalk2.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
1244
+ console.log(chalk2.dim("\u2500".repeat(60) + "\n"));
1245
+ } catch (badgeError) {
1246
+ console.error("Warning: Could not display badge prompt:", badgeError);
1247
+ }
1248
+ }
1117
1249
  if (error && error.code) {
1118
1250
  process.exit(error.code);
1119
1251
  }
@@ -167,16 +167,31 @@ if (typeof window === "undefined") {
167
167
  console.log(`\u{1F680} Running component accessibility tests...
168
168
  `);
169
169
  const { exec } = await import('child_process');
170
+ const chalk = (await import('chalk')).default;
170
171
  exec(
171
172
  `npx vitest --run --reporter verbose`,
172
173
  { cwd: process.cwd() },
173
- (error, stdout, stderr) => {
174
+ async (error, stdout, stderr) => {
174
175
  if (stdout) {
175
176
  console.log(stdout);
176
177
  }
177
178
  if (stderr) {
178
179
  console.error(stderr);
179
180
  }
181
+ if (!error || error.code === 0) {
182
+ try {
183
+ const { displayBadgeInfo, promptAddBadge } = await import('./badgeHelper-Y4SEXT4W.js');
184
+ displayBadgeInfo("component");
185
+ await promptAddBadge("component", process.cwd());
186
+ console.log(chalk.dim("\n" + "\u2500".repeat(60)));
187
+ console.log(chalk.cyan("\u{1F499} Found aria-ease helpful?"));
188
+ console.log(chalk.white(" \u2022 Star us on GitHub: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease"));
189
+ console.log(chalk.white(" \u2022 Share feedback: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
190
+ console.log(chalk.dim("\u2500".repeat(60) + "\n"));
191
+ } catch (badgeError) {
192
+ console.error("Warning: Could not display badge prompt:", badgeError);
193
+ }
194
+ }
180
195
  if (error && error.code) {
181
196
  process.exit(error.code);
182
197
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aria-ease",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "description": "Out-of-the-box accessibility utility package to develop production ready applications.",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",