@spectrum-web-components/icons-workflow 0.33.2 → 0.33.3-overlay.61
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/bin/build.js +214 -215
- package/package.json +6 -6
- package/src/icons.d.ts +35 -35
- package/src/icons.js +1 -1
- package/src/icons.js.map +2 -2
- package/stories/icon-manifest.js +70 -70
- package/stories/icon-manifest.js.map +2 -2
package/bin/build.js
CHANGED
|
@@ -11,7 +11,7 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import fs from 'fs';
|
|
14
|
-
import glob from 'glob';
|
|
14
|
+
import { glob } from 'glob';
|
|
15
15
|
import path from 'path';
|
|
16
16
|
import { load } from 'cheerio';
|
|
17
17
|
import prettier from 'prettier';
|
|
@@ -38,248 +38,247 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
38
38
|
governing permissions and limitations under the License.
|
|
39
39
|
*/`;
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
const icons = (
|
|
42
|
+
await glob(`${rootDir}/node_modules/${iconsPath}/**.svg`)
|
|
43
|
+
).sort();
|
|
44
|
+
|
|
45
|
+
if (!fs.existsSync(`${rootDir}packages/icons-workflow/src`)) {
|
|
46
|
+
fs.mkdirSync(`${rootDir}packages/icons-workflow/src`);
|
|
47
|
+
}
|
|
48
|
+
if (!fs.existsSync(`${rootDir}packages/icons-workflow/src/icons`)) {
|
|
49
|
+
fs.mkdirSync(`${rootDir}packages/icons-workflow/src/icons`);
|
|
50
|
+
}
|
|
51
|
+
if (!fs.existsSync(`${rootDir}packages/icons-workflow/src/elements`)) {
|
|
52
|
+
fs.mkdirSync(`${rootDir}packages/icons-workflow/src/elements`);
|
|
53
|
+
}
|
|
54
|
+
if (!fs.existsSync(`${rootDir}packages/icons-workflow/icons`)) {
|
|
55
|
+
fs.mkdirSync(`${rootDir}packages/icons-workflow/icons`);
|
|
56
|
+
}
|
|
57
|
+
fs.writeFileSync(
|
|
58
|
+
path.join(rootDir, 'packages', 'icons-workflow', 'src', 'icons.ts'),
|
|
59
|
+
disclaimer,
|
|
60
|
+
'utf-8'
|
|
61
|
+
);
|
|
62
|
+
const manifestPath = path.join(
|
|
63
|
+
rootDir,
|
|
64
|
+
'packages',
|
|
65
|
+
'icons-workflow',
|
|
66
|
+
'stories',
|
|
67
|
+
'icon-manifest.ts'
|
|
68
|
+
);
|
|
69
|
+
fs.writeFileSync(manifestPath, disclaimer, 'utf-8');
|
|
70
|
+
let manifestImports = `import {
|
|
71
|
+
html,
|
|
72
|
+
TemplateResult
|
|
73
|
+
} from '@spectrum-web-components/base';\r\n`;
|
|
74
|
+
let manifestListings = `\r\nexport const iconManifest = [\r\n`;
|
|
75
|
+
|
|
76
|
+
icons.forEach((i) => {
|
|
77
|
+
const svg = fs.readFileSync(i, 'utf-8');
|
|
78
|
+
let id = path.basename(i, '.svg').replace('S_', '').replace('_22_N', '');
|
|
79
|
+
if (id.search(/^Ad[A-Z]/) !== -1) {
|
|
80
|
+
id = id.replace(/^Ad/, '');
|
|
81
|
+
id += 'Advert';
|
|
53
82
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
);
|
|
59
|
-
const
|
|
83
|
+
const ComponentName = id === 'github' ? 'GitHub' : Case.pascal(id);
|
|
84
|
+
const $ = load(svg, {
|
|
85
|
+
xmlMode: true,
|
|
86
|
+
});
|
|
87
|
+
const title = Case.capital(id);
|
|
88
|
+
const fileName = `${id}.ts`;
|
|
89
|
+
const location = path.join(
|
|
60
90
|
rootDir,
|
|
61
|
-
'packages',
|
|
62
|
-
|
|
63
|
-
'stories',
|
|
64
|
-
'icon-manifest.ts'
|
|
91
|
+
'packages/icons-workflow/src/icons',
|
|
92
|
+
fileName
|
|
65
93
|
);
|
|
66
|
-
fs.writeFileSync(manifestPath, disclaimer, 'utf-8');
|
|
67
|
-
let manifestImports = `import {
|
|
68
|
-
html,
|
|
69
|
-
TemplateResult
|
|
70
|
-
} from '@spectrum-web-components/base';\r\n`;
|
|
71
|
-
let manifestListings = `\r\nexport const iconManifest = [\r\n`;
|
|
72
94
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
.basename(i, '.svg')
|
|
77
|
-
.replace('S_', '')
|
|
78
|
-
.replace('_22_N', '');
|
|
79
|
-
if (id.search(/^Ad[A-Z]/) !== -1) {
|
|
80
|
-
id = id.replace(/^Ad/, '');
|
|
81
|
-
id += 'Advert';
|
|
82
|
-
}
|
|
83
|
-
const ComponentName = id === 'github' ? 'GitHub' : Case.pascal(id);
|
|
84
|
-
const $ = load(svg, {
|
|
85
|
-
xmlMode: true,
|
|
86
|
-
});
|
|
87
|
-
const title = Case.capital(id);
|
|
88
|
-
const fileName = `${id}.ts`;
|
|
89
|
-
const location = path.join(
|
|
90
|
-
rootDir,
|
|
91
|
-
'packages/icons-workflow/src/icons',
|
|
92
|
-
fileName
|
|
93
|
-
);
|
|
95
|
+
if (!Number.isNaN(Number(ComponentName[0]))) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
94
98
|
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
$('*').each((index, el) => {
|
|
100
|
+
if (el.name === 'svg') {
|
|
101
|
+
$(el).attr('aria-hidden', '...');
|
|
102
|
+
$(el).attr('role', 'img');
|
|
103
|
+
if (keepColors !== 'keep') {
|
|
104
|
+
$(el).attr('fill', 'currentColor');
|
|
105
|
+
}
|
|
106
|
+
$(el).attr('aria-label', '...');
|
|
107
|
+
$(el).removeAttr('id');
|
|
108
|
+
$(el).attr('width', '...');
|
|
109
|
+
$(el).attr('height', '...');
|
|
97
110
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
$(el).attr(
|
|
107
|
-
$(el).removeAttr('id');
|
|
108
|
-
$(el).attr('width', '...');
|
|
109
|
-
$(el).attr('height', '...');
|
|
111
|
+
if (el.name === 'defs') {
|
|
112
|
+
$(el).remove();
|
|
113
|
+
}
|
|
114
|
+
Object.keys(el.attribs).forEach((x) => {
|
|
115
|
+
if (x === 'class') {
|
|
116
|
+
$(el).removeAttr(x);
|
|
117
|
+
}
|
|
118
|
+
if (keepColors !== 'keep' && x === 'stroke') {
|
|
119
|
+
$(el).attr(x, 'currentColor');
|
|
110
120
|
}
|
|
111
|
-
if (
|
|
112
|
-
$(el).
|
|
121
|
+
if (keepColors !== 'keep' && x === 'fill') {
|
|
122
|
+
$(el).attr(x, 'currentColor');
|
|
113
123
|
}
|
|
114
|
-
Object.keys(el.attribs).forEach((x) => {
|
|
115
|
-
if (x === 'class') {
|
|
116
|
-
$(el).removeAttr(x);
|
|
117
|
-
}
|
|
118
|
-
if (keepColors !== 'keep' && x === 'stroke') {
|
|
119
|
-
$(el).attr(x, 'currentColor');
|
|
120
|
-
}
|
|
121
|
-
if (keepColors !== 'keep' && x === 'fill') {
|
|
122
|
-
$(el).attr(x, 'currentColor');
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
124
|
});
|
|
125
|
+
});
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
const iconLiteral = `
|
|
128
|
+
${disclaimer}
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
import {tag as html, TemplateResult} from '../custom-tag.js';
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
132
|
+
export {setCustomTemplateLiteralTag} from '../custom-tag.js';
|
|
133
|
+
export const ${ComponentName}Icon = ({
|
|
134
|
+
width = 24,
|
|
135
|
+
height = 24,
|
|
136
|
+
hidden = false,
|
|
137
|
+
title = '${title}',
|
|
138
|
+
} = {},): string | TemplateResult => {
|
|
139
|
+
return html\`${$('svg')
|
|
140
|
+
.toString()
|
|
141
|
+
.replace(
|
|
142
|
+
'aria-hidden="..."',
|
|
143
|
+
"aria-hidden=${hidden ? 'true' : 'false'}"
|
|
144
|
+
)
|
|
145
|
+
.replace('width="..."', 'width=${width}')
|
|
146
|
+
.replace('height="..."', 'height=${height}')
|
|
147
|
+
.replace('aria-label="..."', 'aria-label=${title}')}\`;
|
|
148
|
+
}
|
|
149
|
+
`;
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
151
|
+
const icon = prettier.format(iconLiteral, {
|
|
152
|
+
printWidth: 100,
|
|
153
|
+
tabWidth: 2,
|
|
154
|
+
useTabs: false,
|
|
155
|
+
semi: true,
|
|
156
|
+
singleQuote: true,
|
|
157
|
+
trailingComma: 'all',
|
|
158
|
+
bracketSpacing: true,
|
|
159
|
+
jsxBracketSameLine: false,
|
|
160
|
+
arrowParens: 'avoid',
|
|
161
|
+
parser: 'typescript',
|
|
162
|
+
});
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
fs.writeFileSync(location, icon, 'utf-8');
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
const exportString = `export {${ComponentName}Icon} from './icons/${id}.js';\r\n`;
|
|
167
|
+
fs.appendFileSync(
|
|
168
|
+
path.join(rootDir, 'packages', 'icons-workflow', 'src', 'icons.ts'),
|
|
169
|
+
exportString,
|
|
170
|
+
'utf-8'
|
|
171
|
+
);
|
|
172
172
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
const iconElementName = `sp-icon-${Case.kebab(ComponentName)}`;
|
|
174
|
+
const iconElement = `
|
|
175
|
+
${disclaimer}
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
177
|
+
import {
|
|
178
|
+
html,
|
|
179
|
+
TemplateResult
|
|
180
|
+
} from '@spectrum-web-components/base';
|
|
181
|
+
import {
|
|
182
|
+
IconBase
|
|
183
|
+
} from '@spectrum-web-components/icon';
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
185
|
+
import {
|
|
186
|
+
${ComponentName}Icon
|
|
187
|
+
} from '../icons/${id}.js';
|
|
188
|
+
import {
|
|
189
|
+
setCustomTemplateLiteralTag
|
|
190
|
+
} from '../custom-tag.js';
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
192
|
+
/**
|
|
193
|
+
* @element ${iconElementName}
|
|
194
|
+
*/
|
|
195
|
+
export class Icon${ComponentName} extends IconBase {
|
|
196
|
+
protected override render(): TemplateResult {
|
|
197
|
+
setCustomTemplateLiteralTag(html);
|
|
198
|
+
return ${ComponentName}Icon({hidden: !this.label, title: this.label}) as TemplateResult;
|
|
200
199
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
200
|
+
}
|
|
201
|
+
`;
|
|
202
|
+
const iconElementFile = prettier.format(iconElement, {
|
|
203
|
+
printWidth: 100,
|
|
204
|
+
tabWidth: 2,
|
|
205
|
+
useTabs: false,
|
|
206
|
+
semi: true,
|
|
207
|
+
singleQuote: true,
|
|
208
|
+
trailingComma: 'all',
|
|
209
|
+
bracketSpacing: true,
|
|
210
|
+
jsxBracketSameLine: false,
|
|
211
|
+
arrowParens: 'avoid',
|
|
212
|
+
parser: 'typescript',
|
|
213
|
+
});
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
215
|
+
fs.writeFileSync(
|
|
216
|
+
path.join(
|
|
217
|
+
rootDir,
|
|
218
|
+
'packages',
|
|
219
|
+
'icons-workflow',
|
|
220
|
+
'src',
|
|
221
|
+
'elements',
|
|
222
|
+
`Icon${id}.ts`
|
|
223
|
+
),
|
|
224
|
+
iconElementFile,
|
|
225
|
+
'utf-8'
|
|
226
|
+
);
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
const iconRegistration = `
|
|
229
|
+
${disclaimer}
|
|
230
230
|
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
import { Icon${ComponentName} } from '../src/elements/Icon${id}.js';
|
|
232
|
+
import { defineElement } from '@spectrum-web-components/base/src/define-element.js';
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
defineElement('${iconElementName}', Icon${ComponentName});
|
|
235
235
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
236
|
+
declare global {
|
|
237
|
+
interface HTMLElementTagNameMap {
|
|
238
|
+
'${iconElementName}': Icon${ComponentName};
|
|
240
239
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
fs.writeFileSync(
|
|
256
|
-
path.join(
|
|
257
|
-
rootDir,
|
|
258
|
-
'packages',
|
|
259
|
-
'icons-workflow',
|
|
260
|
-
'icons',
|
|
261
|
-
`${iconElementName}.ts`
|
|
262
|
-
),
|
|
263
|
-
iconRegistrationFile,
|
|
264
|
-
'utf-8'
|
|
265
|
-
);
|
|
266
|
-
const importStatement = `\r\nimport '@spectrum-web-components/icons-workflow/icons/${iconElementName}.js';`;
|
|
267
|
-
const metadata = `{name: '${Case.sentence(
|
|
268
|
-
ComponentName
|
|
269
|
-
)}', tag: '<${iconElementName}>', story: (size: string): TemplateResult => html\`<${iconElementName} size=\$\{size\}></${iconElementName}>\`},\r\n`;
|
|
270
|
-
manifestImports += importStatement;
|
|
271
|
-
manifestListings += metadata;
|
|
240
|
+
}
|
|
241
|
+
`;
|
|
242
|
+
const iconRegistrationFile = prettier.format(iconRegistration, {
|
|
243
|
+
printWidth: 100,
|
|
244
|
+
tabWidth: 2,
|
|
245
|
+
useTabs: false,
|
|
246
|
+
semi: true,
|
|
247
|
+
singleQuote: true,
|
|
248
|
+
trailingComma: 'all',
|
|
249
|
+
bracketSpacing: true,
|
|
250
|
+
jsxBracketSameLine: false,
|
|
251
|
+
arrowParens: 'avoid',
|
|
252
|
+
parser: 'typescript',
|
|
272
253
|
});
|
|
273
254
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
255
|
+
fs.writeFileSync(
|
|
256
|
+
path.join(
|
|
257
|
+
rootDir,
|
|
258
|
+
'packages',
|
|
259
|
+
'icons-workflow',
|
|
260
|
+
'icons',
|
|
261
|
+
`${iconElementName}.ts`
|
|
262
|
+
),
|
|
263
|
+
iconRegistrationFile,
|
|
283
264
|
'utf-8'
|
|
284
265
|
);
|
|
266
|
+
const importStatement = `\r\nimport '@spectrum-web-components/icons-workflow/icons/${iconElementName}.js';`;
|
|
267
|
+
const metadata = `{name: '${Case.sentence(
|
|
268
|
+
ComponentName
|
|
269
|
+
)}', tag: '<${iconElementName}>', story: (size: string): TemplateResult => html\`<${iconElementName} size=\$\{size\}></${iconElementName}>\`},\r\n`;
|
|
270
|
+
manifestImports += importStatement;
|
|
271
|
+
manifestListings += metadata;
|
|
285
272
|
});
|
|
273
|
+
|
|
274
|
+
const exportString = `\r\nexport { setCustomTemplateLiteralTag } from './custom-tag.js';\r\n`;
|
|
275
|
+
fs.appendFileSync(
|
|
276
|
+
path.join(rootDir, 'packages', 'icons-workflow', 'src', 'icons.ts'),
|
|
277
|
+
exportString,
|
|
278
|
+
'utf-8'
|
|
279
|
+
);
|
|
280
|
+
fs.appendFileSync(
|
|
281
|
+
manifestPath,
|
|
282
|
+
`${manifestImports}${manifestListings}];\r\n`,
|
|
283
|
+
'utf-8'
|
|
284
|
+
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/icons-workflow",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.3-overlay.61+af969dcc2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
"lit-html"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@spectrum-web-components/base": "^0.33.
|
|
48
|
-
"@spectrum-web-components/icon": "^0.33.
|
|
47
|
+
"@spectrum-web-components/base": "^0.33.3-overlay.61+af969dcc2",
|
|
48
|
+
"@spectrum-web-components/icon": "^0.33.3-overlay.61+af969dcc2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@adobe/spectrum-css-workflow-icons": "^1.5.4",
|
|
52
|
-
"@spectrum-css/icon": "^3.0.
|
|
52
|
+
"@spectrum-css/icon": "^3.0.48",
|
|
53
53
|
"case": "^1.6.1",
|
|
54
54
|
"cheerio": "^1.0.0-rc.2",
|
|
55
55
|
"fs": "^0.0.1-security",
|
|
56
|
-
"glob": "^
|
|
56
|
+
"glob": "^10.3.0",
|
|
57
57
|
"path": "^0.12.7",
|
|
58
58
|
"prettier": "^2.7.1"
|
|
59
59
|
},
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"./src/index.js",
|
|
64
64
|
"./icons/*"
|
|
65
65
|
],
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "af969dcc2f8c905648b3e5a5fad982d1f81ee080"
|
|
67
67
|
}
|