@startupjs/docs 0.39.11 → 0.40.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/components/Props/index.js +26 -11
- package/package.json +5 -5
|
@@ -2,26 +2,41 @@ import React, { useMemo, useState } from 'react'
|
|
|
2
2
|
import { ScrollView } from 'react-native'
|
|
3
3
|
import { observer, $root, useComponentId } from 'startupjs'
|
|
4
4
|
import { themed, Button, Row, Div } from '@startupjs/ui'
|
|
5
|
-
import
|
|
5
|
+
import parsePropTypesModule from 'parse-prop-types'
|
|
6
6
|
import Constructor from './Constructor'
|
|
7
7
|
import Renderer from './Renderer'
|
|
8
8
|
import './index.styl'
|
|
9
9
|
|
|
10
|
+
const parsePropTypes = parsePropTypesModule.default || parsePropTypesModule
|
|
11
|
+
if (!parsePropTypes) throw Error('> Can\'t load parse-prop-types module. Issues with bundling')
|
|
12
|
+
|
|
10
13
|
function useEntries ({ Component, props, extraParams }) {
|
|
11
14
|
return useMemo(() => {
|
|
12
15
|
const propTypes = parsePropTypes(Component)
|
|
13
16
|
const entries = Object.entries(propTypes)
|
|
14
|
-
|
|
17
|
+
|
|
18
|
+
const res = parseEntries(entries)
|
|
15
19
|
.filter(entry => entry.name[0] !== '_') // skip private properties
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
|
|
21
|
+
for (const key in props) {
|
|
22
|
+
const item = res.find(item => item.name === key)
|
|
23
|
+
if (item) {
|
|
24
|
+
item.value = props[key]
|
|
25
|
+
} else {
|
|
26
|
+
res.push({
|
|
27
|
+
name: key,
|
|
28
|
+
type: typeof props[key],
|
|
29
|
+
value: props[key]
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
for (const key in extraParams) {
|
|
35
|
+
const item = res.find(item => item.name === key)
|
|
36
|
+
if (item) item.extraParams = extraParams[key]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return res
|
|
25
40
|
}, [])
|
|
26
41
|
}
|
|
27
42
|
|
package/package.json
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"description": "MDX documentation generator",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.40.3",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@fortawesome/free-solid-svg-icons": "^5.12.0",
|
|
12
|
-
"@startupjs/mdx": "^0.
|
|
13
|
-
"@startupjs/scrollable-anchors": "^0.
|
|
14
|
-
"@startupjs/ui": "^0.
|
|
12
|
+
"@startupjs/mdx": "^0.40.3",
|
|
13
|
+
"@startupjs/scrollable-anchors": "^0.40.3",
|
|
14
|
+
"@startupjs/ui": "^0.40.3",
|
|
15
15
|
"parse-prop-types": "^0.3.0"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"react-native": ">= 0.61.4 < 0.64.0",
|
|
20
20
|
"startupjs": ">= 0.33.0"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "838e03d291f41426877d87aaf910fbda54c11973"
|
|
23
23
|
}
|