File tree Expand file tree Collapse file tree 8 files changed +36
-41
lines changed Expand file tree Collapse file tree 8 files changed +36
-41
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @api-viewer/common ' : patch
3
+ ' @api-viewer/demo ' : patch
4
+ ' @api-viewer/docs ' : patch
5
+ ' @api-viewer/tabs ' : patch
6
+ ' api-viewer-element ' : patch
7
+ ---
8
+
9
+ Update custom-elements-manifest to v2.0.0, add readonly support
Original file line number Diff line number Diff line change 339
339
"name" : " focused" ,
340
340
"type" : {
341
341
"text" : " Element | null"
342
- }
342
+ },
343
+ "readonly" : true
343
344
},
344
345
{
345
346
"kind" : " method" ,
Original file line number Diff line number Diff line change 37
37
},
38
38
"devDependencies" : {
39
39
"@changesets/cli" : " ^2.25.2" ,
40
- "@custom-elements-manifest/analyzer" : " ^0.6.6 " ,
40
+ "@custom-elements-manifest/analyzer" : " ^0.8.0 " ,
41
41
"@size-limit/preset-small-lib" : " ^8.1.0" ,
42
42
"@typescript-eslint/eslint-plugin" : " ^5.46.0" ,
43
43
"@typescript-eslint/parser" : " ^5.46.0" ,
Original file line number Diff line number Diff line change 27
27
" web-components"
28
28
],
29
29
"dependencies" : {
30
- "custom-elements-manifest" : " ^1 .0.0" ,
30
+ "custom-elements-manifest" : " ^2 .0.0" ,
31
31
"lit" : " ^2.0.0" ,
32
32
"tslib" : " ^2.3.1"
33
33
},
Original file line number Diff line number Diff line change 1
1
import type {
2
2
Attribute ,
3
- ClassField ,
3
+ ClassField as ManifestClassField ,
4
4
ClassLike ,
5
5
ClassMember ,
6
6
ClassMethod ,
@@ -15,6 +15,15 @@ import type {
15
15
Slot
16
16
} from 'custom-elements-manifest/schema' ;
17
17
18
+ // FIXME: remove once new custom-elements-manifest version is released
19
+ // https://github.com/webcomponents/custom-elements-manifest/pull/118
20
+ type ClassField = ManifestClassField & {
21
+ /**
22
+ * Whether the property is read-only.
23
+ */
24
+ readonly ?: boolean ;
25
+ } ;
26
+
18
27
export type {
19
28
Attribute ,
20
29
ClassField ,
Original file line number Diff line number Diff line change @@ -206,7 +206,7 @@ class ApiDemoLayout extends LitElement {
206
206
}
207
207
208
208
this . knobs = { } ;
209
- this . propKnobs = getKnobs ( this . tag , this . props , this . exclude ) ;
209
+ this . propKnobs = getKnobs ( this . props , this . exclude ) ;
210
210
this . customKnobs = getCustomKnobs ( this . tag , this . vid ) ;
211
211
}
212
212
}
Original file line number Diff line number Diff line change @@ -18,42 +18,13 @@ const getDefault = (prop: PropertyKnob): KnobValue => {
18
18
}
19
19
} ;
20
20
21
- // TODO: remove when analyzer outputs "readOnly" to JSON
22
- const isGetter = (
23
- ctor : CustomElementConstructor | undefined ,
24
- prop : string
25
- ) : boolean => {
26
- function getDescriptor (
27
- obj : CustomElementConstructor
28
- ) : PropertyDescriptor | undefined {
29
- return obj === HTMLElement
30
- ? undefined
31
- : Object . getOwnPropertyDescriptor ( obj . prototype , prop ) ||
32
- getDescriptor ( Object . getPrototypeOf ( obj ) ) ;
33
- }
34
-
35
- let result = false ;
36
- if ( ctor ) {
37
- const descriptor = getDescriptor ( ctor ) ;
38
- result = Boolean (
39
- descriptor && descriptor . get && descriptor . set === undefined
40
- ) ;
41
- }
42
- return result ;
43
- } ;
44
-
45
21
const normalizeType = ( type : string | undefined = '' ) : string =>
46
22
type . replace ( ' | undefined' , '' ) . replace ( ' | null' , '' ) ;
47
23
48
- export const getKnobs = (
49
- tag : string ,
50
- props : ClassField [ ] ,
51
- exclude = ''
52
- ) : PropertyKnob [ ] => {
24
+ export const getKnobs = ( props : ClassField [ ] , exclude = '' ) : PropertyKnob [ ] => {
53
25
// Exclude getters and specific properties
54
26
let propKnobs = props . filter (
55
- ( { name } ) =>
56
- ! exclude . includes ( name ) && ! isGetter ( customElements . get ( tag ) , name )
27
+ ( { name, readonly } ) => ! exclude . includes ( name ) && ! readonly
57
28
) as PropertyKnob [ ] ;
58
29
59
30
// Set knob types and default knobs values
Original file line number Diff line number Diff line change 1164
1164
resolved "https://registry.yarnpkg.com/@csstools/selector-specificity/-/selector-specificity-2.0.2.tgz#1bfafe4b7ed0f3e4105837e056e0a89b108ebe36"
1165
1165
integrity sha512-IkpVW/ehM1hWKln4fCA3NzJU8KwD+kIOvPZA4cqxoJHtE21CCzjyp+Kxbu0i5I4tBNOlXPL9mjwnWlL0VEG4Fg==
1166
1166
1167
- " @custom-elements-manifest/analyzer@^0.6.6 " :
1168
- version "0.6.6 "
1169
- resolved "https://registry.yarnpkg.com/@custom-elements-manifest/analyzer/-/analyzer-0.6.6 .tgz#52db8a3f6c575821d05694ff5a0295c0cb4bbb07 "
1170
- integrity sha512-aPBZBdkrGcQPhgPPEucgw66vfOfLpS80GOGzDXE8NZuO/VmTdy3QQNAsuD4MPJmv9eRPV9W2V7ezodS5g8erng ==
1167
+ " @custom-elements-manifest/analyzer@^0.8.0 " :
1168
+ version "0.8.4 "
1169
+ resolved "https://registry.yarnpkg.com/@custom-elements-manifest/analyzer/-/analyzer-0.8.4 .tgz#34fce1158a44cb7a9d8c1c7415e8c9d03e25d95f "
1170
+ integrity sha512-hibYFNoqPc/xSH9ySuotOllz3UtQnnbG912oC0RtRwHGilnOVT5zeL3Ip26swCjiuFAp8Y0uLN5DwnMpa/xXYQ ==
1171
1171
dependencies :
1172
1172
" @custom-elements-manifest/find-dependencies" " ^0.0.5"
1173
1173
" @github/catalyst" " ^1.6.0"
@@ -3183,11 +3183,16 @@ csv@^5.5.0:
3183
3183
csv-stringify "^5.6.5"
3184
3184
stream-transform "^2.1.3"
3185
3185
3186
- [email protected] , custom-elements-manifest@^1.0.0 :
3186
+
3187
3187
version "1.0.0"
3188
3188
resolved "https://registry.yarnpkg.com/custom-elements-manifest/-/custom-elements-manifest-1.0.0.tgz#b35c2129076a1dc9f95d720c6f7b5b71a857274b"
3189
3189
integrity sha512-j59k0ExGCKA8T6Mzaq+7axc+KVHwpEphEERU7VZ99260npu/p/9kd+Db+I3cGKxHkM5y6q5gnlXn00mzRQkX2A==
3190
3190
3191
+ custom-elements-manifest@^2.0.0 :
3192
+ version "2.0.0"
3193
+ resolved "https://registry.yarnpkg.com/custom-elements-manifest/-/custom-elements-manifest-2.0.0.tgz#6b234f7a57c68ecda291ea70882555729617de6d"
3194
+ integrity sha512-1MmhBRszwnNYqn56nkMeHXn/Zlh998+6Yal3wedbXI7NzKPG02GDgjspdN1NiuDtt2yb5n94JvFwPOF7Prnocg==
3195
+
3191
3196
date-fns@^2.29.1 :
3192
3197
version "2.29.3"
3193
3198
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8"
You can’t perform that action at this time.
0 commit comments