88 SerializableBooleanCondition ,
99 SerializableStringCondition ,
1010 SerializableStyleRule ,
11- SerializableToken ,
1211} from "@adaptive-web/adaptive-ui" ;
1312import { AdditionalDataKeys , type PluginUINodeData } from "@adaptive-web/adaptive-ui-designer-core" ;
1413
@@ -55,32 +54,23 @@ export class StringCondition extends Condition {
5554 }
5655}
5756
58- export class Token {
59- constructor (
60- public target : string ,
61- public tokenID : string ,
62- ) { }
63-
64- toJSON ( ) : SerializableToken {
65- return {
66- target : this . target ,
67- tokenID : this . tokenID ,
68- } ;
69- }
70- }
71-
7257export class StyleRule {
7358 contextCondition ?: Record < string , string | boolean > ;
7459 part ?: string ;
7560 styles : Set < string > = new Set ( ) ;
76- tokens : Set < Token > = new Set ( ) ;
61+ properties : Map < string , string > = new Map ( ) ;
7762
7863 toJSON ( ) : SerializableStyleRule {
64+ const properties = this . properties . size === 0 ? undefined : Array . from ( this . properties . entries ( ) ) . reduce ( ( prev , next ) => {
65+ prev [ next [ 0 ] ] = next [ 1 ] ;
66+ return prev ;
67+ } , { } as Record < string , string > ) ;
68+
7969 return {
8070 contextCondition : this . contextCondition ,
8171 part : this . part ,
8272 styles : this . styles . size === 0 ? undefined : Array . from ( this . styles ) ,
83- tokens : this . tokens . size === 0 ? undefined : Array . from ( this . tokens ) . map ( token => token . toJSON ( ) ) ,
73+ properties ,
8474 } ;
8575 }
8676}
@@ -96,14 +86,14 @@ export class Anatomy {
9686
9787 toJSON ( ) : SerializableAnatomy {
9888 const conditions = Array . from ( this . conditions . entries ( ) ) . reduce ( ( prev , next ) => {
99- prev [ next [ 0 ] ] = next [ 1 ] . toJSON ( )
100- return prev
101- } , { } as SerializableAnatomy [ "conditions" ] )
89+ prev [ next [ 0 ] ] = next [ 1 ] . toJSON ( ) ;
90+ return prev ;
91+ } , { } as SerializableAnatomy [ "conditions" ] ) ;
10292
10393 const parts = Array . from ( this . parts . entries ( ) ) . reduce ( ( prev , current ) => {
10494 prev [ current [ 0 ] ] = makeClassName ( current [ 1 ] ) ;
10595 return prev ;
106- } , { } as SerializableAnatomy [ "parts" ] )
96+ } , { } as SerializableAnatomy [ "parts" ] ) ;
10797
10898 return {
10999 name : this . name ,
@@ -278,7 +268,7 @@ function walkNode(node: PluginUINodeData, componentName: string, condition: Reco
278268
279269 node . appliedDesignTokens . forEach ( ( token , target ) => {
280270 const tokenRef = token . tokenID ;
281- styleRule . tokens . add ( new Token ( target , tokenRef ) ) ;
271+ styleRule . properties . set ( target , tokenRef ) ;
282272 } ) ;
283273
284274 if ( isNotContextNode ( nodeName , componentName ) ) {
0 commit comments