@aurodesignsystem/auro-library 5.14.0 → 5.14.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 (45) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/bin/generateDocs.mjs +4 -210
  3. package/bin/generateDocs_index.mjs +4 -210
  4. package/dist/_chunks/chunk-2MOEVVSZ.mjs +308 -0
  5. package/dist/_chunks/chunk-H7YO7ERJ.mjs +69 -0
  6. package/dist/_chunks/chunk-JLCAYVRX.mjs +84 -0
  7. package/dist/_chunks/chunk-RKBXVLA5.mjs +5983 -0
  8. package/dist/_chunks/chunk-TDFKN2EP.mjs +38 -0
  9. package/dist/_chunks/chunk-UY4SIQT6.mjs +201 -0
  10. package/dist/_chunks/chunk-V7YBXHAI.mjs +32379 -0
  11. package/dist/bin/generateDocs.mjs +152 -0
  12. package/dist/bin/generateDocs_index.mjs +152 -0
  13. package/dist/build/generateDocs.mjs +18 -0
  14. package/dist/build/generateReadme.mjs +49 -0
  15. package/dist/build/generateWcaComponent.mjs +6657 -0
  16. package/dist/build/processors/defaultDocsProcessor.mjs +16 -0
  17. package/dist/build/processors/defaultDotGithubSync.mjs +12 -0
  18. package/dist/build/syncGithubFiles.mjs +18 -0
  19. package/dist/utils/auroTemplateFiller.mjs +8 -0
  20. package/dist/utils/sharedFileProcessorUtils.mjs +31 -0
  21. package/package.json +10 -5
  22. package/scripts/build/generateDocs.mjs +4 -24
  23. package/scripts/build/generateReadme.mjs +4 -60
  24. package/scripts/build/generateWcaComponent.mjs +4 -43
  25. package/scripts/build/postinstall.mjs +10 -10
  26. package/scripts/build/pre-commit.mjs +13 -7
  27. package/scripts/build/processors/defaultDocsProcessor.mjs +4 -83
  28. package/scripts/build/processors/defaultDotGithubSync.mjs +4 -83
  29. package/scripts/build/syncGithubFiles.mjs +4 -25
  30. package/scripts/runtime/floatingUI.mjs +2 -1
  31. package/scripts/runtime/generateUUID/generateUUID.mjs +41 -0
  32. package/scripts/runtime/generateUUID/index.mjs +1 -0
  33. package/scripts/utils/ansiColors.mjs +119 -0
  34. package/scripts/utils/auroLibraryUtils.mjs +87 -51
  35. package/scripts/utils/auroTemplateFiller.mjs +4 -178
  36. package/scripts/utils/logger.mjs +27 -16
  37. package/scripts/utils/sharedFileProcessorUtils.mjs +4 -270
  38. package/scripts/build/deprecatedProseToFieldPlugin.spec.js +0 -188
  39. package/scripts/runtime/ClickTracker/test/ClickTracker.test.js +0 -424
  40. package/scripts/runtime/FocusTrap/test/FocusTrap.test.js +0 -168
  41. package/scripts/runtime/Focusables/test/Focusables.test.js +0 -185
  42. package/scripts/runtime/dateUtilities/dateFormatter.test.js +0 -284
  43. package/scripts/runtime/dateUtilities/dateUtilities.test.js +0 -80
  44. package/scripts/runtime/floatingUI/test/floatingUI.test.js +0 -189
  45. package/scripts/runtime/floatingUI.test.js +0 -478
