gd-bs 6.6.19 → 6.6.20
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/build/icons/generate.js +9 -1
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.min.js +1 -1
- package/generateIcons.js +10 -2
- package/package.json +1 -1
- package/src/icons/generate.ts +10 -1
package/generateIcons.js
CHANGED
|
@@ -135,7 +135,15 @@ fs.readdir(dirIcons, function (err, files) {
|
|
|
135
135
|
stream = fs.createWriteStream("./src/icons/generate.ts");
|
|
136
136
|
stream.write([
|
|
137
137
|
'// Generates the html for an icon',
|
|
138
|
-
'export const generateIcon = (svg: string, height: number = 32, width: number = 32, className?: string) => {',
|
|
138
|
+
'export const generateIcon = (svg: string, height: number = 32, width: number = 32, className?: string, placeholders?: number) => {',
|
|
139
|
+
'\t// See if placeholders exist',
|
|
140
|
+
'\tif (placeholders > 0) {',
|
|
141
|
+
'\t\t// Parse the number of placeholders',
|
|
142
|
+
'\t\tfor (let i = 0; i < placeholders; i++) {',
|
|
143
|
+
'\t\t// Replace the placeholder',
|
|
144
|
+
'\t\tsvg = svg.replace("{" + i + "}", Date.now().toString());',
|
|
145
|
+
'\t\t}',
|
|
146
|
+
'\t}\n',
|
|
139
147
|
'\t// Get the icon element',
|
|
140
148
|
'\tlet elDiv = document.createElement("div");',
|
|
141
149
|
'\telDiv.innerHTML = svg;',
|
|
@@ -151,7 +159,7 @@ fs.readdir(dirIcons, function (err, files) {
|
|
|
151
159
|
'\t }',
|
|
152
160
|
'\t }\n',
|
|
153
161
|
'\t // Make this icon invisible to the screen reader',
|
|
154
|
-
|
|
162
|
+
'\t icon.setAttribute("aria-hidden", "true");\n',
|
|
155
163
|
'\t // Set the height/width',
|
|
156
164
|
'\t icon.setAttribute("height", (height ? height : 32).toString());',
|
|
157
165
|
'\t icon.setAttribute("width", (width ? width : 32).toString());\n',
|
package/package.json
CHANGED
package/src/icons/generate.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
// Generates the html for an icon
|
|
2
|
-
export const generateIcon = (svg: string, height: number = 32, width: number = 32, className?: string) => {
|
|
2
|
+
export const generateIcon = (svg: string, height: number = 32, width: number = 32, className?: string, placeholders?: number) => {
|
|
3
|
+
// See if placeholders exist
|
|
4
|
+
if (placeholders > 0) {
|
|
5
|
+
// Parse the number of placeholders
|
|
6
|
+
for (let i = 0; i < placeholders; i++) {
|
|
7
|
+
// Replace the placeholder
|
|
8
|
+
svg = svg.replace("{" + i + "}", Date.now().toString());
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
3
12
|
// Get the icon element
|
|
4
13
|
let elDiv = document.createElement("div");
|
|
5
14
|
elDiv.innerHTML = svg;
|