@@ -7,19 +7,13 @@ import type { ComputedStyleDecl } from "~/shared/style-object-model";
77import { $computedStyleDeclarations } from "../../shared/model" ;
88import { sections } from "../sections" ;
99
10- // @todo will be fully deleted https://github.com/webstudio-is/webstudio/issues/4871
11- const initialProperties = new Set < CssProperty > ( [
12- "cursor" ,
13- "mix-blend-mode" ,
14- "opacity" ,
15- "pointer-events" ,
16- "user-select" ,
17- ] ) ;
18-
1910export const $advancedStyleDeclarations = computed (
2011 [ $computedStyleDeclarations , $settings , $selectedInstance ] ,
2112 ( computedStyleDeclarations , settings , selectedInstance ) => {
22- const advancedStyles : Array < ComputedStyleDecl > = [ ] ;
13+ const advancedStyles = new Map <
14+ ComputedStyleDecl [ "property" ] ,
15+ ComputedStyleDecl
16+ > ( ) ;
2317 // All properties used by the panels except the advanced panel
2418 const visualProperties = new Set < CssProperty > ( [ ] ) ;
2519 for ( const { properties } of sections . values ( ) ) {
@@ -37,6 +31,14 @@ export const $advancedStyleDeclarations = computed(
3731 ) {
3832 continue ;
3933 }
34+ // ignore predefined styles in advanced mode
35+ // @todo will be deleted https://github.com/webstudio-is/webstudio/issues/4871
36+ if (
37+ styleDecl . source . name === "default" &&
38+ settings . stylePanelMode === "advanced"
39+ ) {
40+ continue ;
41+ }
4042 const { property, listed } = styleDecl ;
4143 // When property is listed, it was added from advanced panel.
4244 // If we are in advanced mode, we show them all.
@@ -45,22 +47,10 @@ export const $advancedStyleDeclarations = computed(
4547 listed ||
4648 settings . stylePanelMode === "advanced"
4749 ) {
48- advancedStyles . push ( styleDecl ) ;
49- }
50- }
51- // In advanced mode we assume user knows the properties they need, so we don't need to show these.
52- // @todo https://github.com/webstudio-is/webstudio/issues/4871
53- if ( settings . stylePanelMode !== "advanced" ) {
54- for ( const property of initialProperties ) {
55- const styleDecl = computedStyleDeclarations . find (
56- ( styleDecl ) => styleDecl . property === property
57- ) ;
58- if ( styleDecl ) {
59- advancedStyles . push ( styleDecl ) ;
60- }
50+ advancedStyles . set ( styleDecl . property , styleDecl ) ;
6151 }
6252 }
6353
64- return advancedStyles ;
54+ return Array . from ( advancedStyles . values ( ) ) ;
6555 }
6656) ;
0 commit comments