Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

chore: Delete unused code (#3185)

Oleg Isoneneb63c87cef6d
diff --git a/apps/builder/app/builder/features/style-panel/shared/configs.ts b/apps/builder/app/builder/features/style-panel/shared/configs.ts
index 4e0f2040bd..64b6864576 100644
--- a/apps/builder/app/builder/features/style-panel/shared/configs.ts
+++ b/apps/builder/app/builder/features/style-panel/shared/configs.ts
@@ -1,13 +1,11 @@
import type { StyleProperty } from "@webstudio-is/css-engine";
-import { keywordValues, properties } from "@webstudio-is/css-data";
+import { keywordValues } from "@webstudio-is/css-data";
import { humanizeString } from "~/shared/string-utils";
-import type { AppliesTo } from "./dependencies";
import type * as Controls from "../controls";
type BaseStyleConfig = {
label: string;
property: StyleProperty;
- appliesTo: AppliesTo;
};
export type Control = keyof typeof Controls;
@@ -59,7 +57,6 @@ export const styleConfigByName = (propertyName: StyleProperty): StyleConfig => {
const result = {
label,
property,
- appliesTo: properties[property]?.appliesTo ?? "allElements",
control: getControl(property),
items: keywords.map((keyword) => ({ label: keyword, name: keyword })),
};
diff --git a/apps/builder/app/builder/features/style-panel/shared/dependencies.ts b/apps/builder/app/builder/features/style-panel/shared/dependencies.ts
deleted file mode 100644
index b126186f35..0000000000
--- a/apps/builder/app/builder/features/style-panel/shared/dependencies.ts
+++ /dev/null
@@ -1,150 +0,0 @@
-import type { CustomProperty, StyleProperty } from "@webstudio-is/css-engine";
-import type { properties } from "@webstudio-is/css-data";
-
-type Properties = typeof properties & {
- [custom: CustomProperty]: {
- appliesTo: "allElements";
- initial: string;
- inherited: boolean;
- };
-};
-
-export type AppliesTo = Properties[StyleProperty]["appliesTo"];
-
-const displayInline = [
- "inline",
- "inline-block",
- "inline-table",
- "inline-list-item",
- "inline-flex",
- "inline-grid",
-];
-
-type Dependencies = {
- [appliesTo in AppliesTo]?: {
- property: StyleProperty;
- values?: Array<string>;
- notValues?: Array<string>;
- };
-};
-
-// @todo many conditions apply based on element type,
-// currently its wrong, because e.g. display: block is already defined on a div,
-// but we expect it to be defined in currentStyle.
-export const dependencies: Dependencies = {
- blockContainers: {
- property: "display",
- values: ["block"],
- },
- blockContainerElements: {
- property: "display",
- values: ["block"],
- },
- flexContainers: {
- property: "display",
- values: ["flex", "inline-flex"],
- },
- // @todo this should actually check on parent
- flexItemsAndInFlowPseudos: {
- property: "display",
- values: ["flex", "inline-flex"],
- },
- // @todo needs to also check flex-wrap
- multilineFlexContainers: {
- property: "flexWrap",
- values: ["wrap", "wrap-reverse"],
- },
- multiColumnElementsFlexContainersGridContainers: {
- property: "display",
- values: ["flex", "inline-flex", "grid"],
- },
- flexContainersGridContainers: {
- property: "display",
- values: ["flex", "inline-flex", "grid"],
- },
-
- // Used by alignSelf
- // @todo needs to check parent to be display: flex or grid, position: absolute
- //flexItemsGridItemsAndAbsolutelyPositionedBoxes: {
- // property: "display",
- // values: ["flex", 'grid'],
- //},
-
- // Used by order
- // @todo Same thing as above
- //flexItemsGridItemsAbsolutelyPositionedContainerChildren: {
- // property: "display",
- // values: ["flex"],
- //},
-
- gridContainers: {
- property: "display",
- values: ["grid"],
- },
- gridItemsAndBoxesWithinGridContainer: {
- property: "display",
- values: ["grid"],
- },
- positionedElements: {
- property: "position",
- notValues: ["static"],
- },
- allElementsNoEffectIfDisplayNone: {
- property: "display",
- notValues: ["none"],
- },
- blockLevelElements: {
- property: "display",
- values: ["block", "flex", "grid", "table"],
- },
- allElementsExceptTableDisplayTypes: {
- property: "display",
- notValues: ["table"],
- },
- allElementsExceptInternalTableDisplayTypes: {
- property: "display",
- notValues: [
- "table-row-group",
- "table-header-group",
- "table-footer-group",
- "table-row",
- "table-cell",
- "table-column-group",
- "table-column",
- "table-caption",
- ],
- },
- allElementsButNonReplacedAndTableColumns: {
- property: "display",
- notValues: ["table-column-group", "table-column"],
- },
- allElementsButNonReplacedAndTableRows: {
- property: "display",
- notValues: ["table-row-group", "table-row"],
- },
- blockContainersFlexContainersGridContainers: {
- property: "display",
- values: ["block", "flex", "grid"],
- },
- sameAsWidthAndHeight: {
- property: "display",
- notValues: [
- "table-column-group",
- "table-column",
- "table-row-group",
- "table-row",
- ],
- },
- nonReplacedInlineElements: {
- property: "display",
- values: displayInline,
- },
- inlineLevelAndTableCellElements: {
- property: "display",
- values: [...displayInline, "table-cell"],
- },
- absolutelyPositionedElements: {
- property: "position",
- values: ["absolute"],
- },
-};