mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-09 05:26:24 +09:00
19 lines
509 B
TypeScript
19 lines
509 B
TypeScript
import { type Instance, type Breakpoint } from "@webstudio-is/sdk";
|
|
|
|
export const deleteCssRulesByBreakpoint = (
|
|
instance: Instance,
|
|
breakpointId: Breakpoint["id"]
|
|
) => {
|
|
const cssRules = [...instance.cssRules];
|
|
cssRules.forEach((cssRule, index) => {
|
|
if (cssRule.breakpoint === breakpointId) {
|
|
instance.cssRules.splice(index, 1);
|
|
}
|
|
});
|
|
|
|
for (const child of instance.children) {
|
|
if (typeof child === "string") continue;
|
|
deleteCssRulesByBreakpoint(child, breakpointId);
|
|
}
|
|
};
|