-
Notifications
You must be signed in to change notification settings - Fork 233
feat(icons-workflow): update workflow icons to the latest version #5735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bc1987e
4002ddb
bce9d00
546a344
22b8732
2a337e2
d4d6de6
3e9ca89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
'@spectrum-web-components/icons-workflow': minor | ||
--- | ||
|
||
- Upgraded to `@adobe/spectrum-css-workflow-icons@5.0.0`. | ||
- Includes changes from previous a4u upstream releases: | ||
- Added `S2_Icon_HeartFilled_20_N.svg`, updated `S2_Icon_SpeedFast_20_N.svg`. | ||
- Replaced all 22×20px Cloud State icons with 20px variants. | ||
- Removed deprecated multi-colored error icon. Added new Cloud State icons (`Disconnected`, `Error`, `InProgress`, `Online`, `Paused`, `Pending`, `SlowConnection`). | ||
- Updated several other icons (`CloseCaptions`, `CommentHide`, `Community`, etc.). | ||
- For the full changelog, see: https://github.com/adobe/spectrum-css-workflow-icons/pull/50 | ||
Comment on lines
+5
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very well documented summary! |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,9 +38,21 @@ OF ANY KIND, either express or implied. See the License for the specific languag | |
governing permissions and limitations under the License. | ||
*/`; | ||
|
||
const S1IConsPackageDir = '@adobe/spectrum-css-workflow-icons/dist/18'; | ||
const S2IConsPackageDir = | ||
'@adobe/spectrum-css-workflow-icons-s2/dist/assets/svg'; | ||
const S1IconsPackagePath = path.dirname( | ||
fileURLToPath( | ||
import.meta.resolve('@adobe/spectrum-css-workflow-icons/package.json') | ||
) | ||
); | ||
const S2IconsPackagePath = path.dirname( | ||
fileURLToPath( | ||
import.meta.resolve( | ||
'@adobe/spectrum-css-workflow-icons-s2/package.json' | ||
) | ||
) | ||
); | ||
|
||
const S1IconsDir = path.join(S1IconsPackagePath, 'dist/18'); | ||
const S2IconsDir = path.join(S2IconsPackagePath, 'dist/assets/svg'); | ||
const keepColors = ''; | ||
|
||
const ensureDirectoryExists = (dirPath) => { | ||
|
@@ -351,13 +363,9 @@ async function buildIcons(icons, tag, iconsNameList) { | |
}); | ||
} | ||
|
||
const iconsV1 = ( | ||
await fg(`${rootDir}/node_modules/${S1IConsPackageDir}/**.svg`) | ||
).sort(); | ||
const iconsV1 = (await fg(`${S1IconsDir}/**.svg`)).sort(); | ||
|
||
const iconsV2 = ( | ||
await fg(`${rootDir}/node_modules/${S2IConsPackageDir}/**.svg`) | ||
).sort(); | ||
const iconsV2 = (await fg(`${S2IconsDir}/**.svg`)).sort(); | ||
|
||
const iconsV1NameList = iconsV1.map((i) => { | ||
return getComponentName(i); | ||
|
@@ -381,3 +389,69 @@ fs.appendFileSync( | |
`${manifestImports}${manifestListings}];\r\n`, | ||
'utf-8' | ||
); | ||
|
||
/** | ||
* Generates iconsList.json for filtering icons in Storybook demos and documentation website. | ||
* | ||
* This function processes the available S1 and S2 icon component names and creates a JSON file | ||
* that serves as an allowlist for filtering icons in the iconset Storybook demos. The filtering | ||
* ensures that only icons available in the current Spectrum version are displayed to users. | ||
* | ||
* The function performs the following transformations: | ||
* 1. Converts PascalCase component names (e.g., "HeartFilled") to lowercase (e.g., "heartfilled") | ||
* 2. Filters out any names that start with numbers (invalid icon names) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this one wasn’t filtered by the icons team. As we think about scaling icon processing, it might be helpful to handle this filtering upstream so we don’t need to manage it on our end. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Absolutely! I see any current icon improvements as the bare minimum to keep the current pipeline running smoothly. Ideally, though, we rethink the whole delivery pipeline to simplify it and reduce the lift on our side 😃 |
||
* 3. Sorts the lists alphabetically for consistent output | ||
* 4. Creates separate arrays for S1 and S2 icons | ||
* 5. Writes the prettifiedformatted JSON to packages/iconset/stories/iconsList.json | ||
* | ||
* @example | ||
* Input: ["HeartFilled", "AddCircle", "20Asset"] | ||
* Output: ["addcircle", "heartfilled"] (20Asset filtered out) | ||
* | ||
* @example | ||
* Generated JSON structure: | ||
* { | ||
* "s1": ["abc", "addcircle", "heart", ...], | ||
* "s2": ["accessibility", "addcontent", "heartfilled", ...] | ||
* } | ||
* | ||
* */ | ||
const generateIconsList = () => { | ||
// Helper function to transform component names to lowercase format for iconsList.json | ||
const transformIconNames = (nameList) => { | ||
return nameList | ||
.map((name) => | ||
name.replace(/([A-Z])/g, (match, letter) => | ||
letter.toLowerCase() | ||
) | ||
) | ||
.filter((name) => !Number.isNaN(Number(name[0])) === false) | ||
.sort(); | ||
}; | ||
|
||
const iconsListData = { | ||
s1: transformIconNames(iconsV1NameList), | ||
s2: transformIconNames(iconsV2NameList), | ||
}; | ||
|
||
const iconsListPath = path.join( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would this be a good place to leverage |
||
rootDir, | ||
'packages', | ||
'iconset', | ||
'stories', | ||
'iconsList.json' | ||
); | ||
|
||
prettier | ||
.format(JSON.stringify(iconsListData), { | ||
parser: 'json', | ||
printWidth: 100, | ||
tabWidth: 4, | ||
useTabs: false, | ||
}) | ||
.then((formattedJson) => { | ||
fs.writeFileSync(iconsListPath, formattedJson, 'utf-8'); | ||
}); | ||
}; | ||
|
||
generateIconsList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice summary, thanks for all these great details!