Skip to content
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

deprecation: color lightest and darkest #4179

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
>
<div id="deprecation" class="spectrum-InLineAlert spectrum-InLineAlert--negative">
<div class="spectrum-InLineAlert-header">
Deprecated component
Deprecation Warning
<sp-icon-alert class="spectrum-InLineAlert-icon" dir="ltr" aria-hidden="true"></sp-icon-alert>
</div>
<div class="spectrum-InLineAlert-content">
This component has been deprecated.<br></br>
{% if isComponent %}
This component will be deprecated.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be package vs component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you want to bifurcate as a package and a tool?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tricky intersection of naming. Here, by "package", I mean @spectrum-web-components/... as found on NPM. So any directory that gets published would satisfy this meaning.

Maybe the more flexible approach would be to leverage the deprecationNotice only, and require that we make we include text of this shape there rather than centralizing it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we can make something like @spectrum-web-components/packages/banner will be deprecated instead of This component will be deprecated maybe something like this?
Screenshot 2024-03-15 at 12 13 17 PM
Screenshot 2024-03-15 at 12 13 24 PM

<br></br>
{% endif %}
{{ deprecationNotice | safe }}
</div>
</div>
Expand Down
22 changes: 10 additions & 12 deletions projects/documentation/scripts/copy-component-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ const findDeclaration = (customElements, test) => {
};

const findDeprecationNotice = async function (filePath) {
const hasDeprecation = fs.existsSync(filePath);
if (hasDeprecation) {
const packageJSON = await import(filePath, {
assert: { type: 'json' },
}).then((packageDefault) => packageDefault.default);
return packageJSON.deprecationNotice;
for await (const mdPath of globby.stream(filePath)) {
const hasDeprecation = fs.existsSync(mdPath);
if (hasDeprecation) {
const packageJSON = await import(mdPath, {
assert: { type: 'json' },
}).then((packageDefault) => packageDefault.default);
return packageJSON.deprecationNotice;
}
}
};

Expand Down Expand Up @@ -184,12 +186,7 @@ export async function processREADME(mdPath) {
)
);
const deprecationNotice = await findDeprecationNotice(
path.resolve(
__dirname,
'../../../packages',
packageName,
'package.json'
)
`${projectDir}/(packages|tools)/${packageName}/package.json`
);
const hasTemplate = fs.existsSync(
path.resolve(
Expand All @@ -211,6 +208,7 @@ export async function processREADME(mdPath) {
hasDemoControls: ${hasArgs},
hasDemoTemplate: ${hasTemplate},
deprecationNotice: ${JSON.stringify(deprecationNotice)},
isComponent: ${isComponent},
${hasArgs ? 'demoControls: Object.values(argTypes),' : ''}
};
`;
Expand Down
1 change: 1 addition & 0 deletions tools/theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
},
"types": "./src/index.d.ts",
"customElements": "custom-elements.json",
"deprecationNotice": "Color Lightest and Darkest are deprecated and will be removed in a future release",
"sideEffects": [
"./sp-*.js",
"./**/*.dev.js",
Expand Down
8 changes: 8 additions & 0 deletions tools/theme/src/Theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,14 @@ export class Theme extends HTMLElement implements ThemeKindProvider {
}
);
}
if (['lightest', 'darkest'].includes(this.color)) {
window.__swc.warn(
this,
`Color lightest and darkest are deprecated and will be removed in a future release`,
'https://opensource.adobe.com/spectrum-web-components/tools/themes/#deprecation',
{ level: 'deprecation' }
);
}
}
return [...styles];
}
Expand Down
Loading