@@ -7,94 +7,16 @@ import {
77  type  PropsProxy , 
88}  from  '../jsx/jsx-runtime' ; 
99import  type  {  JSXNodeInternal  }  from  '../jsx/types/jsx-node' ; 
10- import  type  {  KnownEventNames  }  from  '../jsx/types/jsx-qwik-events' ; 
1110import  type  {  Container ,  HostElement  }  from  '../types' ; 
1211import  {  _CONST_PROPS ,  _VAR_PROPS  }  from  './constants' ; 
12+ import  {  QDefaultSlot  }  from  './markers' ; 
1313import  { 
14-   createEventName , 
15-   parseEventNameFromIndex , 
16-   isJsxPropertyAnEventName , 
17-   isHtmlAttributeAnEventName , 
18- }  from  './event-names' ; 
19- import  { 
20-   ELEMENT_ID , 
21-   ELEMENT_KEY , 
22-   ELEMENT_PROPS , 
23-   HANDLER_PREFIX , 
24-   NON_SERIALIZABLE_MARKER_PREFIX , 
25-   OnRenderProp , 
26-   QDefaultSlot , 
27-   Q_PREFIX , 
28-   dangerouslySetInnerHTML , 
29-   refAttr , 
30- }  from  './markers' ; 
31- 
32- const  propNameToId  =  new  Map < string  |  symbol ,  NumericPropKey > ( ) ; 
33- const  idToPropName : ( string  |  symbol ) [ ]  =  [ ] ; 
34- export  type  NumericPropKey  =  number  &  {  __brand__ : 'NumericPropKey'  } ; 
35- 
36- const  colonOnLength  =  ':on' . length ; 
37- 
38- export  const  enum  NumericPropKeyFlags  { 
39-   EVENT  =  1 , 
40-   Q_PREFIX  =  2 , 
41-   HANDLER_PREFIX  =  4 , 
42-   SLOT  =  8 , 
43- } 
44- 
45- export  const  NumericFlagsShift  =  4 ; 
46- 
47- export  const  getPropId  =  ( name : string  |  symbol ) : NumericPropKey  =>  { 
48-   let  id  =  propNameToId . get ( name ) ; 
49-   if  ( id  !=  null )  { 
50-     return  id ; 
51-   } 
52-   id  =  ( idToPropName . length  <<  NumericFlagsShift )  as  NumericPropKey ; 
53-   if  ( typeof  name  ===  'string' )  { 
54-     if  ( isJsxPropertyAnEventName ( name ) )  { 
55-       name  =  normalizeEvent ( name ) ; 
56-       ( id  as  number )  |=  NumericPropKeyFlags . EVENT ; 
57-     }  else  if  ( isHtmlAttributeAnEventName ( name ) )  { 
58-       ( id  as  number )  |=  NumericPropKeyFlags . EVENT ; 
59-     }  else  if  ( name . startsWith ( Q_PREFIX ) )  { 
60-       ( id  as  number )  |=  NumericPropKeyFlags . Q_PREFIX ; 
61-     }  else  if  ( name . startsWith ( HANDLER_PREFIX ) )  { 
62-       ( id  as  number )  |=  NumericPropKeyFlags . HANDLER_PREFIX ; 
63-     } 
64- 
65-     if  ( ! name . startsWith ( Q_PREFIX )  &&  ! name . startsWith ( NON_SERIALIZABLE_MARKER_PREFIX ) )  { 
66-       ( id  as  number )  |=  NumericPropKeyFlags . SLOT ; 
67-     } 
68-   } 
69-   idToPropName . push ( name ) ; 
70-   propNameToId . set ( name ,  id ) ; 
71-   return  id ; 
72- } ; 
73- 
74- export  const  StaticPropId  =  { 
75-   // ELEMENT_KEY should be always first, because of `getKey` in vnode_diff.ts 
76-   ELEMENT_KEY : getPropId ( ELEMENT_KEY ) , 
77-   ELEMENT_ID : getPropId ( ELEMENT_ID ) , 
78-   ELEMENT_PROPS : getPropId ( ELEMENT_PROPS ) , 
79-   REF : getPropId ( refAttr ) , 
80-   INNERHTML : getPropId ( dangerouslySetInnerHTML ) , 
81-   VALUE : getPropId ( 'value' ) , 
82-   ON_RENDER : getPropId ( OnRenderProp ) , 
83-   CLASS : getPropId ( 'class' ) , 
84-   CLASS_NAME : getPropId ( 'classname' ) , 
85- } ; 
86- 
87- export  const  getPropName  =  < T  extends  string > ( id : NumericPropKey ) : T  =>  { 
88-   return  idToPropName [ id  >>  NumericFlagsShift ]  as  T ; 
89- } ; 
90- 
91- function  normalizeEvent ( name : string ) : string  { 
92-   const  index  =  name . indexOf ( ':on' ) ; 
93-   const  scope  =  ( name . substring ( 0 ,  index )  ||  undefined )  as  'window'  |  'document'  |  undefined ; 
94-   const  eventName  =  parseEventNameFromIndex ( name ,  index  +  colonOnLength ) ; 
95-   name  =  createEventName ( eventName ,  scope )  as  KnownEventNames ; 
96-   return  name ; 
97- } 
14+   NumericFlagsShift , 
15+   NumericPropKeyFlags , 
16+   getPropId , 
17+   getPropName , 
18+   type  NumericPropKey , 
19+ }  from  './numeric-prop-key' ; 
9820
9921function  getFlags ( id : number )  { 
10022  return  ( ( 1  <<  NumericFlagsShift )  -  1 )  &  ( id  >>  0 ) ; 
@@ -154,8 +76,3 @@ export const _restProps = (props: PropsProxy, omit: string[], target: Props = {}
15476
15577  return  createPropsProxy ( varPropsTarget ,  constPropsTarget ) ; 
15678} ; 
157- 
158- export  const  __testing__  =  { 
159-   propNameToId, 
160-   idToPropName, 
161- } ; 
0 commit comments