@@ -39,7 +39,7 @@ import {
3939import {
4040 $dataSourceVariables ,
4141 $dataSources ,
42- $registeredComponentPropsMetas ,
42+ $registeredComponentMetas ,
4343 $variableValuesByInstanceSelector ,
4444} from "~/shared/nano-states" ;
4545import type { BindingVariant } from "~/builder/shared/binding-popover" ;
@@ -455,62 +455,60 @@ const attributeToMeta = (attribute: Attribute): PropMeta => {
455455} ;
456456
457457export const $selectedInstancePropsMetas = computed (
458- [ $selectedInstance , $registeredComponentPropsMetas , $instanceTags ] ,
459- ( instance , componentPropsMetas , instanceTags ) : Map < string , PropMeta > => {
458+ [ $selectedInstance , $registeredComponentMetas , $instanceTags ] ,
459+ ( instance , metas , instanceTags ) : Map < string , PropMeta > => {
460460 if ( instance === undefined ) {
461461 return new Map ( ) ;
462462 }
463- const propsMetas = componentPropsMetas . get ( instance . component ) ?. props ?? { } ;
463+ const meta = metas . get ( instance . component ) ;
464464 const tag = instanceTags . get ( instance . id ) ;
465- const metas = new Map < Prop [ "name" ] , PropMeta > ( ) ;
465+ const propsMetas = new Map < Prop [ "name" ] , PropMeta > ( ) ;
466466 // add html attributes only when instance has tag
467467 if ( tag ) {
468468 for ( const attribute of [ ...ariaAttributes ] . reverse ( ) ) {
469- metas . set ( attribute . name , attributeToMeta ( attribute ) ) ;
469+ propsMetas . set ( attribute . name , attributeToMeta ( attribute ) ) ;
470470 }
471471 if ( attributesByTag [ "*" ] ) {
472472 for ( const attribute of [ ...attributesByTag [ "*" ] ] . reverse ( ) ) {
473- metas . set ( attribute . name , attributeToMeta ( attribute ) ) ;
473+ propsMetas . set ( attribute . name , attributeToMeta ( attribute ) ) ;
474474 }
475475 }
476476 if ( attributesByTag [ tag ] ) {
477477 for ( const attribute of [ ...attributesByTag [ tag ] ] . reverse ( ) ) {
478- metas . set ( attribute . name , attributeToMeta ( attribute ) ) ;
478+ propsMetas . set ( attribute . name , attributeToMeta ( attribute ) ) ;
479479 }
480480 }
481481 }
482- for ( const [ name , propMeta ] of Object . entries ( propsMetas ) . reverse ( ) ) {
482+ for ( const [ name , propMeta ] of Object . entries (
483+ meta ?. props ?? { }
484+ ) . reverse ( ) ) {
483485 // when component property has the same name as html attribute in react
484486 // override to deduplicate similar properties
485487 // for example component can have own "className" and html has "class"
486488 const htmlName = reactPropsToStandardAttributes [ name ] ;
487489 if ( htmlName ) {
488- metas . delete ( htmlName ) ;
490+ propsMetas . delete ( htmlName ) ;
489491 }
490- metas . set ( name , propMeta ) ;
492+ propsMetas . set ( name , propMeta ) ;
491493 }
492- metas . set ( showAttribute , showAttributeMeta ) ;
494+ propsMetas . set ( showAttribute , showAttributeMeta ) ;
493495 // ui should render in the following order
494496 // 1. system properties
495497 // 2. component properties
496498 // 3. specific tag attributes
497499 // 4. global html attributes
498500 // 5. aria attributes
499- return new Map ( Array . from ( metas . entries ( ) ) . reverse ( ) ) ;
501+ return new Map ( Array . from ( propsMetas . entries ( ) ) . reverse ( ) ) ;
500502 }
501503) ;
502504
503505export const $selectedInstanceInitialPropNames = computed (
504- [
505- $selectedInstance ,
506- $registeredComponentPropsMetas ,
507- $selectedInstancePropsMetas ,
508- ] ,
509- ( selectedInstance , componentPropsMetas , instancePropsMetas ) => {
506+ [ $selectedInstance , $registeredComponentMetas , $selectedInstancePropsMetas ] ,
507+ ( selectedInstance , metas , instancePropsMetas ) => {
510508 const initialPropNames = new Set < string > ( ) ;
511509 if ( selectedInstance ) {
512510 const initialProps =
513- componentPropsMetas . get ( selectedInstance . component ) ?. initialProps ?? [ ] ;
511+ metas . get ( selectedInstance . component ) ?. initialProps ?? [ ] ;
514512 for ( const propName of initialProps ) {
515513 // className -> class
516514 if ( instancePropsMetas . has ( reactPropsToStandardAttributes [ propName ] ) ) {
0 commit comments