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.

refactor: hyphenate keyword values (#4987)

Bogdan Chadkinaf653fa002e4
diff --git a/apps/builder/app/builder/features/settings-panel/props-section/animation/animation-panel-content.tsx b/apps/builder/app/builder/features/settings-panel/props-section/animation/animation-panel-content.tsx
index 60f1fb1897..079ed05568 100644
--- a/apps/builder/app/builder/features/settings-panel/props-section/animation/animation-panel-content.tsx
+++ b/apps/builder/app/builder/features/settings-panel/props-section/animation/animation-panel-content.tsx
@@ -7,6 +7,7 @@ import {
theme,
toast,
} from "@webstudio-is/design-system";
+import { keywordValues } from "@webstudio-is/css-data";
import { toPascalCase } from "~/builder/features/style-panel/shared/keyword-utils";
import { useIds } from "~/shared/form-utils";
@@ -28,7 +29,6 @@ import {
import { toValue, type StyleValue } from "@webstudio-is/css-engine";
import { useState } from "react";
import { Keyframes } from "./animation-keyframes";
-import { styleConfigByName } from "~/builder/features/style-panel/shared/configs";
import { titleCase } from "title-case";
type Props = {
@@ -168,9 +168,9 @@ const EasingInput = ({
: { type: "unparsed", value }
}
getOptions={() => [
- ...styleConfigByName(property).items.map((item) => ({
+ ...keywordValues["animation-timing-function"].map((value) => ({
type: "keyword" as const,
- value: item.name,
+ value,
})),
]}
property={property}
diff --git a/apps/builder/app/builder/features/style-panel/controls/color/color-control.tsx b/apps/builder/app/builder/features/style-panel/controls/color/color-control.tsx
index 1cbf10e1c5..0bce16bf11 100644
--- a/apps/builder/app/builder/features/style-panel/controls/color/color-control.tsx
+++ b/apps/builder/app/builder/features/style-panel/controls/color/color-control.tsx
@@ -1,6 +1,10 @@
-import type { CssProperty, StyleProperty } from "@webstudio-is/css-engine";
+import {
+ hyphenateProperty,
+ type CssProperty,
+ type StyleProperty,
+} from "@webstudio-is/css-engine";
+import { keywordValues } from "@webstudio-is/css-data";
import { ColorPicker } from "../../shared/color-picker";
-import { styleConfigByName } from "../../shared/configs";
import {
$availableColorVariables,
useComputedStyleDecl,
@@ -22,9 +26,9 @@ export const ColorControl = ({
value={value}
currentColor={currentColor}
getOptions={() => [
- ...styleConfigByName(property).items.map((item) => ({
+ ...(keywordValues[hyphenateProperty(property)] ?? []).map((item) => ({
type: "keyword" as const,
- value: item.name,
+ value: item,
})),
...$availableColorVariables.get(),
]}
diff --git a/apps/builder/app/builder/features/style-panel/controls/font-family/font-family-control.tsx b/apps/builder/app/builder/features/style-panel/controls/font-family/font-family-control.tsx
index 80b7c8f4ed..87ad5b37ad 100644
--- a/apps/builder/app/builder/features/style-panel/controls/font-family/font-family-control.tsx
+++ b/apps/builder/app/builder/features/style-panel/controls/font-family/font-family-control.tsx
@@ -5,15 +5,14 @@ import {
NestedInputButton,
FloatingPanel,
} from "@webstudio-is/design-system";
-import { FontsManager } from "~/builder/shared/fonts-manager";
import { forwardRef, useMemo, useState, type ComponentProps } from "react";
import { toValue } from "@webstudio-is/css-engine";
import { matchSorter } from "match-sorter";
+import { UploadIcon } from "@webstudio-is/icons";
+import { keywordValues, parseCssValue } from "@webstudio-is/css-data";
+import { FontsManager } from "~/builder/shared/fonts-manager";
import { useAssets } from "~/builder/shared/assets";
import { toItems } from "~/builder/shared/fonts-manager";
-import { UploadIcon } from "@webstudio-is/icons";
-import { styleConfigByName } from "../../shared/configs";
-import { parseCssValue } from "@webstudio-is/css-data";
import { useComputedStyleDecl } from "../../shared/model";
import { setProperty } from "../../shared/use-style-data";
@@ -50,10 +49,11 @@ export const FontFamilyControl = () => {
>();
const { assetContainers } = useAssets("font");
const items = useMemo(() => {
- const fallbacks = styleConfigByName("fontFamily").items;
- return [...toItems(assetContainers), ...fallbacks].map(({ label }) => ({
- value: label,
- }));
+ const fallbacks = keywordValues["font-family"];
+ return [
+ ...toItems(assetContainers).map(({ label }) => ({ value: label })),
+ ...fallbacks.map((value) => ({ value })),
+ ];
}, [assetContainers]);
const [isFontManagerOpen, setIsFontMangerOpen] = useState(false);
diff --git a/apps/builder/app/builder/features/style-panel/controls/position/position-control.tsx b/apps/builder/app/builder/features/style-panel/controls/position/position-control.tsx
index 51662235a0..7a07e4bdf3 100644
--- a/apps/builder/app/builder/features/style-panel/controls/position/position-control.tsx
+++ b/apps/builder/app/builder/features/style-panel/controls/position/position-control.tsx
@@ -1,5 +1,6 @@
import {
camelCaseProperty,
+ keywordValues,
propertyDescriptions,
} from "@webstudio-is/css-data";
import {
@@ -8,10 +9,10 @@ import {
type StyleValue,
type StyleProperty,
type CssProperty,
+ hyphenateProperty,
} from "@webstudio-is/css-engine";
import { Flex, Grid, PositionGrid } from "@webstudio-is/design-system";
import type { ComputedStyleDecl } from "~/shared/style-object-model";
-import { styleConfigByName } from "../../shared/configs";
import { CssValueInputContainer } from "../../shared/css-value-input";
import {
deleteProperty,
@@ -60,12 +61,13 @@ export const PositionControl = ({
property: StyleProperty | CssProperty;
styleDecl: ComputedStyleDecl;
}) => {
- const { items } = styleConfigByName(property);
const value = toTuple(styleDecl.cascadedValue);
- const keywords = items.map((item) => ({
- type: "keyword" as const,
- value: item.name,
- }));
+ const keywords = (keywordValues[hyphenateProperty(property)] ?? []).map(
+ (value) => ({
+ type: "keyword" as const,
+ value,
+ })
+ );
const setValue = setProperty(property);
diff --git a/apps/builder/app/builder/features/style-panel/controls/select/select-control.tsx b/apps/builder/app/builder/features/style-panel/controls/select/select-control.tsx
index f0de8a895b..afffa38eb9 100644
--- a/apps/builder/app/builder/features/style-panel/controls/select/select-control.tsx
+++ b/apps/builder/app/builder/features/style-panel/controls/select/select-control.tsx
@@ -1,16 +1,18 @@
+import { noCase } from "change-case";
import {
camelCaseProperty,
declarationDescriptions,
+ keywordValues,
parseCssValue,
} from "@webstudio-is/css-data";
import {
+ hyphenateProperty,
StyleValue,
toValue,
type CssProperty,
type StyleProperty,
} from "@webstudio-is/css-engine";
import { Box, Select, theme } from "@webstudio-is/design-system";
-import { styleConfigByName } from "../../shared/configs";
import { toKebabCase } from "../../shared/keyword-utils";
import { useComputedStyleDecl } from "../../shared/model";
import {
@@ -22,12 +24,11 @@ import {
getRepeatedStyleItem,
setRepeatedStyleItem,
} from "../../shared/repeated-style";
-import { noCase } from "change-case";
export const SelectControl = ({
property,
index,
- items = styleConfigByName(property).items,
+ items,
}: {
property: StyleProperty | CssProperty;
index?: number;
@@ -45,7 +46,11 @@ export const SelectControl = ({
setRepeatedStyleItem(styleDecl, index, value, options);
}
};
- const options = items.map(({ name }) => name);
+ const options =
+ items?.map(({ name }) => name) ??
+ keywordValues[hyphenateProperty(property)] ??
+ [];
+
// We can't render an empty string as a value when display was added but without a value.
// One case is when advanced property is being added, but no value is set.
const valueString = toValue(value) || "empty";
diff --git a/apps/builder/app/builder/features/style-panel/controls/text/text-control.tsx b/apps/builder/app/builder/features/style-panel/controls/text/text-control.tsx
index 632f3ab752..84a14add9a 100644
--- a/apps/builder/app/builder/features/style-panel/controls/text/text-control.tsx
+++ b/apps/builder/app/builder/features/style-panel/controls/text/text-control.tsx
@@ -1,14 +1,15 @@
import { useState } from "react";
-import type {
- CssProperty,
- StyleProperty,
- StyleValue,
+import {
+ hyphenateProperty,
+ type CssProperty,
+ type StyleProperty,
+ type StyleValue,
} from "@webstudio-is/css-engine";
+import { keywordValues } from "@webstudio-is/css-data";
import {
CssValueInput,
type IntermediateStyleValue,
} from "../../shared/css-value-input";
-import { styleConfigByName } from "../../shared/configs";
import { deleteProperty, setProperty } from "../../shared/use-style-data";
import {
$availableUnitVariables,
@@ -33,9 +34,9 @@ export const TextControl = ({
value={value}
intermediateValue={intermediateValue}
getOptions={() => [
- ...styleConfigByName(property).items.map((item) => ({
+ ...(keywordValues[hyphenateProperty(property)] ?? []).map((value) => ({
type: "keyword" as const,
- value: item.name,
+ value,
})),
...$availableUnitVariables.get(),
]}
diff --git a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-size.tsx b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-size.tsx
index 4e4fb83070..0f23ca0c69 100644
--- a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-size.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-size.tsx
@@ -1,12 +1,11 @@
import { Grid, Select, theme } from "@webstudio-is/design-system";
import { toValue } from "@webstudio-is/css-engine";
-import { propertyDescriptions } from "@webstudio-is/css-data";
+import { keywordValues, propertyDescriptions } from "@webstudio-is/css-data";
import {
type StyleValue,
TupleValue,
TupleValueItem,
} from "@webstudio-is/css-engine";
-import { styleConfigByName } from "../../shared/configs";
import { CssValueInputContainer } from "../../shared/css-value-input";
import type { SetValue } from "../../shared/use-style-data";
import { PropertyInlineLabel } from "../../property-label";
@@ -41,12 +40,7 @@ export const BackgroundSize = ({ index }: { index: number }) => {
const styleDecl = useComputedStyleDecl(property);
const styleValue = getRepeatedStyleItem(styleDecl, index);
- const { items: defaultItems } = styleConfigByName(property);
-
- const selectOptions = [
- ...defaultItems,
- { name: "custom", label: "Custom" },
- ].map(({ name }) => name);
+ const selectOptions = [...keywordValues[property], "custom"];
const selectValue =
styleValue?.type === "keyword" ? toValue(styleValue) : "custom";
diff --git a/apps/builder/app/builder/features/style-panel/sections/borders/border-color.tsx b/apps/builder/app/builder/features/style-panel/sections/borders/border-color.tsx
index a7a8199380..21563557bc 100644
--- a/apps/builder/app/builder/features/style-panel/sections/borders/border-color.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/borders/border-color.tsx
@@ -1,6 +1,5 @@
import { toValue, type CssProperty } from "@webstudio-is/css-engine";
import { Box, Grid } from "@webstudio-is/design-system";
-import { styleConfigByName } from "../../shared/configs";
import { rowCss } from "./utils";
import { PropertyLabel, PropertyValueTooltip } from "../../property-label";
import { ColorPicker } from "../../shared/color-picker";
@@ -9,6 +8,7 @@ import {
useComputedStyles,
} from "../../shared/model";
import { createBatchUpdate } from "../../shared/use-style-data";
+import { keywordValues } from "@webstudio-is/css-data";
export const properties = [
"border-top-color",
@@ -17,8 +17,6 @@ export const properties = [
"border-left-color",
] satisfies [CssProperty, ...CssProperty[]];
-const { items } = styleConfigByName("border-top-color");
-
export const BorderColor = () => {
const styles = useComputedStyles(properties);
const serialized = styles.map((styleDecl) =>
@@ -57,9 +55,9 @@ export const BorderColor = () => {
property={local.property}
value={value}
getOptions={() => [
- ...items.map((item) => ({
+ ...keywordValues["border-top-color"].map((value) => ({
type: "keyword" as const,
- value: item.name,
+ value,
})),
...$availableColorVariables.get(),
]}
diff --git a/apps/builder/app/builder/features/style-panel/sections/borders/border-property.tsx b/apps/builder/app/builder/features/style-panel/sections/borders/border-property.tsx
index 1dbebc678a..b463bd61b6 100644
--- a/apps/builder/app/builder/features/style-panel/sections/borders/border-property.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/borders/border-property.tsx
@@ -2,8 +2,8 @@ import { type ReactNode } from "react";
import type { CssProperty } from "@webstudio-is/css-engine";
import { toValue } from "@webstudio-is/css-engine";
import { Box, Grid, ToggleButton } from "@webstudio-is/design-system";
+import { keywordValues } from "@webstudio-is/css-data";
import { CssValueInputContainer } from "../../shared/css-value-input";
-import { styleConfigByName } from "../../shared/configs";
import { rowCss } from "./utils";
import { useSelectedInstanceKv } from "../../shared/instances-kv";
import {
@@ -79,9 +79,9 @@ export const BorderProperty = ({
property={firstPropertyName}
styleSource={styleValueSourceColor}
getOptions={() => [
- ...styleConfigByName(firstPropertyName).items.map((item) => ({
+ ...(keywordValues[firstPropertyName] ?? []).map((value) => ({
type: "keyword" as const,
- value: item.name,
+ value,
})),
...$availableUnitVariables.get(),
]}
@@ -121,9 +121,9 @@ export const BorderProperty = ({
property={styleDecl.property}
styleSource={styleDecl.source.name}
getOptions={() =>
- styleConfigByName(firstPropertyName).items.map((item) => ({
+ (keywordValues[firstPropertyName] ?? []).map((value) => ({
type: "keyword" as const,
- value: item.name,
+ value,
}))
}
value={styleDecl.cascadedValue}
diff --git a/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx b/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx
index 9bb5058582..4bbb32523c 100644
--- a/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx
@@ -8,7 +8,7 @@ import {
SmallToggleButton,
Tooltip,
} from "@webstudio-is/design-system";
-import { propertyDescriptions } from "@webstudio-is/css-data";
+import { keywordValues, propertyDescriptions } from "@webstudio-is/css-data";
import type { CssProperty, StyleValue } from "@webstudio-is/css-engine";
import { toValue } from "@webstudio-is/css-engine";
import {
@@ -40,7 +40,6 @@ import {
AlignContentStretchIcon,
} from "@webstudio-is/icons";
import { MenuControl, SelectControl } from "../../controls";
-import { styleConfigByName } from "../../shared/configs";
import { createBatchUpdate, deleteProperty } from "../../shared/use-style-data";
import { StyleSection } from "../../shared/style-section";
import {
@@ -56,6 +55,7 @@ import {
} from "../../shared/model";
import type { ComputedStyleDecl } from "~/shared/style-object-model";
import { FlexGrid } from "./shared/flex-grid";
+import { humanizeString } from "~/shared/string-utils";
const GapLinked = ({
isLinked,
@@ -139,14 +139,16 @@ const GapInput = ({
onChange: (value: StyleValue) => void;
onReset: () => void;
}) => {
- const { label, items } = styleConfigByName(property);
-
return (
<Box>
<CssValueInput
styleSource={styleDecl.source.name}
icon={
- <GapTooltip label={label} styleDecl={styleDecl} onReset={onReset}>
+ <GapTooltip
+ label={humanizeString(property)}
+ styleDecl={styleDecl}
+ onReset={onReset}
+ >
{icon}
</GapTooltip>
}
@@ -154,9 +156,9 @@ const GapInput = ({
value={styleDecl.cascadedValue}
intermediateValue={intermediateValue}
getOptions={() => [
- ...items.map((item) => ({
+ ...(keywordValues[property] ?? []).map((value) => ({
type: "keyword" as const,
- value: item.name,
+ value,
})),
...$availableUnitVariables.get(),
]}
diff --git a/apps/builder/app/builder/features/style-panel/sections/position/position.tsx b/apps/builder/app/builder/features/style-panel/sections/position/position.tsx
index 8def0ca4b4..fab2b92da2 100644
--- a/apps/builder/app/builder/features/style-panel/sections/position/position.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/position/position.tsx
@@ -3,7 +3,6 @@ import { Grid, theme } from "@webstudio-is/design-system";
import { propertyDescriptions } from "@webstudio-is/css-data";
import { StyleSection } from "../../shared/style-section";
import { SelectControl, TextControl } from "../../controls";
-import { styleConfigByName } from "../../shared/configs";
import { PropertyLabel } from "../../property-label";
import {
useComputedStyleDecl,
@@ -47,10 +46,7 @@ export const Section = () => {
description={propertyDescriptions.position}
properties={["position"]}
/>
- <SelectControl
- property="position"
- items={styleConfigByName("position").items}
- />
+ <SelectControl property="position" />
{showZindexControl && showInsetControl === false && (
<>
<PropertyLabel
diff --git a/apps/builder/app/builder/features/style-panel/sections/transforms/transform-and-perspective-origin.tsx b/apps/builder/app/builder/features/style-panel/sections/transforms/transform-and-perspective-origin.tsx
index c52493d3ae..86e08cedea 100644
--- a/apps/builder/app/builder/features/style-panel/sections/transforms/transform-and-perspective-origin.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/transforms/transform-and-perspective-origin.tsx
@@ -11,7 +11,6 @@ import {
UnitValue,
type CssProperty,
} from "@webstudio-is/css-engine";
-import { styleConfigByName } from "../../shared/configs";
import { useMemo } from "react";
import { extractTransformOrPerspectiveOriginValues } from "./transform-extractors";
import { CssValueInputContainer } from "../../shared/css-value-input";
@@ -21,6 +20,7 @@ import {
} from "../../shared/use-style-data";
import { PropertyInlineLabel, PropertyLabel } from "../../property-label";
import { useComputedStyleDecl } from "../../shared/model";
+import { humanizeString } from "~/shared/string-utils";
// Fake properties to use in the CssValueInputContainer
// x, y axis takes length | percentage | keyword
@@ -60,7 +60,6 @@ export const TransformAndPerspectiveOrigin = ({
}) => {
const styleDecl = useComputedStyleDecl(property);
const value = styleDecl.cascadedValue;
- const { label } = styleConfigByName(property);
const origin = useMemo((): {
x: KeywordValue | UnitValue;
y: KeywordValue | UnitValue;
@@ -156,7 +155,7 @@ export const TransformAndPerspectiveOrigin = ({
return (
<Grid gap="2">
<PropertyLabel
- label={label}
+ label={humanizeString(property)}
description={propertyDescriptions[camelCaseProperty(property)]}
properties={[property]}
/>
diff --git a/apps/builder/app/builder/features/style-panel/shared/configs.ts b/apps/builder/app/builder/features/style-panel/shared/configs.ts
deleted file mode 100644
index ff0e08c0cc..0000000000
--- a/apps/builder/app/builder/features/style-panel/shared/configs.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-import type { CssProperty, StyleProperty } from "@webstudio-is/css-engine";
-import { camelCaseProperty, keywordValues } from "@webstudio-is/css-data";
-import { humanizeString } from "~/shared/string-utils";
-import type * as Controls from "../controls";
-
-type BaseStyleConfig = {
- label: string;
- property: StyleProperty;
-};
-
-export type Control = keyof typeof Controls;
-
-export type StyleConfig = BaseStyleConfig & {
- control: Control;
- items: Array<{ label: string; name: string }>;
-};
-
-type Property = keyof typeof keywordValues;
-
-const getControl = (property: StyleProperty): Control => {
- if (property.toLocaleLowerCase().includes("color")) {
- return "ColorControl";
- }
-
- switch (property) {
- case "fontFamily": {
- return "FontFamilyControl";
- }
- case "backgroundImage": {
- // @todo implement image picker for background image
- return "ImageControl";
- }
- case "fontWeight": {
- return "FontWeightControl";
- }
- }
-
- return "TextControl";
-};
-
-const styleConfigCache = new Map<StyleProperty, StyleConfig>();
-
-export const styleConfigByName = (
- propertyName: StyleProperty | CssProperty
-): StyleConfig => {
- // @todo propertyName is more narrow, only the props
- // in that category, we are widening the type to include all properties
- const property = camelCaseProperty(propertyName) as Property;
- const fromCache = styleConfigCache.get(property);
-
- if (fromCache) {
- return fromCache;
- }
-
- const keywords = keywordValues[property] || [];
- const label = humanizeString(property);
-
- const result = {
- label,
- property,
- control: getControl(property),
- items: keywords.map((keyword) => ({ label: keyword, name: keyword })),
- };
-
- styleConfigCache.set(property, result);
-
- return result;
-};
diff --git a/apps/builder/app/builder/features/style-panel/shared/shadow-content.tsx b/apps/builder/app/builder/features/style-panel/shared/shadow-content.tsx
index 3411a85c7b..ae0c32b77e 100644
--- a/apps/builder/app/builder/features/style-panel/shared/shadow-content.tsx
+++ b/apps/builder/app/builder/features/style-panel/shared/shadow-content.tsx
@@ -11,6 +11,7 @@ import {
} from "@webstudio-is/css-engine";
import {
extractShadowProperties,
+ keywordValues,
propertySyntaxes,
type ExtractedShadowProperties,
} from "@webstudio-is/css-data";
@@ -40,7 +41,6 @@ import {
parseCssFragment,
} from "./css-fragment";
import { PropertyInlineLabel } from "../property-label";
-import { styleConfigByName } from "./configs";
import { ColorPicker } from "./color-picker";
/*
@@ -327,9 +327,9 @@ export const ShadowContent = ({
value={colorControlProp}
currentColor={colorControlProp}
getOptions={() =>
- styleConfigByName("color").items.map((item) => ({
+ keywordValues["color"].map((value) => ({
type: "keyword",
- value: item.name,
+ value,
}))
}
onChange={(styleValue) =>
diff --git a/apps/builder/app/builder/shared/css-editor/add-style-input.tsx b/apps/builder/app/builder/shared/css-editor/add-style-input.tsx
index 8322f24677..c652dfca2d 100644
--- a/apps/builder/app/builder/shared/css-editor/add-style-input.tsx
+++ b/apps/builder/app/builder/shared/css-editor/add-style-input.tsx
@@ -25,7 +25,6 @@ import {
import {
cssWideKeywords,
generateStyleMap,
- hyphenateProperty,
mergeStyles,
toValue,
type StyleProperty,
@@ -78,19 +77,17 @@ const getAutocompleteItems = () => {
const ignoreValues = new Set([...cssWideKeywords, ...keywordValues.color]);
- for (const property in keywordValues) {
- const values = keywordValues[property as keyof typeof keywordValues];
- for (const value of values) {
+ for (const [property, values] of Object.entries(keywordValues)) {
+ for (const value of values ?? []) {
if (ignoreValues.has(value)) {
continue;
}
- const hyphenatedProperty = hyphenateProperty(property);
autoCompleteItems.push({
// Allow matching "gr te co" -> "grid-template-columns"
- key: `${hyphenatedProperty.replaceAll("-", " ")} ${value}`,
- property: hyphenatedProperty,
+ key: `${property.replaceAll("-", " ")} ${value}`,
+ property,
value,
- label: `${hyphenatedProperty}: ${value}`,
+ label: `${property}: ${value}`,
});
}
}
diff --git a/apps/builder/app/builder/shared/css-editor/css-editor.tsx b/apps/builder/app/builder/shared/css-editor/css-editor.tsx
index baf166a49a..3b7b697b71 100644
--- a/apps/builder/app/builder/shared/css-editor/css-editor.tsx
+++ b/apps/builder/app/builder/shared/css-editor/css-editor.tsx
@@ -24,6 +24,7 @@ import {
} from "@webstudio-is/design-system";
import {
camelCaseProperty,
+ keywordValues,
propertiesData,
propertyDescriptions,
} from "@webstudio-is/css-data";
@@ -34,7 +35,6 @@ import {
} from "@webstudio-is/css-engine";
// @todo all style panel stuff needs to be moved to shared and/or decoupled from style panel
import { CssValueInputContainer } from "../../features/style-panel/shared/css-value-input";
-import { styleConfigByName } from "../../features/style-panel/shared/configs";
import { $availableVariables } from "../../features/style-panel/shared/model";
import { PropertyInfo } from "../../features/style-panel/property-label";
import { ColorPopover } from "../../features/style-panel/shared/color-picker";
@@ -163,9 +163,9 @@ const AdvancedPropertyValue = ({
property={styleDecl.property}
styleSource={styleDecl.source.name}
getOptions={() => [
- ...styleConfigByName(styleDecl.property).items.map((item) => ({
+ ...(keywordValues[styleDecl.property] ?? []).map((value) => ({
type: "keyword" as const,
- value: item.name,
+ value,
})),
...$availableVariables.get(),
]}
diff --git a/apps/builder/app/canvas/features/webstudio-component/get-browser-style.ts b/apps/builder/app/canvas/features/webstudio-component/get-browser-style.ts
index b61864f60b..b75c820592 100644
--- a/apps/builder/app/canvas/features/webstudio-component/get-browser-style.ts
+++ b/apps/builder/app/canvas/features/webstudio-component/get-browser-style.ts
@@ -18,9 +18,7 @@ const parseValue = (property: CssProperty, value: string): StyleValue => {
value = "transparent";
}
if (Number.isNaN(number)) {
- const values = keywordValues[
- camelCaseProperty(property) as keyof typeof keywordValues
- ] as ReadonlyArray<string>;
+ const values = keywordValues[property];
if (values?.includes(value)) {
return {
diff --git a/packages/css-data/bin/mdn-data.ts b/packages/css-data/bin/mdn-data.ts
index eefdeffdd2..ba52b25ac7 100755
--- a/packages/css-data/bin/mdn-data.ts
+++ b/packages/css-data/bin/mdn-data.ts
@@ -14,8 +14,8 @@ import {
type UnitValue,
type UnparsedValue,
type FontFamilyValue,
- hyphenateProperty,
type CssProperty,
+ hyphenateProperty,
} from "@webstudio-is/css-engine";
import * as customData from "../src/custom-data";
import { camelCaseProperty } from "../src/parse-css";
@@ -411,9 +411,7 @@ const getKeywordValues = (filteredProperties: FilteredProperties) => {
keywords.add(commonKeyword);
}
- if (keywords.size !== 0) {
- result[key] = [...(result[key] ?? []), ...keywords];
- }
+ result[key] = [...(result[key] ?? []), ...keywords];
}
return result;
@@ -467,21 +465,32 @@ type PropertyData = {
initial: StyleValue,
mdnUrl?: string
}
-type Properties = Record<__HyphenatedProperty, PropertyData> & Record<\`--\${string}\`, undefined>
+type Properties =
+ Record<__HyphenatedProperty, PropertyData> &
+ Record<\`--\${string}\`, undefined>
export const properties: Properties = ${JSON.stringify(propertiesData, null, 2)}
`;
writeFileSync(join(targetDir, "properties.ts"), propertiesContent);
+const keywordValues = Object.fromEntries(
+ Object.entries(getKeywordValues(filteredData.allLonghands)).map(
+ ([property, data]) => [hyphenateProperty(property), data]
+ )
+);
+const keywordValuesContent = `${autogeneratedHint}
+import type { __HyphenatedProperty } from "@webstudio-is/css-engine"
+type KeywordValues =
+ Record<__HyphenatedProperty, string[]> &
+ Record<\`--\${string}\`, undefined>
+export const keywordValues: KeywordValues = ${JSON.stringify(keywordValues, null, 2)}
+`;
+writeFileSync(join(targetDir, "keyword-values.ts"), keywordValuesContent);
+
writeToFile(
"shorthand-properties.ts",
"shorthandProperties",
Object.keys(filteredData.allShorthands)
);
-writeToFile(
- "keyword-values.ts",
- "keywordValues",
- getKeywordValues(filteredData.allLonghands)
-);
writeToFile(
"animatable-properties.ts",
"animatableProperties",
diff --git a/packages/css-data/bin/property-value-descriptions.ts b/packages/css-data/bin/property-value-descriptions.ts
index faab843505..fe41bb2ea6 100755
--- a/packages/css-data/bin/property-value-descriptions.ts
+++ b/packages/css-data/bin/property-value-descriptions.ts
@@ -199,7 +199,7 @@ Object.entries(keywordValues)
// Slice to generate only X - useful for testing.
// .slice(0, 10)
.forEach(([keyword, values]) => {
- return values.forEach((value) => {
+ values?.forEach((value) => {
const descriptionKey = `${keyword}:${value}`;
if (
!forceRegenerate &&
diff --git a/packages/css-data/src/__generated__/keyword-values.ts b/packages/css-data/src/__generated__/keyword-values.ts
index 1d341c95cc..e19427582b 100644
--- a/packages/css-data/src/__generated__/keyword-values.ts
+++ b/packages/css-data/src/__generated__/keyword-values.ts
@@ -1,9 +1,21 @@
// This file was generated by pnpm mdn-data
-export const keywordValues = {
- WebkitFontSmoothing: ["auto", "none", "antialiased", "subpixel-antialiased"],
- MozOsxFontSmoothing: ["auto", "grayscale"],
+
+import type { __HyphenatedProperty } from "@webstudio-is/css-engine";
+type KeywordValues = Record<__HyphenatedProperty, string[]> &
+ Record<`--${string}`, undefined>;
+export const keywordValues: KeywordValues = {
+ "-webkit-font-smoothing": [
+ "auto",
+ "none",
+ "antialiased",
+ "subpixel-antialiased",
+ ],
+ "-moz-osx-font-smoothing": ["auto", "grayscale"],
"-webkit-box-orient": ["horizontal", "vertical"],
- listStyleType: [
+ "view-timeline-name": [],
+ "scroll-timeline-name": [],
+ "view-timeline-inset": [],
+ "list-style-type": [
"disc",
"circle",
"square",
@@ -16,7 +28,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- textWrapMode: ["wrap", "nowrap", "initial", "inherit", "unset"],
+ "text-wrap-mode": ["wrap", "nowrap", "initial", "inherit", "unset"],
"-webkit-line-clamp": ["none", "initial", "inherit", "unset"],
"-webkit-overflow-scrolling": [
"auto",
@@ -180,7 +192,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- accentColor: [
+ "accent-color": [
"auto",
"transparent",
"aliceblue",
@@ -336,7 +348,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- alignContent: [
+ "align-content": [
"normal",
"first",
"last",
@@ -356,7 +368,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- alignItems: [
+ "align-items": [
"normal",
"stretch",
"first",
@@ -375,7 +387,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- alignSelf: [
+ "align-self": [
"auto",
"normal",
"stretch",
@@ -395,8 +407,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- animationDelay: ["initial", "inherit", "unset"],
- animationDirection: [
+ "animation-delay": ["initial", "inherit", "unset"],
+ "animation-direction": [
"normal",
"reverse",
"alternate",
@@ -405,8 +417,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- animationDuration: ["initial", "inherit", "unset"],
- animationFillMode: [
+ "animation-duration": ["initial", "inherit", "unset"],
+ "animation-fill-mode": [
"none",
"forwards",
"backwards",
@@ -415,10 +427,10 @@ export const keywordValues = {
"inherit",
"unset",
],
- animationIterationCount: ["infinite", "initial", "inherit", "unset"],
- animationName: ["none", "initial", "inherit", "unset"],
- animationPlayState: ["running", "paused", "initial", "inherit", "unset"],
- animationTimingFunction: [
+ "animation-iteration-count": ["infinite", "initial", "inherit", "unset"],
+ "animation-name": ["none", "initial", "inherit", "unset"],
+ "animation-play-state": ["running", "paused", "initial", "inherit", "unset"],
+ "animation-timing-function": [
"linear",
"ease",
"ease-in",
@@ -451,10 +463,10 @@ export const keywordValues = {
"inherit",
"unset",
],
- aspectRatio: ["auto", "initial", "inherit", "unset"],
- backdropFilter: ["none", "initial", "inherit", "unset"],
- backfaceVisibility: ["visible", "hidden", "initial", "inherit", "unset"],
- backgroundAttachment: [
+ "aspect-ratio": ["auto", "initial", "inherit", "unset"],
+ "backdrop-filter": ["none", "initial", "inherit", "unset"],
+ "backface-visibility": ["visible", "hidden", "initial", "inherit", "unset"],
+ "background-attachment": [
"scroll",
"fixed",
"local",
@@ -462,7 +474,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- backgroundBlendMode: [
+ "background-blend-mode": [
"normal",
"multiply",
"screen",
@@ -483,7 +495,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- backgroundClip: [
+ "background-clip": [
"border-box",
"padding-box",
"content-box",
@@ -492,7 +504,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- backgroundColor: [
+ "background-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -647,8 +659,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- backgroundImage: ["none", "initial", "inherit", "unset"],
- backgroundOrigin: [
+ "background-image": ["none", "initial", "inherit", "unset"],
+ "background-origin": [
"border-box",
"padding-box",
"content-box",
@@ -656,7 +668,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- backgroundPositionX: [
+ "background-position-x": [
"center",
"left",
"right",
@@ -666,7 +678,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- backgroundPositionY: [
+ "background-position-y": [
"center",
"top",
"bottom",
@@ -676,7 +688,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- backgroundRepeat: [
+ "background-repeat": [
"repeat-x",
"repeat-y",
"repeat",
@@ -687,8 +699,15 @@ export const keywordValues = {
"inherit",
"unset",
],
- backgroundSize: ["auto", "cover", "contain", "initial", "inherit", "unset"],
- blockSize: [
+ "background-size": [
+ "auto",
+ "cover",
+ "contain",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "block-size": [
"auto",
"min-content",
"max-content",
@@ -697,7 +716,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderBlockColor: [
+ "border-block-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -852,7 +871,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderBlockStyle: [
+ "border-block-style": [
"none",
"hidden",
"dotted",
@@ -867,8 +886,15 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderBlockWidth: ["thin", "medium", "thick", "initial", "inherit", "unset"],
- borderBlockEndColor: [
+ "border-block-width": [
+ "thin",
+ "medium",
+ "thick",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "border-block-end-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -1023,7 +1049,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderBlockEndStyle: [
+ "border-block-end-style": [
"none",
"hidden",
"dotted",
@@ -1038,7 +1064,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderBlockEndWidth: [
+ "border-block-end-width": [
"thin",
"medium",
"thick",
@@ -1046,7 +1072,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderBlockStartColor: [
+ "border-block-start-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -1201,7 +1227,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderBlockStartStyle: [
+ "border-block-start-style": [
"none",
"hidden",
"dotted",
@@ -1216,7 +1242,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderBlockStartWidth: [
+ "border-block-start-width": [
"thin",
"medium",
"thick",
@@ -1224,7 +1250,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderBottomColor: [
+ "border-bottom-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -1379,9 +1405,9 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderBottomLeftRadius: ["initial", "inherit", "unset"],
- borderBottomRightRadius: ["initial", "inherit", "unset"],
- borderBottomStyle: [
+ "border-bottom-left-radius": ["initial", "inherit", "unset"],
+ "border-bottom-right-radius": ["initial", "inherit", "unset"],
+ "border-bottom-style": [
"none",
"hidden",
"dotted",
@@ -1396,12 +1422,19 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderBottomWidth: ["thin", "medium", "thick", "initial", "inherit", "unset"],
- borderCollapse: ["collapse", "separate", "initial", "inherit", "unset"],
- borderEndEndRadius: ["initial", "inherit", "unset"],
- borderEndStartRadius: ["initial", "inherit", "unset"],
- borderImageOutset: ["initial", "inherit", "unset"],
- borderImageRepeat: [
+ "border-bottom-width": [
+ "thin",
+ "medium",
+ "thick",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "border-collapse": ["collapse", "separate", "initial", "inherit", "unset"],
+ "border-end-end-radius": ["initial", "inherit", "unset"],
+ "border-end-start-radius": ["initial", "inherit", "unset"],
+ "border-image-outset": ["initial", "inherit", "unset"],
+ "border-image-repeat": [
"stretch",
"repeat",
"round",
@@ -1410,10 +1443,10 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderImageSlice: ["fill", "initial", "inherit", "unset"],
- borderImageSource: ["none", "initial", "inherit", "unset"],
- borderImageWidth: ["auto", "initial", "inherit", "unset"],
- borderInlineColor: [
+ "border-image-slice": ["fill", "initial", "inherit", "unset"],
+ "border-image-source": ["none", "initial", "inherit", "unset"],
+ "border-image-width": ["auto", "initial", "inherit", "unset"],
+ "border-inline-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -1568,7 +1601,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderInlineStyle: [
+ "border-inline-style": [
"none",
"hidden",
"dotted",
@@ -1583,8 +1616,15 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderInlineWidth: ["thin", "medium", "thick", "initial", "inherit", "unset"],
- borderInlineEndColor: [
+ "border-inline-width": [
+ "thin",
+ "medium",
+ "thick",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "border-inline-end-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -1739,7 +1779,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderInlineEndStyle: [
+ "border-inline-end-style": [
"none",
"hidden",
"dotted",
@@ -1754,7 +1794,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderInlineEndWidth: [
+ "border-inline-end-width": [
"thin",
"medium",
"thick",
@@ -1762,7 +1802,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderInlineStartColor: [
+ "border-inline-start-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -1917,7 +1957,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderInlineStartStyle: [
+ "border-inline-start-style": [
"none",
"hidden",
"dotted",
@@ -1932,7 +1972,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderInlineStartWidth: [
+ "border-inline-start-width": [
"thin",
"medium",
"thick",
@@ -1940,7 +1980,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderLeftColor: [
+ "border-left-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -2095,7 +2135,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderLeftStyle: [
+ "border-left-style": [
"none",
"hidden",
"dotted",
@@ -2110,8 +2150,15 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderLeftWidth: ["thin", "medium", "thick", "initial", "inherit", "unset"],
- borderRightColor: [
+ "border-left-width": [
+ "thin",
+ "medium",
+ "thick",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "border-right-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -2266,7 +2313,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderRightStyle: [
+ "border-right-style": [
"none",
"hidden",
"dotted",
@@ -2281,11 +2328,18 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderRightWidth: ["thin", "medium", "thick", "initial", "inherit", "unset"],
- borderSpacing: ["initial", "inherit", "unset"],
- borderStartEndRadius: ["initial", "inherit", "unset"],
- borderStartStartRadius: ["initial", "inherit", "unset"],
- borderTopColor: [
+ "border-right-width": [
+ "thin",
+ "medium",
+ "thick",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "border-spacing": ["initial", "inherit", "unset"],
+ "border-start-end-radius": ["initial", "inherit", "unset"],
+ "border-start-start-radius": ["initial", "inherit", "unset"],
+ "border-top-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -2440,9 +2494,9 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderTopLeftRadius: ["initial", "inherit", "unset"],
- borderTopRightRadius: ["initial", "inherit", "unset"],
- borderTopStyle: [
+ "border-top-left-radius": ["initial", "inherit", "unset"],
+ "border-top-right-radius": ["initial", "inherit", "unset"],
+ "border-top-style": [
"none",
"hidden",
"dotted",
@@ -2457,10 +2511,17 @@ export const keywordValues = {
"inherit",
"unset",
],
- borderTopWidth: ["thin", "medium", "thick", "initial", "inherit", "unset"],
+ "border-top-width": [
+ "thin",
+ "medium",
+ "thick",
+ "initial",
+ "inherit",
+ "unset",
+ ],
bottom: ["auto", "initial", "inherit", "unset"],
- boxDecorationBreak: ["slice", "clone", "initial", "inherit", "unset"],
- boxShadow: [
+ "box-decoration-break": ["slice", "clone", "initial", "inherit", "unset"],
+ "box-shadow": [
"none",
"inset",
"transparent",
@@ -2617,8 +2678,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- boxSizing: ["content-box", "border-box", "initial", "inherit", "unset"],
- breakAfter: [
+ "box-sizing": ["content-box", "border-box", "initial", "inherit", "unset"],
+ "break-after": [
"auto",
"avoid",
"always",
@@ -2637,7 +2698,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- breakBefore: [
+ "break-before": [
"auto",
"avoid",
"always",
@@ -2656,7 +2717,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- breakInside: [
+ "break-inside": [
"auto",
"avoid",
"avoid-page",
@@ -2666,7 +2727,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- captionSide: [
+ "caption-side": [
"top",
"bottom",
"block-start",
@@ -2677,7 +2738,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- caretColor: [
+ "caret-color": [
"auto",
"transparent",
"aliceblue",
@@ -2845,7 +2906,7 @@ export const keywordValues = {
"unset",
],
clip: ["auto", "initial", "inherit", "unset"],
- clipPath: [
+ "clip-path": [
"border-box",
"padding-box",
"content-box",
@@ -3013,7 +3074,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- colorScheme: [
+ "color-scheme": [
"normal",
"light",
"dark",
@@ -3022,10 +3083,17 @@ export const keywordValues = {
"inherit",
"unset",
],
- columnCount: ["auto", "initial", "inherit", "unset"],
- columnFill: ["auto", "balance", "balance-all", "initial", "inherit", "unset"],
- columnGap: ["normal", "initial", "inherit", "unset"],
- columnRuleColor: [
+ "column-count": ["auto", "initial", "inherit", "unset"],
+ "column-fill": [
+ "auto",
+ "balance",
+ "balance-all",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "column-gap": ["normal", "initial", "inherit", "unset"],
+ "column-rule-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -3180,7 +3248,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- columnRuleStyle: [
+ "column-rule-style": [
"none",
"hidden",
"dotted",
@@ -3195,9 +3263,16 @@ export const keywordValues = {
"inherit",
"unset",
],
- columnRuleWidth: ["thin", "medium", "thick", "initial", "inherit", "unset"],
- columnSpan: ["none", "all", "initial", "inherit", "unset"],
- columnWidth: ["auto", "initial", "inherit", "unset"],
+ "column-rule-width": [
+ "thin",
+ "medium",
+ "thick",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "column-span": ["none", "all", "initial", "inherit", "unset"],
+ "column-width": ["auto", "initial", "inherit", "unset"],
contain: [
"none",
"strict",
@@ -3211,12 +3286,24 @@ export const keywordValues = {
"inherit",
"unset",
],
- containIntrinsicBlockSize: ["auto", "none", "initial", "inherit", "unset"],
- containIntrinsicHeight: ["auto", "none", "initial", "inherit", "unset"],
- containIntrinsicInlineSize: ["auto", "none", "initial", "inherit", "unset"],
- containIntrinsicWidth: ["auto", "none", "initial", "inherit", "unset"],
- containerName: ["none", "initial", "inherit", "unset"],
- containerType: [
+ "contain-intrinsic-block-size": [
+ "auto",
+ "none",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "contain-intrinsic-height": ["auto", "none", "initial", "inherit", "unset"],
+ "contain-intrinsic-inline-size": [
+ "auto",
+ "none",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "contain-intrinsic-width": ["auto", "none", "initial", "inherit", "unset"],
+ "container-name": ["none", "initial", "inherit", "unset"],
+ "container-type": [
"normal",
"size",
"inline-size",
@@ -3236,7 +3323,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- contentVisibility: [
+ "content-visibility": [
"visible",
"auto",
"hidden",
@@ -3244,9 +3331,9 @@ export const keywordValues = {
"inherit",
"unset",
],
- counterIncrement: ["none", "initial", "inherit", "unset"],
- counterReset: ["none", "initial", "inherit", "unset"],
- counterSet: ["none", "initial", "inherit", "unset"],
+ "counter-increment": ["none", "initial", "inherit", "unset"],
+ "counter-reset": ["none", "initial", "inherit", "unset"],
+ "counter-set": ["none", "initial", "inherit", "unset"],
cursor: [
"auto",
"default",
@@ -3323,10 +3410,10 @@ export const keywordValues = {
"inherit",
"unset",
],
- emptyCells: ["show", "hide", "initial", "inherit", "unset"],
- fieldSizing: ["content", "fixed", "initial", "inherit", "unset"],
+ "empty-cells": ["show", "hide", "initial", "inherit", "unset"],
+ "field-sizing": ["content", "fixed", "initial", "inherit", "unset"],
filter: ["none", "initial", "inherit", "unset"],
- flexBasis: [
+ "flex-basis": [
"content",
"auto",
"min-content",
@@ -3336,7 +3423,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- flexDirection: [
+ "flex-direction": [
"row",
"row-reverse",
"column",
@@ -3345,9 +3432,16 @@ export const keywordValues = {
"inherit",
"unset",
],
- flexGrow: ["initial", "inherit", "unset"],
- flexShrink: ["initial", "inherit", "unset"],
- flexWrap: ["nowrap", "wrap", "wrap-reverse", "initial", "inherit", "unset"],
+ "flex-grow": ["initial", "inherit", "unset"],
+ "flex-shrink": ["initial", "inherit", "unset"],
+ "flex-wrap": [
+ "nowrap",
+ "wrap",
+ "wrap-reverse",
+ "initial",
+ "inherit",
+ "unset",
+ ],
float: [
"left",
"right",
@@ -3358,7 +3452,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- fontFamily: [
+ "font-family": [
"serif",
"sans-serif",
"cursive",
@@ -3368,12 +3462,19 @@ export const keywordValues = {
"inherit",
"unset",
],
- fontFeatureSettings: ["normal", "on", "off", "initial", "inherit", "unset"],
- fontKerning: ["auto", "normal", "none", "initial", "inherit", "unset"],
- fontLanguageOverride: ["normal", "initial", "inherit", "unset"],
- fontOpticalSizing: ["auto", "none", "initial", "inherit", "unset"],
- fontVariationSettings: ["normal", "initial", "inherit", "unset"],
- fontSize: [
+ "font-feature-settings": [
+ "normal",
+ "on",
+ "off",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "font-kerning": ["auto", "normal", "none", "initial", "inherit", "unset"],
+ "font-language-override": ["normal", "initial", "inherit", "unset"],
+ "font-optical-sizing": ["auto", "none", "initial", "inherit", "unset"],
+ "font-variation-settings": ["normal", "initial", "inherit", "unset"],
+ "font-size": [
"xx-small",
"x-small",
"small",
@@ -3388,7 +3489,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- fontSizeAdjust: [
+ "font-size-adjust": [
"none",
"ex-height",
"cap-height",
@@ -3400,7 +3501,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- fontStretch: [
+ "font-stretch": [
"normal",
"ultra-condensed",
"extra-condensed",
@@ -3414,18 +3515,18 @@ export const keywordValues = {
"inherit",
"unset",
],
- fontStyle: ["normal", "italic", "oblique", "initial", "inherit", "unset"],
- fontSynthesisSmallCaps: ["auto", "none", "initial", "inherit", "unset"],
- fontSynthesisStyle: ["auto", "none", "initial", "inherit", "unset"],
- fontSynthesisWeight: ["auto", "none", "initial", "inherit", "unset"],
- fontVariantAlternates: [
+ "font-style": ["normal", "italic", "oblique", "initial", "inherit", "unset"],
+ "font-synthesis-small-caps": ["auto", "none", "initial", "inherit", "unset"],
+ "font-synthesis-style": ["auto", "none", "initial", "inherit", "unset"],
+ "font-synthesis-weight": ["auto", "none", "initial", "inherit", "unset"],
+ "font-variant-alternates": [
"normal",
"historical-forms",
"initial",
"inherit",
"unset",
],
- fontVariantCaps: [
+ "font-variant-caps": [
"normal",
"small-caps",
"all-small-caps",
@@ -3437,7 +3538,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- fontVariantEastAsian: [
+ "font-variant-east-asian": [
"normal",
"jis78",
"jis83",
@@ -3452,7 +3553,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- fontVariantLigatures: [
+ "font-variant-ligatures": [
"normal",
"none",
"common-ligatures",
@@ -3467,7 +3568,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- fontVariantNumeric: [
+ "font-variant-numeric": [
"normal",
"lining-nums",
"oldstyle-nums",
@@ -3481,7 +3582,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- fontVariantPosition: [
+ "font-variant-position": [
"normal",
"sub",
"super",
@@ -3489,7 +3590,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- fontWeight: [
+ "font-weight": [
"normal",
"bold",
"bolder",
@@ -3498,7 +3599,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- gridAutoColumns: [
+ "grid-auto-columns": [
"min-content",
"max-content",
"auto",
@@ -3506,8 +3607,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- gridAutoFlow: ["row", "column", "dense", "initial", "inherit", "unset"],
- gridAutoRows: [
+ "grid-auto-flow": ["row", "column", "dense", "initial", "inherit", "unset"],
+ "grid-auto-rows": [
"min-content",
"max-content",
"auto",
@@ -3515,12 +3616,12 @@ export const keywordValues = {
"inherit",
"unset",
],
- gridColumnEnd: ["auto", "span", "initial", "inherit", "unset"],
- gridColumnStart: ["auto", "span", "initial", "inherit", "unset"],
- gridRowEnd: ["auto", "span", "initial", "inherit", "unset"],
- gridRowStart: ["auto", "span", "initial", "inherit", "unset"],
- gridTemplateAreas: ["none", "initial", "inherit", "unset"],
- gridTemplateColumns: [
+ "grid-column-end": ["auto", "span", "initial", "inherit", "unset"],
+ "grid-column-start": ["auto", "span", "initial", "inherit", "unset"],
+ "grid-row-end": ["auto", "span", "initial", "inherit", "unset"],
+ "grid-row-start": ["auto", "span", "initial", "inherit", "unset"],
+ "grid-template-areas": ["none", "initial", "inherit", "unset"],
+ "grid-template-columns": [
"none",
"min-content",
"max-content",
@@ -3530,7 +3631,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- gridTemplateRows: [
+ "grid-template-rows": [
"none",
"min-content",
"max-content",
@@ -3540,7 +3641,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- hangingPunctuation: [
+ "hanging-punctuation": [
"none",
"first",
"force-end",
@@ -3559,11 +3660,11 @@ export const keywordValues = {
"inherit",
"unset",
],
- hyphenateCharacter: ["auto", "initial", "inherit", "unset"],
- hyphenateLimitChars: ["auto", "initial", "inherit", "unset"],
+ "hyphenate-character": ["auto", "initial", "inherit", "unset"],
+ "hyphenate-limit-chars": ["auto", "initial", "inherit", "unset"],
hyphens: ["none", "manual", "auto", "initial", "inherit", "unset"],
- imageOrientation: ["from-image", "flip", "initial", "inherit", "unset"],
- imageRendering: [
+ "image-orientation": ["from-image", "flip", "initial", "inherit", "unset"],
+ "image-rendering": [
"auto",
"crisp-edges",
"pixelated",
@@ -3571,7 +3672,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- inlineSize: [
+ "inline-size": [
"auto",
"min-content",
"max-content",
@@ -3580,12 +3681,12 @@ export const keywordValues = {
"inherit",
"unset",
],
- insetBlockEnd: ["auto", "initial", "inherit", "unset"],
- insetBlockStart: ["auto", "initial", "inherit", "unset"],
- insetInlineEnd: ["auto", "initial", "inherit", "unset"],
- insetInlineStart: ["auto", "initial", "inherit", "unset"],
+ "inset-block-end": ["auto", "initial", "inherit", "unset"],
+ "inset-block-start": ["auto", "initial", "inherit", "unset"],
+ "inset-inline-end": ["auto", "initial", "inherit", "unset"],
+ "inset-inline-start": ["auto", "initial", "inherit", "unset"],
isolation: ["auto", "isolate", "initial", "inherit", "unset"],
- justifyContent: [
+ "justify-content": [
"normal",
"space-between",
"space-around",
@@ -3604,7 +3705,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- justifyItems: [
+ "justify-items": [
"normal",
"stretch",
"first",
@@ -3626,7 +3727,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- justifySelf: [
+ "justify-self": [
"auto",
"normal",
"stretch",
@@ -3649,8 +3750,8 @@ export const keywordValues = {
"unset",
],
left: ["auto", "initial", "inherit", "unset"],
- letterSpacing: ["normal", "initial", "inherit", "unset"],
- lineBreak: [
+ "letter-spacing": ["normal", "initial", "inherit", "unset"],
+ "line-break": [
"auto",
"loose",
"normal",
@@ -3660,20 +3761,20 @@ export const keywordValues = {
"inherit",
"unset",
],
- lineHeight: ["normal", "initial", "inherit", "unset"],
- listStyleImage: ["none", "initial", "inherit", "unset"],
- listStylePosition: ["inside", "outside", "initial", "inherit", "unset"],
- marginBlockEnd: ["auto", "initial", "inherit", "unset"],
- marginBlockStart: ["auto", "initial", "inherit", "unset"],
- marginBottom: ["auto", "initial", "inherit", "unset"],
- marginInlineEnd: ["auto", "initial", "inherit", "unset"],
- marginInlineStart: ["auto", "initial", "inherit", "unset"],
- marginLeft: ["auto", "initial", "inherit", "unset"],
- marginRight: ["auto", "initial", "inherit", "unset"],
- marginTop: ["auto", "initial", "inherit", "unset"],
- maskBorderMode: ["luminance", "alpha", "initial", "inherit", "unset"],
- maskBorderOutset: ["initial", "inherit", "unset"],
- maskBorderRepeat: [
+ "line-height": ["normal", "initial", "inherit", "unset"],
+ "list-style-image": ["none", "initial", "inherit", "unset"],
+ "list-style-position": ["inside", "outside", "initial", "inherit", "unset"],
+ "margin-block-end": ["auto", "initial", "inherit", "unset"],
+ "margin-block-start": ["auto", "initial", "inherit", "unset"],
+ "margin-bottom": ["auto", "initial", "inherit", "unset"],
+ "margin-inline-end": ["auto", "initial", "inherit", "unset"],
+ "margin-inline-start": ["auto", "initial", "inherit", "unset"],
+ "margin-left": ["auto", "initial", "inherit", "unset"],
+ "margin-right": ["auto", "initial", "inherit", "unset"],
+ "margin-top": ["auto", "initial", "inherit", "unset"],
+ "mask-border-mode": ["luminance", "alpha", "initial", "inherit", "unset"],
+ "mask-border-outset": ["initial", "inherit", "unset"],
+ "mask-border-repeat": [
"stretch",
"repeat",
"round",
@@ -3682,10 +3783,10 @@ export const keywordValues = {
"inherit",
"unset",
],
- maskBorderSlice: ["fill", "initial", "inherit", "unset"],
- maskBorderSource: ["none", "initial", "inherit", "unset"],
- maskBorderWidth: ["auto", "initial", "inherit", "unset"],
- maskClip: [
+ "mask-border-slice": ["fill", "initial", "inherit", "unset"],
+ "mask-border-source": ["none", "initial", "inherit", "unset"],
+ "mask-border-width": ["auto", "initial", "inherit", "unset"],
+ "mask-clip": [
"border-box",
"padding-box",
"content-box",
@@ -3698,7 +3799,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- maskComposite: [
+ "mask-composite": [
"add",
"subtract",
"intersect",
@@ -3707,8 +3808,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- maskImage: ["none", "initial", "inherit", "unset"],
- maskMode: [
+ "mask-image": ["none", "initial", "inherit", "unset"],
+ "mask-mode": [
"alpha",
"luminance",
"match-source",
@@ -3716,7 +3817,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- maskOrigin: [
+ "mask-origin": [
"border-box",
"padding-box",
"content-box",
@@ -3728,7 +3829,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- maskPosition: [
+ "mask-position": [
"left",
"center",
"right",
@@ -3738,7 +3839,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- maskRepeat: [
+ "mask-repeat": [
"repeat-x",
"repeat-y",
"repeat",
@@ -3749,12 +3850,12 @@ export const keywordValues = {
"inherit",
"unset",
],
- maskSize: ["auto", "cover", "contain", "initial", "inherit", "unset"],
- maskType: ["luminance", "alpha", "initial", "inherit", "unset"],
- mathDepth: ["auto-add", "initial", "inherit", "unset"],
- mathShift: ["normal", "compact", "initial", "inherit", "unset"],
- mathStyle: ["normal", "compact", "initial", "inherit", "unset"],
- maxBlockSize: [
+ "mask-size": ["auto", "cover", "contain", "initial", "inherit", "unset"],
+ "mask-type": ["luminance", "alpha", "initial", "inherit", "unset"],
+ "math-depth": ["auto-add", "initial", "inherit", "unset"],
+ "math-shift": ["normal", "compact", "initial", "inherit", "unset"],
+ "math-style": ["normal", "compact", "initial", "inherit", "unset"],
+ "max-block-size": [
"none",
"min-content",
"max-content",
@@ -3763,7 +3864,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- maxHeight: [
+ "max-height": [
"none",
"min-content",
"max-content",
@@ -3772,7 +3873,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- maxInlineSize: [
+ "max-inline-size": [
"none",
"min-content",
"max-content",
@@ -3781,7 +3882,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- maxWidth: [
+ "max-width": [
"none",
"min-content",
"max-content",
@@ -3790,7 +3891,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- minBlockSize: [
+ "min-block-size": [
"auto",
"min-content",
"max-content",
@@ -3799,7 +3900,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- minHeight: [
+ "min-height": [
"auto",
"min-content",
"max-content",
@@ -3808,7 +3909,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- minInlineSize: [
+ "min-inline-size": [
"auto",
"min-content",
"max-content",
@@ -3817,7 +3918,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- minWidth: [
+ "min-width": [
"auto",
"min-content",
"max-content",
@@ -3826,7 +3927,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- mixBlendMode: [
+ "mix-blend-mode": [
"normal",
"multiply",
"screen",
@@ -3848,7 +3949,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- objectFit: [
+ "object-fit": [
"fill",
"contain",
"cover",
@@ -3858,7 +3959,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- objectPosition: [
+ "object-position": [
"left",
"center",
"right",
@@ -3868,7 +3969,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- offsetAnchor: [
+ "offset-anchor": [
"auto",
"left",
"center",
@@ -3879,9 +3980,9 @@ export const keywordValues = {
"inherit",
"unset",
],
- offsetDistance: ["initial", "inherit", "unset"],
- offsetPath: ["none", "initial", "inherit", "unset"],
- offsetPosition: [
+ "offset-distance": ["initial", "inherit", "unset"],
+ "offset-path": ["none", "initial", "inherit", "unset"],
+ "offset-position": [
"normal",
"auto",
"left",
@@ -3893,11 +3994,11 @@ export const keywordValues = {
"inherit",
"unset",
],
- offsetRotate: ["auto", "reverse", "initial", "inherit", "unset"],
+ "offset-rotate": ["auto", "reverse", "initial", "inherit", "unset"],
opacity: ["initial", "inherit", "unset"],
order: ["initial", "inherit", "unset"],
orphans: ["initial", "inherit", "unset"],
- outlineColor: [
+ "outline-color": [
"auto",
"transparent",
"aliceblue",
@@ -4053,8 +4154,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- outlineOffset: ["initial", "inherit", "unset"],
- outlineStyle: [
+ "outline-offset": ["initial", "inherit", "unset"],
+ "outline-style": [
"auto",
"none",
"hidden",
@@ -4070,8 +4171,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- outlineWidth: ["thin", "medium", "thick", "initial", "inherit", "unset"],
- overflowWrap: [
+ "outline-width": ["thin", "medium", "thick", "initial", "inherit", "unset"],
+ "overflow-wrap": [
"normal",
"break-word",
"anywhere",
@@ -4079,7 +4180,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- overflowX: [
+ "overflow-x": [
"visible",
"hidden",
"clip",
@@ -4089,7 +4190,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- overflowY: [
+ "overflow-y": [
"visible",
"hidden",
"clip",
@@ -4099,7 +4200,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- overscrollBehavior: [
+ "overscroll-behavior": [
"contain",
"none",
"auto",
@@ -4107,7 +4208,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- overscrollBehaviorBlock: [
+ "overscroll-behavior-block": [
"contain",
"none",
"auto",
@@ -4115,7 +4216,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- overscrollBehaviorInline: [
+ "overscroll-behavior-inline": [
"contain",
"none",
"auto",
@@ -4123,7 +4224,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- overscrollBehaviorX: [
+ "overscroll-behavior-x": [
"contain",
"none",
"auto",
@@ -4131,7 +4232,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- overscrollBehaviorY: [
+ "overscroll-behavior-y": [
"contain",
"none",
"auto",
@@ -4139,16 +4240,16 @@ export const keywordValues = {
"inherit",
"unset",
],
- paddingBlockEnd: ["initial", "inherit", "unset"],
- paddingBlockStart: ["initial", "inherit", "unset"],
- paddingBottom: ["initial", "inherit", "unset"],
- paddingInlineEnd: ["initial", "inherit", "unset"],
- paddingInlineStart: ["initial", "inherit", "unset"],
- paddingLeft: ["initial", "inherit", "unset"],
- paddingRight: ["initial", "inherit", "unset"],
- paddingTop: ["initial", "inherit", "unset"],
+ "padding-block-end": ["initial", "inherit", "unset"],
+ "padding-block-start": ["initial", "inherit", "unset"],
+ "padding-bottom": ["initial", "inherit", "unset"],
+ "padding-inline-end": ["initial", "inherit", "unset"],
+ "padding-inline-start": ["initial", "inherit", "unset"],
+ "padding-left": ["initial", "inherit", "unset"],
+ "padding-right": ["initial", "inherit", "unset"],
+ "padding-top": ["initial", "inherit", "unset"],
page: ["auto", "initial", "inherit", "unset"],
- pageBreakAfter: [
+ "page-break-after": [
"auto",
"always",
"avoid",
@@ -4160,7 +4261,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- pageBreakBefore: [
+ "page-break-before": [
"auto",
"always",
"avoid",
@@ -4172,8 +4273,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- pageBreakInside: ["auto", "avoid", "initial", "inherit", "unset"],
- paintOrder: [
+ "page-break-inside": ["auto", "avoid", "initial", "inherit", "unset"],
+ "paint-order": [
"normal",
"fill",
"stroke",
@@ -4183,7 +4284,7 @@ export const keywordValues = {
"unset",
],
perspective: ["none", "initial", "inherit", "unset"],
- perspectiveOrigin: [
+ "perspective-origin": [
"left",
"center",
"right",
@@ -4193,7 +4294,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- pointerEvents: [
+ "pointer-events": [
"auto",
"none",
"visiblePainted",
@@ -4218,7 +4319,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- printColorAdjust: ["economy", "exact", "initial", "inherit", "unset"],
+ "print-color-adjust": ["economy", "exact", "initial", "inherit", "unset"],
quotes: ["none", "auto", "initial", "inherit", "unset"],
resize: [
"none",
@@ -4233,9 +4334,9 @@ export const keywordValues = {
],
right: ["auto", "initial", "inherit", "unset"],
rotate: ["none", "x", "y", "z", "initial", "inherit", "unset"],
- rowGap: ["normal", "initial", "inherit", "unset"],
+ "row-gap": ["normal", "initial", "inherit", "unset"],
scale: ["none", "initial", "inherit", "unset"],
- scrollbarColor: [
+ "scrollbar-color": [
"auto",
"transparent",
"aliceblue",
@@ -4391,7 +4492,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- scrollbarGutter: [
+ "scrollbar-gutter": [
"auto",
"stable",
"both-edges",
@@ -4399,25 +4500,25 @@ export const keywordValues = {
"inherit",
"unset",
],
- scrollbarWidth: ["auto", "thin", "none", "initial", "inherit", "unset"],
- scrollBehavior: ["auto", "smooth", "initial", "inherit", "unset"],
- scrollMarginBlockStart: ["initial", "inherit", "unset"],
- scrollMarginBlockEnd: ["initial", "inherit", "unset"],
- scrollMarginBottom: ["initial", "inherit", "unset"],
- scrollMarginInlineStart: ["initial", "inherit", "unset"],
- scrollMarginInlineEnd: ["initial", "inherit", "unset"],
- scrollMarginLeft: ["initial", "inherit", "unset"],
- scrollMarginRight: ["initial", "inherit", "unset"],
- scrollMarginTop: ["initial", "inherit", "unset"],
- scrollPaddingBlockStart: ["auto", "initial", "inherit", "unset"],
- scrollPaddingBlockEnd: ["auto", "initial", "inherit", "unset"],
- scrollPaddingBottom: ["auto", "initial", "inherit", "unset"],
- scrollPaddingInlineStart: ["auto", "initial", "inherit", "unset"],
- scrollPaddingInlineEnd: ["auto", "initial", "inherit", "unset"],
- scrollPaddingLeft: ["auto", "initial", "inherit", "unset"],
- scrollPaddingRight: ["auto", "initial", "inherit", "unset"],
- scrollPaddingTop: ["auto", "initial", "inherit", "unset"],
- scrollSnapAlign: [
+ "scrollbar-width": ["auto", "thin", "none", "initial", "inherit", "unset"],
+ "scroll-behavior": ["auto", "smooth", "initial", "inherit", "unset"],
+ "scroll-margin-block-start": ["initial", "inherit", "unset"],
+ "scroll-margin-block-end": ["initial", "inherit", "unset"],
+ "scroll-margin-bottom": ["initial", "inherit", "unset"],
+ "scroll-margin-inline-start": ["initial", "inherit", "unset"],
+ "scroll-margin-inline-end": ["initial", "inherit", "unset"],
+ "scroll-margin-left": ["initial", "inherit", "unset"],
+ "scroll-margin-right": ["initial", "inherit", "unset"],
+ "scroll-margin-top": ["initial", "inherit", "unset"],
+ "scroll-padding-block-start": ["auto", "initial", "inherit", "unset"],
+ "scroll-padding-block-end": ["auto", "initial", "inherit", "unset"],
+ "scroll-padding-bottom": ["auto", "initial", "inherit", "unset"],
+ "scroll-padding-inline-start": ["auto", "initial", "inherit", "unset"],
+ "scroll-padding-inline-end": ["auto", "initial", "inherit", "unset"],
+ "scroll-padding-left": ["auto", "initial", "inherit", "unset"],
+ "scroll-padding-right": ["auto", "initial", "inherit", "unset"],
+ "scroll-padding-top": ["auto", "initial", "inherit", "unset"],
+ "scroll-snap-align": [
"none",
"start",
"end",
@@ -4426,8 +4527,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- scrollSnapStop: ["normal", "always", "initial", "inherit", "unset"],
- scrollSnapType: [
+ "scroll-snap-stop": ["normal", "always", "initial", "inherit", "unset"],
+ "scroll-snap-type": [
"none",
"x",
"y",
@@ -4440,9 +4541,9 @@ export const keywordValues = {
"inherit",
"unset",
],
- shapeImageThreshold: ["initial", "inherit", "unset"],
- shapeMargin: ["initial", "inherit", "unset"],
- shapeOutside: [
+ "shape-image-threshold": ["initial", "inherit", "unset"],
+ "shape-margin": ["initial", "inherit", "unset"],
+ "shape-outside": [
"none",
"border-box",
"padding-box",
@@ -4452,9 +4553,9 @@ export const keywordValues = {
"inherit",
"unset",
],
- tabSize: ["initial", "inherit", "unset"],
- tableLayout: ["auto", "fixed", "initial", "inherit", "unset"],
- textAlign: [
+ "tab-size": ["initial", "inherit", "unset"],
+ "table-layout": ["auto", "fixed", "initial", "inherit", "unset"],
+ "text-align": [
"start",
"end",
"left",
@@ -4466,7 +4567,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- textAlignLast: [
+ "text-align-last": [
"auto",
"start",
"end",
@@ -4478,8 +4579,15 @@ export const keywordValues = {
"inherit",
"unset",
],
- textCombineUpright: ["none", "all", "digits", "initial", "inherit", "unset"],
- textDecorationColor: [
+ "text-combine-upright": [
+ "none",
+ "all",
+ "digits",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "text-decoration-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -4634,7 +4742,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- textDecorationLine: [
+ "text-decoration-line": [
"none",
"underline",
"overline",
@@ -4646,8 +4754,15 @@ export const keywordValues = {
"inherit",
"unset",
],
- textDecorationSkipInk: ["auto", "all", "none", "initial", "inherit", "unset"],
- textDecorationStyle: [
+ "text-decoration-skip-ink": [
+ "auto",
+ "all",
+ "none",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "text-decoration-style": [
"solid",
"double",
"dotted",
@@ -4657,8 +4772,14 @@ export const keywordValues = {
"inherit",
"unset",
],
- textDecorationThickness: ["auto", "from-font", "initial", "inherit", "unset"],
- textEmphasisColor: [
+ "text-decoration-thickness": [
+ "auto",
+ "from-font",
+ "initial",
+ "inherit",
+ "unset",
+ ],
+ "text-emphasis-color": [
"transparent",
"aliceblue",
"antiquewhite",
@@ -4813,7 +4934,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- textEmphasisPosition: [
+ "text-emphasis-position": [
"over",
"under",
"right",
@@ -4822,7 +4943,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- textEmphasisStyle: [
+ "text-emphasis-style": [
"none",
"filled",
"open",
@@ -4835,8 +4956,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- textIndent: ["hanging", "each-line", "initial", "inherit", "unset"],
- textJustify: [
+ "text-indent": ["hanging", "each-line", "initial", "inherit", "unset"],
+ "text-justify": [
"auto",
"inter-character",
"inter-word",
@@ -4845,7 +4966,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- textOrientation: [
+ "text-orientation": [
"mixed",
"upright",
"sideways",
@@ -4853,8 +4974,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- textOverflow: ["clip", "ellipsis", "initial", "inherit", "unset"],
- textRendering: [
+ "text-overflow": ["clip", "ellipsis", "initial", "inherit", "unset"],
+ "text-rendering": [
"auto",
"optimizeSpeed",
"optimizeLegibility",
@@ -4863,7 +4984,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- textShadow: [
+ "text-shadow": [
"none",
"transparent",
"aliceblue",
@@ -5019,8 +5140,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- textSizeAdjust: ["none", "auto", "initial", "inherit", "unset"],
- textTransform: [
+ "text-size-adjust": ["none", "auto", "initial", "inherit", "unset"],
+ "text-transform": [
"none",
"capitalize",
"uppercase",
@@ -5031,8 +5152,8 @@ export const keywordValues = {
"inherit",
"unset",
],
- textUnderlineOffset: ["auto", "initial", "inherit", "unset"],
- textUnderlinePosition: [
+ "text-underline-offset": ["auto", "initial", "inherit", "unset"],
+ "text-underline-position": [
"auto",
"from-font",
"under",
@@ -5042,7 +5163,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- textWrapStyle: [
+ "text-wrap-style": [
"auto",
"balance",
"stable",
@@ -5052,7 +5173,7 @@ export const keywordValues = {
"unset",
],
top: ["auto", "initial", "inherit", "unset"],
- touchAction: [
+ "touch-action": [
"auto",
"none",
"pan-x",
@@ -5068,7 +5189,7 @@ export const keywordValues = {
"unset",
],
transform: ["none", "initial", "inherit", "unset"],
- transformBox: [
+ "transform-box": [
"content-box",
"border-box",
"fill-box",
@@ -5078,7 +5199,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- transformOrigin: [
+ "transform-origin": [
"left",
"center",
"right",
@@ -5088,18 +5209,18 @@ export const keywordValues = {
"inherit",
"unset",
],
- transformStyle: ["flat", "preserve-3d", "initial", "inherit", "unset"],
- transitionBehavior: [
+ "transform-style": ["flat", "preserve-3d", "initial", "inherit", "unset"],
+ "transition-behavior": [
"normal",
"allow-discrete",
"initial",
"inherit",
"unset",
],
- transitionDelay: ["initial", "inherit", "unset"],
- transitionDuration: ["initial", "inherit", "unset"],
- transitionProperty: ["none", "all", "initial", "inherit", "unset"],
- transitionTimingFunction: [
+ "transition-delay": ["initial", "inherit", "unset"],
+ "transition-duration": ["initial", "inherit", "unset"],
+ "transition-property": ["none", "all", "initial", "inherit", "unset"],
+ "transition-timing-function": [
"linear",
"ease",
"ease-in",
@@ -5112,7 +5233,7 @@ export const keywordValues = {
"unset",
],
translate: ["none", "initial", "inherit", "unset"],
- unicodeBidi: [
+ "unicode-bidi": [
"normal",
"embed",
"isolate",
@@ -5123,7 +5244,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- userSelect: [
+ "user-select": [
"auto",
"text",
"none",
@@ -5133,7 +5254,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- verticalAlign: [
+ "vertical-align": [
"baseline",
"sub",
"super",
@@ -5147,7 +5268,7 @@ export const keywordValues = {
"unset",
],
visibility: ["visible", "hidden", "collapse", "initial", "inherit", "unset"],
- whiteSpaceCollapse: [
+ "white-space-collapse": [
"collapse",
"discard",
"preserve",
@@ -5168,7 +5289,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- willChange: [
+ "will-change": [
"auto",
"scroll-position",
"contents",
@@ -5176,7 +5297,7 @@ export const keywordValues = {
"inherit",
"unset",
],
- wordBreak: [
+ "word-break": [
"normal",
"break-all",
"keep-all",
@@ -5185,9 +5306,9 @@ export const keywordValues = {
"inherit",
"unset",
],
- wordSpacing: ["normal", "initial", "inherit", "unset"],
- wordWrap: ["normal", "break-word", "initial", "inherit", "unset"],
- writingMode: [
+ "word-spacing": ["normal", "initial", "inherit", "unset"],
+ "word-wrap": ["normal", "break-word", "initial", "inherit", "unset"],
+ "writing-mode": [
"horizontal-tb",
"vertical-rl",
"vertical-lr",
@@ -5197,6 +5318,6 @@ export const keywordValues = {
"inherit",
"unset",
],
- zIndex: ["auto", "initial", "inherit", "unset"],
+ "z-index": ["auto", "initial", "inherit", "unset"],
zoom: ["normal", "reset", "initial", "inherit", "unset"],
-} as const;
+};
diff --git a/packages/css-data/src/custom-data.ts b/packages/css-data/src/custom-data.ts
index 50b29abef4..8da6140578 100644
--- a/packages/css-data/src/custom-data.ts
+++ b/packages/css-data/src/custom-data.ts
@@ -85,6 +85,7 @@ propertiesData.viewTimelineName = {
},
mdnUrl: "https://developer.mozilla.org/en-US/docs/Web/CSS/view-timeline-name",
};
+keywordValues.viewTimelineName = [];
propertiesData.scrollTimelineName = {
unitGroups: [],
inherited: false,
@@ -95,6 +96,7 @@ propertiesData.scrollTimelineName = {
mdnUrl:
"https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-timeline-name",
};
+keywordValues.scrollTimelineName = [];
propertiesData.viewTimelineInset = {
unitGroups: ["length", "percentage"],
@@ -106,6 +108,7 @@ propertiesData.viewTimelineInset = {
mdnUrl:
"https://developer.mozilla.org/en-US/docs/Web/CSS/view-timeline-inset",
};
+keywordValues.viewTimelineInset = [];
keywordValues.listStyleType = [
"disc",
diff --git a/packages/css-data/src/parse-css-value.ts b/packages/css-data/src/parse-css-value.ts
index efbe722a0d..36d21625da 100644
--- a/packages/css-data/src/parse-css-value.ts
+++ b/packages/css-data/src/parse-css-value.ts
@@ -21,7 +21,6 @@ import {
} from "@webstudio-is/css-engine";
import { keywordValues } from "./__generated__/keyword-values";
import { units } from "./__generated__/units";
-import { camelCaseProperty } from "./parse-css";
export const cssTryParseValue = (input: string): undefined | CssNode => {
try {
@@ -59,20 +58,12 @@ export const isValidDeclaration = (
// these properties have poor support natively and in csstree
// though rendered styles are merged as shorthand
// so validate artifically
- if (cssPropertyName === "white-space-collapse") {
- return keywordValues.whiteSpaceCollapse.includes(
- value as (typeof keywordValues.whiteSpaceCollapse)[0]
- );
- }
- if (cssPropertyName === "text-wrap-mode") {
- return keywordValues.textWrapMode.includes(
- value as (typeof keywordValues.textWrapMode)[0]
- );
- }
- if (cssPropertyName === "text-wrap-style") {
- return keywordValues.textWrapStyle.includes(
- value as (typeof keywordValues.textWrapStyle)[0]
- );
+ if (
+ cssPropertyName === "white-space-collapse" ||
+ cssPropertyName === "text-wrap-mode" ||
+ cssPropertyName === "text-wrap-style"
+ ) {
+ return keywordValues[cssPropertyName].includes(value);
}
if (cssPropertyName === "transition-behavior") {
@@ -431,10 +422,7 @@ export const parseCssValue = (
// so check keywords manually
if (property === "transition-behavior") {
const node = ast.type === "Value" ? ast.children.first : ast;
- const keyword = parseLiteral(
- node,
- keywordValues[camelCaseProperty(property) as never]
- );
+ const keyword = parseLiteral(node, keywordValues[property]);
if (keyword?.type === "keyword") {
return keyword;
}
@@ -471,10 +459,7 @@ export const parseCssValue = (
if (node.type === "Operator") {
return { type: "unparsed", value: input };
}
- const matchedValue = parseLiteral(
- node,
- keywordValues[camelCaseProperty(property) as never]
- );
+ const matchedValue = parseLiteral(node, keywordValues[property]);
if (matchedValue) {
tuple.value.push(matchedValue as never);
} else {
@@ -487,10 +472,7 @@ export const parseCssValue = (
if (ast.type === "Value" && ast.children.size === 1) {
// Try extract units from 1st children
const first = ast.children.first;
- const matchedValue = parseLiteral(
- first,
- keywordValues[camelCaseProperty(property) as never]
- );
+ const matchedValue = parseLiteral(first, keywordValues[property]);
if (matchedValue) {
return matchedValue;
}