@@ -0,0 +1,152 @@
1
+ import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
2
+ import {
3
+ require_markdown_magic
4
+ } from "../_chunks/chunk-V7YBXHAI.mjs";
5
+ import {
6
+ __toESM
7
+ } from "../_chunks/chunk-TDFKN2EP.mjs";
8
+
9
+ // src/bin/generateDocs.mjs
10
+ var import_markdown_magic = __toESM(require_markdown_magic(), 1);
11
+ import { fileURLToPath } from "node:url";
12
+ import fs from "fs";
13
+ import https from "https";
14
+ import path from "path";
15
+ var packageRoot = fileURLToPath(new URL("../../", import.meta.url));
16
+ var readmeTemplateUrl = "https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/README.md";
17
+ var dirDocTemplates = "./docTemplates";
18
+ var readmeFilePath = dirDocTemplates + "/README.md";
19
+ function nameExtraction() {
20
+ const packageJson = fs.readFileSync("package.json", "utf8", (err, data) => {
21
+ if (err) {
22
+ console.log("ERROR: Unable to read package.json file", err);
23
+ }
24
+ });
25
+ const pName = JSON.parse(packageJson).name;
26
+ const pVersion = JSON.parse(packageJson).version;
27
+ const pdtVersion = JSON.parse(packageJson).peerDependencies["@aurodesignsystem/design-tokens"].substring(1);
28
+ const wcssVersion = JSON.parse(packageJson).peerDependencies["@aurodesignsystem/webcorestylesheets"].substring(1);
29
+ const npmStart = pName.indexOf("@");
30
+ const namespaceStart = pName.indexOf("/");
31
+ const nameStart = pName.indexOf("-");
32
+ const result = {
33
+ npm: pName.substring(npmStart, namespaceStart),
34
+ namespace: pName.substring(namespaceStart + 1, nameStart),
35
+ namespaceCap: pName.substring(namespaceStart + 1)[0].toUpperCase() + pName.substring(namespaceStart + 2, nameStart),
36
+ name: pName.substring(nameStart + 1),
37
+ nameCap: pName.substring(nameStart + 1)[0].toUpperCase() + pName.substring(nameStart + 2),
38
+ version: pVersion,
39
+ tokensVersion: pdtVersion,
40
+ wcssVersion
41
+ };
42
+ return result;
43
+ }
44
+ function formatTemplateFileContents(content, destination) {
45
+ const nameExtractionData = nameExtraction();
46
+ let result = content;
47
+ result = result.replace(/\[npm]/g, nameExtractionData.npm);
48
+ result = result.replace(/\[name](?!\()/g, nameExtractionData.name);
49
+ result = result.replace(/\[Name](?!\()/g, nameExtractionData.nameCap);
50
+ result = result.replace(/\[namespace]/g, nameExtractionData.namespace);
51
+ result = result.replace(/\[Namespace]/g, nameExtractionData.namespaceCap);
52
+ result = result.replace(/\[Version]/g, nameExtractionData.version);
53
+ result = result.replace(/\[dtVersion]/g, nameExtractionData.tokensVersion);
54
+ result = result.replace(/\[wcssVersion]/g, nameExtractionData.wcssVersion);
55
+ result = result.replace(/(\r\n|\r|\n)[\s]+(\r\n|\r|\n)/g, "\r\n\r\n");
56
+ result = result.replace(/>(\r\n|\r|\n){2,}/g, ">\r\n");
57
+ result = result.replace(/>(\r\n|\r|\n)```/g, ">\r\n\r\n```");
58
+ result = result.replace(/>(\r\n|\r|\n){2,}```(\r\n|\r|\n)/g, ">\r\n```\r\n");
59
+ result = result.replace(
60
+ /([^(\r\n|\r|\n)])(\r?\n|\r(?!\n))+#/g,
61
+ "$1\r\n\r\n#"
62
+ );
63
+ fs.writeFileSync(destination, result, { encoding: "utf8" });
64
+ }
65
+ function formatApiTableContents(content, destination) {
66
+ const nameExtractionData = nameExtraction();
67
+ const wcName = nameExtractionData.namespace + "-" + nameExtractionData.name;
68
+ let result = content;
69
+ result = result.replace(
70
+ /\r\n|\r|\n####\s`([a-zA-Z]*)`/g,
71
+ `\r
72
+ #### <a name="$1"></a>\`$1\`<a href="#" style="float: right; font-size: 1rem; font-weight: 100;">back to top</a>`
73
+ ).replace(/\r\n|\r|\n\|\s`([a-zA-Z]*)`/g, "\r\n| [$1](#$1)").replace(/\| \[\]\(#\)/g, "");
74
+ fs.writeFileSync(destination, result, { encoding: "utf8" });
75
+ fs.readFile("./demo/apiExamples.md", "utf8", (err, data) => {
76
+ formatTemplateFileContents(data, "./demo/apiExamples.md");
77
+ });
78
+ }
79
+ function processReadme() {
80
+ const callback = (updatedContent, outputConfig) => {
81
+ if (fs.existsSync("./README.md")) {
82
+ fs.readFile("./README.md", "utf8", (err, data) => {
83
+ formatTemplateFileContents(data, "./README.md");
84
+ });
85
+ } else {
86
+ console.log("ERROR: ./README.md file is missing");
87
+ }
88
+ };
89
+ const config = {
90
+ matchWord: "AURO-GENERATED-CONTENT",
91
+ outputDir: "./"
92
+ };
93
+ const markdownPath = path.join(packageRoot, "docTemplates/README.md");
94
+ (0, import_markdown_magic.default)(markdownPath, config, callback);
95
+ }
96
+ function processDemo() {
97
+ const callback = (updatedContent, outputConfig) => {
98
+ if (fs.existsSync("./demo/demo.md")) {
99
+ fs.readFile("./demo/demo.md", "utf8", (err, data) => {
100
+ formatTemplateFileContents(data, "./demo/demo.md");
101
+ });
102
+ } else {
103
+ console.log("ERROR: ./demo/demo.md file is missing");
104
+ }
105
+ };
106
+ const configDemo = {
107
+ matchWord: "AURO-GENERATED-CONTENT",
108
+ outputDir: "./demo"
109
+ };
110
+ const markdownPath = path.join(packageRoot, "docs/partials/demo.md");
111
+ (0, import_markdown_magic.default)(markdownPath, configDemo, callback);
112
+ }
113
+ function processApiExamples() {
114
+ const callback = (updatedContent, outputConfig) => {
115
+ if (fs.existsSync("./demo/apiExamples.md")) {
116
+ fs.readFile("./demo/apiExamples.md", "utf8", (err, data) => {
117
+ formatApiTableContents(data, "./demo/apiExamples.md");
118
+ });
119
+ } else {
120
+ console.log("ERROR: ./demo/apiExamples.md file is missing");
121
+ }
122
+ };
123
+ const config = {
124
+ matchWord: "AURO-GENERATED-CONTENT",
125
+ outputDir: "./demo"
126
+ };
127
+ const markdownPath = path.join(packageRoot, "docs/partials/apiExamples.md");
128
+ (0, import_markdown_magic.default)(markdownPath, config, callback);
129
+ }
130
+ function copyReadmeLocally() {
131
+ if (!fs.existsSync(dirDocTemplates)) {
132
+ fs.mkdirSync(dirDocTemplates);
133
+ }
134
+ if (!fs.existsSync(readmeFilePath)) {
135
+ fs.writeFile(readmeFilePath, "", (err) => {
136
+ if (err) {
137
+ console.log("ERROR: Unable to create README.md file.", err);
138
+ }
139
+ });
140
+ }
141
+ https.get(readmeTemplateUrl, (response) => {
142
+ const writeTemplate = response.pipe(fs.createWriteStream(readmeFilePath));
143
+ writeTemplate.on("finish", () => {
144
+ processReadme();
145
+ });
146
+ }).on("error", (err) => {
147
+ console.log("ERROR: Unable to fetch README.md file from server.", err);
148
+ });
149
+ }
150
+ copyReadmeLocally();
151
+ processApiExamples();
152
+ processDemo();
@@ -0,0 +1,152 @@
1
+ import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
2
+ import {
3
+ require_markdown_magic
4
+ } from "../_chunks/chunk-V7YBXHAI.mjs";
5
+ import {
6
+ __toESM
7
+ } from "../_chunks/chunk-TDFKN2EP.mjs";
8
+
9
+ // src/bin/generateDocs_index.mjs
10
+ var import_markdown_magic = __toESM(require_markdown_magic(), 1);
11
+ import { fileURLToPath } from "node:url";
12
+ import fs from "fs";
13
+ import https from "https";
14
+ import path from "path";
15
+ var packageRoot = fileURLToPath(new URL("../../", import.meta.url));
16
+ var readmeTemplateUrl = "https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/README.md";
17
+ var dirDocTemplates = "./docTemplates";
18
+ var readmeFilePath = dirDocTemplates + "/README.md";
19
+ function nameExtraction() {
20
+ const packageJson = fs.readFileSync("package.json", "utf8", (err, data) => {
21
+ if (err) {
22
+ console.log("ERROR: Unable to read package.json file", err);
23
+ }
24
+ });
25
+ const pName = JSON.parse(packageJson).name;
26
+ const pVersion = JSON.parse(packageJson).version;
27
+ const pdtVersion = JSON.parse(packageJson).peerDependencies["@aurodesignsystem/design-tokens"].substring(1);
28
+ const wcssVersion = JSON.parse(packageJson).peerDependencies["@aurodesignsystem/webcorestylesheets"].substring(1);
29
+ const npmStart = pName.indexOf("@");
30
+ const namespaceStart = pName.indexOf("/");
31
+ const nameStart = pName.indexOf("-");
32
+ const result = {
33
+ npm: pName.substring(npmStart, namespaceStart),
34
+ namespace: pName.substring(namespaceStart + 1, nameStart),
35
+ namespaceCap: pName.substring(namespaceStart + 1)[0].toUpperCase() + pName.substring(namespaceStart + 2, nameStart),
36
+ name: pName.substring(nameStart + 1),
37
+ nameCap: pName.substring(nameStart + 1)[0].toUpperCase() + pName.substring(nameStart + 2),
38
+ version: pVersion,
39
+ tokensVersion: pdtVersion,
40
+ wcssVersion
41
+ };
42
+ return result;
43
+ }
44
+ function formatTemplateFileContents(content, destination) {
45
+ const nameExtractionData = nameExtraction();
46
+ let result = content;
47
+ result = result.replace(/\[npm]/g, nameExtractionData.npm);
48
+ result = result.replace(/\[name](?!\()/g, nameExtractionData.name);
49
+ result = result.replace(/\[Name](?!\()/g, nameExtractionData.nameCap);
50
+ result = result.replace(/\[namespace]/g, nameExtractionData.namespace);
51
+ result = result.replace(/\[Namespace]/g, nameExtractionData.namespaceCap);
52
+ result = result.replace(/\[Version]/g, nameExtractionData.version);
53
+ result = result.replace(/\[dtVersion]/g, nameExtractionData.tokensVersion);
54
+ result = result.replace(/\[wcssVersion]/g, nameExtractionData.wcssVersion);
55
+ result = result.replace(/(\r\n|\r|\n)[\s]+(\r\n|\r|\n)/g, "\r\n\r\n");
56
+ result = result.replace(/>(\r\n|\r|\n){2,}/g, ">\r\n");
57
+ result = result.replace(/>(\r\n|\r|\n)```/g, ">\r\n\r\n```");
58
+ result = result.replace(/>(\r\n|\r|\n){2,}```(\r\n|\r|\n)/g, ">\r\n```\r\n");
59
+ result = result.replace(
60
+ /([^(\r\n|\r|\n)])(\r?\n|\r(?!\n))+#/g,
61
+ "$1\r\n\r\n#"
62
+ );
63
+ fs.writeFileSync(destination, result, { encoding: "utf8" });
64
+ }
65
+ function formatApiTableContents(content, destination) {
66
+ const nameExtractionData = nameExtraction();
67
+ const wcName = nameExtractionData.namespace + "-" + nameExtractionData.name;
68
+ let result = content;
69
+ result = result.replace(
70
+ /\r\n|\r|\n####\s`([a-zA-Z]*)`/g,
71
+ `\r
72
+ #### <a name="$1"></a>\`$1\`<a href="#" style="float: right; font-size: 1rem; font-weight: 100;">back to top</a>`
73
+ ).replace(/\r\n|\r|\n\|\s`([a-zA-Z]*)`/g, "\r\n| [$1](#$1)").replace(/\| \[\]\(#\)/g, "");
74
+ fs.writeFileSync(destination, result, { encoding: "utf8" });
75
+ fs.readFile("./demo/apiExamples.md", "utf8", (err, data) => {
76
+ formatTemplateFileContents(data, "./demo/apiExamples.md");
77
+ });
78
+ }
79
+ function processReadme() {
80
+ const callback = (updatedContent, outputConfig) => {
81
+ if (fs.existsSync("./README.md")) {
82
+ fs.readFile("./README.md", "utf8", (err, data) => {
83
+ formatTemplateFileContents(data, "./README.md");
84
+ });
85
+ } else {
86
+ console.log("ERROR: ./README.md file is missing");
87
+ }
88
+ };
89
+ const config = {
90
+ matchWord: "AURO-GENERATED-CONTENT",
91
+ outputDir: "./"
92
+ };
93
+ const markdownPath = path.join(packageRoot, "docTemplates/README.md");
94
+ (0, import_markdown_magic.default)(markdownPath, config, callback);
95
+ }
96
+ function processDemo() {
97
+ const callback = (updatedContent, outputConfig) => {
98
+ if (fs.existsSync("./demo/index.md")) {
99
+ fs.readFile("./demo/index.md", "utf8", (err, data) => {
100
+ formatTemplateFileContents(data, "./demo/index.md");
101
+ });
102
+ } else {
103
+ console.log("ERROR: ./demo/index.md file is missing");
104
+ }
105
+ };
106
+ const configDemo = {
107
+ matchWord: "AURO-GENERATED-CONTENT",
108
+ outputDir: "./demo"
109
+ };
110
+ const markdownPath = path.join(packageRoot, "docs/partials/index.md");
111
+ (0, import_markdown_magic.default)(markdownPath, configDemo, callback);
112
+ }
113
+ function processApiExamples() {
114
+ const callback = (updatedContent, outputConfig) => {
115
+ if (fs.existsSync("./demo/apiExamples.md")) {
116
+ fs.readFile("./demo/apiExamples.md", "utf8", (err, data) => {
117
+ formatApiTableContents(data, "./demo/apiExamples.md");
118
+ });
119
+ } else {
120
+ console.log("ERROR: ./demo/apiExamples.md file is missing");
121
+ }
122
+ };
123
+ const config = {
124
+ matchWord: "AURO-GENERATED-CONTENT",
125
+ outputDir: "./demo"
126
+ };
127
+ const markdownPath = path.join(packageRoot, "docs/partials/apiExamples.md");
128
+ (0, import_markdown_magic.default)(markdownPath, config, callback);
129
+ }
130
+ function copyReadmeLocally() {
131
+ if (!fs.existsSync(dirDocTemplates)) {
132
+ fs.mkdirSync(dirDocTemplates);
133
+ }
134
+ if (!fs.existsSync(readmeFilePath)) {
135
+ fs.writeFile(readmeFilePath, "", (err) => {
136
+ if (err) {
137
+ console.log("ERROR: Unable to create README.md file.", err);
138
+ }
139
+ });
140
+ }
141
+ https.get(readmeTemplateUrl, (response) => {
142
+ const writeTemplate = response.pipe(fs.createWriteStream(readmeFilePath));
143
+ writeTemplate.on("finish", () => {
144
+ processReadme();
145
+ });
146
+ }).on("error", (err) => {
147
+ console.log("ERROR: Unable to fetch README.md file from server.", err);
148
+ });
149
+ }
150
+ copyReadmeLocally();
151
+ processApiExamples();
152
+ processDemo();
@@ -0,0 +1,18 @@
1
+ import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
2
+ import {
3
+ processDocFiles
4
+ } from "../_chunks/chunk-H7YO7ERJ.mjs";
5
+ import "../_chunks/chunk-UY4SIQT6.mjs";
6
+ import "../_chunks/chunk-RKBXVLA5.mjs";
7
+ import {
8
+ Logger
9
+ } from "../_chunks/chunk-2MOEVVSZ.mjs";
10
+ import "../_chunks/chunk-V7YBXHAI.mjs";
11
+ import "../_chunks/chunk-TDFKN2EP.mjs";
12
+
13
+ // src/build/generateDocs.mjs
14
+ processDocFiles().then(() => {
15
+ Logger.log("Docs processed successfully");
16
+ }).catch((err) => {
17
+ Logger.error(`Error processing docs: ${err.message}`);
18
+ });
@@ -0,0 +1,49 @@
1
+ import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
2
+ import {
3
+ AuroLibraryUtils
4
+ } from "../_chunks/chunk-2MOEVVSZ.mjs";
5
+ import {
6
+ require_markdown_magic
7
+ } from "../_chunks/chunk-V7YBXHAI.mjs";
8
+ import {
9
+ __toESM
10
+ } from "../_chunks/chunk-TDFKN2EP.mjs";
11
+
12
+ // src/build/generateReadme.mjs
13
+ var import_markdown_magic = __toESM(require_markdown_magic(), 1);
14
+ import * as fs from "fs";
15
+ var dirDocs = "./docs";
16
+ var readmeFilePath = dirDocs + "/README.md";
17
+ var auroLibraryUtils = new AuroLibraryUtils();
18
+ function processReadme() {
19
+ const callback = () => {
20
+ if (fs.existsSync("./README.md")) {
21
+ fs.readFile("./README.md", "utf8", (err, data) => {
22
+ auroLibraryUtils.formatFileContents(data, "./README.md");
23
+ });
24
+ } else {
25
+ console.log("ERROR: ./README.md file is missing");
26
+ }
27
+ };
28
+ const config = {
29
+ matchWord: "AURO-GENERATED-CONTENT",
30
+ outputDir: "./"
31
+ };
32
+ const markdownPath = "./docs/README.md";
33
+ (0, import_markdown_magic.default)(markdownPath, config, callback);
34
+ fs.copyFileSync(readmeFilePath, "./README.md");
35
+ }
36
+ function copyReadmeLocally() {
37
+ if (!fs.existsSync(dirDocs)) {
38
+ fs.mkdirSync(dirDocs);
39
+ }
40
+ if (!fs.existsSync(readmeFilePath)) {
41
+ fs.writeFile(readmeFilePath, "", (err) => {
42
+ if (err) {
43
+ console.log("ERROR: Unable to create README.md file.", err);
44
+ }
45
+ });
46
+ }
47
+ processReadme();
48
+ }
49
+ copyReadmeLocally();