@@ -29,11 +29,12 @@ import {
2929 toValue ,
3030 type CssProperty ,
3131} from "@webstudio-is/css-engine" ;
32+ import { composeEventHandlers } from "~/shared/event-utils" ;
3233import {
3334 deleteProperty ,
3435 setProperty ,
35- } from "../.. /features/style-panel/shared/use-style-data" ;
36- import { composeEventHandlers } from "~/shared/event-utils " ;
36+ } from "~/builder /features/style-panel/shared/use-style-data" ;
37+ import { $availableVariables } from "~/builder/features/style-panel/shared/model " ;
3738import { parseStyleInput } from "./parse-style-input" ;
3839
3940type SearchItem = {
@@ -43,19 +44,27 @@ type SearchItem = {
4344 key : string ;
4445} ;
4546
46- const autoCompleteItems : Array < SearchItem > = [ ] ;
47-
4847const getNewPropertyDescription = ( item : null | SearchItem ) => {
49- let description : string | undefined = `Create CSS variable.` ;
50- if ( item && item . property in propertyDescriptions ) {
48+ let description : string | undefined = "Add CSS property." ;
49+ if ( item ?. property . startsWith ( "--" ) ) {
50+ description = "Create CSS variable." ;
51+ }
52+ if ( item && propertyDescriptions [ item . property ] ) {
5153 description = propertyDescriptions [ item . property ] ;
5254 }
5355 return < Box css = { { width : theme . spacing [ 28 ] } } > { description } </ Box > ;
5456} ;
5557
5658const getAutocompleteItems = ( ) => {
57- if ( autoCompleteItems . length > 0 ) {
58- return autoCompleteItems ;
59+ const autoCompleteItems : SearchItem [ ] = [ ] ;
60+ for ( const varValue of $availableVariables . get ( ) ) {
61+ const property = `--${ varValue . value } ` ;
62+ autoCompleteItems . push ( {
63+ // consider additional properties to be custom properties
64+ key : property ,
65+ property,
66+ label : property ,
67+ } ) ;
5968 }
6069 for ( const property in propertiesData ) {
6170 autoCompleteItems . push ( {
0 commit comments