@variousjs/create 2.0.1 → 3.0.1
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/.eslintignore +1 -1
- package/.gitignore.copy +1 -0
- package/package-lock.json.copy +7558 -3688
- package/package.json +20 -16
- package/package.json.copy +18 -14
- package/public/dist/app.js +2 -0
- package/public/dist/app.js.map +1 -0
- package/public/dist/card.js +2 -0
- package/public/dist/card.js.map +1 -0
- package/public/dist/next.js +2 -0
- package/public/dist/next.js.map +1 -0
- package/public/dist/top.js +2 -0
- package/public/dist/top.js.map +1 -0
- package/public/index.html +48 -0
- package/src/{entry → components/app}/actions.ts +2 -2
- package/src/components/app/container.less +45 -0
- package/src/{entry → components/app}/container.tsx +17 -20
- package/src/components/app/error.tsx +14 -0
- package/src/components/app/index.ts +16 -0
- package/src/{entry → components/app}/loader.tsx +1 -2
- package/src/components/card/index.tsx +42 -0
- package/src/components/next/index.tsx +54 -0
- package/src/components/top/index.tsx +29 -0
- package/src/declaration.d.ts +0 -26
- package/src/index.html +14 -0
- package/src/types.ts +2 -2
- package/tsconfig.json +4 -2
- package/various.config.js +85 -0
- package/webpack/{entry.js → app.js} +2 -2
- package/webpack/base.js +28 -39
- package/webpack/component.js +2 -2
- package/demo/dist/card.js +0 -2
- package/demo/dist/card.js.map +0 -1
- package/demo/dist/entry.js +0 -2
- package/demo/dist/entry.js.map +0 -1
- package/demo/dist/next.js +0 -2
- package/demo/dist/next.js.map +0 -1
- package/demo/dist/top.js +0 -2
- package/demo/dist/top.js.map +0 -1
- package/demo/index.html +0 -62
- package/src/components/card.less +0 -3
- package/src/components/card.tsx +0 -52
- package/src/components/next.tsx +0 -49
- package/src/components/top.tsx +0 -55
- package/src/entry/entry.less +0 -9
- package/src/entry/error.tsx +0 -19
- package/src/entry/index.ts +0 -5
- /package/src/{entry → components/app}/store.ts +0 -0
- /package/src/components/{i18n → next/i18n}/en.json +0 -0
- /package/src/components/{i18n → next/i18n}/zh.json +0 -0
package/src/components/card.less
DELETED
package/src/components/card.tsx
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React, { FC } from 'react'
|
|
2
|
-
import { ComponentProps, Invoker } from '@variousjs/various'
|
|
3
|
-
import { useParams } from 'react-router-dom'
|
|
4
|
-
import { Card, Button, message } from 'antd'
|
|
5
|
-
import { Store } from '../types'
|
|
6
|
-
import csses from './card.less'
|
|
7
|
-
|
|
8
|
-
const H: FC<ComponentProps<Store>> & { getName: Invoker } = (props) => {
|
|
9
|
-
const { id } = useParams<{ id: string }>()
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<div className={csses.container}>
|
|
13
|
-
<Card
|
|
14
|
-
hoverable
|
|
15
|
-
style={{ width: 240 }}
|
|
16
|
-
cover={<img alt="example" src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png" />}
|
|
17
|
-
actions={[
|
|
18
|
-
id ? <Button
|
|
19
|
-
key="next"
|
|
20
|
-
onClick={() => props.$dispatch('next', 'setValue', 1)}
|
|
21
|
-
>
|
|
22
|
-
Next
|
|
23
|
-
</Button> : <Button
|
|
24
|
-
key="locale"
|
|
25
|
-
onClick={() => props.$dispatch('store', 'setLocale', props.$store.locale === 'zh' ? 'en' : 'zh')}
|
|
26
|
-
>
|
|
27
|
-
locale
|
|
28
|
-
</Button>,
|
|
29
|
-
<Button
|
|
30
|
-
key="store"
|
|
31
|
-
type="primary"
|
|
32
|
-
onClick={async () => {
|
|
33
|
-
await props.$dispatch('store', 'setName', `${Math.random().toFixed(2)}`)
|
|
34
|
-
message.info('changed')
|
|
35
|
-
}}
|
|
36
|
-
>
|
|
37
|
-
Store
|
|
38
|
-
</Button>
|
|
39
|
-
]}
|
|
40
|
-
>
|
|
41
|
-
<Card.Meta
|
|
42
|
-
title="Route Params"
|
|
43
|
-
description={id || 'none'}
|
|
44
|
-
/>
|
|
45
|
-
</Card>
|
|
46
|
-
</div>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
H.getName = (e) => message.info(e)
|
|
51
|
-
|
|
52
|
-
export default H
|
package/src/components/next.tsx
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react'
|
|
2
|
-
import { ComponentProps, Store, Invoker, Ii8n } from '@variousjs/various'
|
|
3
|
-
import { Descriptions } from 'antd'
|
|
4
|
-
import { Store as GlobalStore } from '../types'
|
|
5
|
-
import zh from './i18n/zh.json'
|
|
6
|
-
import en from './i18n/en.json'
|
|
7
|
-
|
|
8
|
-
type S = { value: number }
|
|
9
|
-
|
|
10
|
-
const {
|
|
11
|
-
createStore,
|
|
12
|
-
connect,
|
|
13
|
-
emit,
|
|
14
|
-
getStore,
|
|
15
|
-
} = new Store<S>()
|
|
16
|
-
|
|
17
|
-
createStore({ value: 0 })
|
|
18
|
-
|
|
19
|
-
class X extends Component<S & ComponentProps<GlobalStore>> {
|
|
20
|
-
static setValue: Invoker = async (value) => {
|
|
21
|
-
const store = getStore()
|
|
22
|
-
emit({ value: value + store.value }, true)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static $i18n: Ii8n = () => ({
|
|
26
|
-
localeKey: 'locale',
|
|
27
|
-
resources: { zh, en },
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
render() {
|
|
31
|
-
const { user } = this.props.$store
|
|
32
|
-
const { value, $t } = this.props
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Descriptions
|
|
36
|
-
style={{ marginTop: 30 }}
|
|
37
|
-
bordered
|
|
38
|
-
title="Next Component"
|
|
39
|
-
size="small"
|
|
40
|
-
>
|
|
41
|
-
<Descriptions.Item label="Store">{user.name}</Descriptions.Item>
|
|
42
|
-
<Descriptions.Item label="Value">{value}</Descriptions.Item>
|
|
43
|
-
<Descriptions.Item label="Title">{$t('title', { name: 'various' })}</Descriptions.Item>
|
|
44
|
-
</Descriptions>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export default connect('value')(X)
|
package/src/components/top.tsx
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React, { FC, useState, useEffect } from 'react'
|
|
2
|
-
import { ComponentProps, getConfig } from '@variousjs/various'
|
|
3
|
-
import { useLocation, useHistory } from 'react-router-dom'
|
|
4
|
-
import { Radio, Badge, Button } from 'antd'
|
|
5
|
-
import { Config, Store } from '../types'
|
|
6
|
-
|
|
7
|
-
const H: FC<ComponentProps<Store>> = (props) => {
|
|
8
|
-
const $config = getConfig() as Config
|
|
9
|
-
const { pathname } = useLocation()
|
|
10
|
-
const history = useHistory()
|
|
11
|
-
const [path, setPath] = useState('')
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
setPath(pathname)
|
|
15
|
-
}, [])
|
|
16
|
-
|
|
17
|
-
const onRouterChange = (e: any) => {
|
|
18
|
-
history.push(e.target.value)
|
|
19
|
-
setPath(e.target.value)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<>
|
|
24
|
-
<Radio.Group
|
|
25
|
-
size="large"
|
|
26
|
-
value={path}
|
|
27
|
-
onChange={onRouterChange}
|
|
28
|
-
buttonStyle="solid"
|
|
29
|
-
>
|
|
30
|
-
{
|
|
31
|
-
$config.links.map(({ path, name }) => (
|
|
32
|
-
<Radio.Button key={path} value={path}>
|
|
33
|
-
{name}
|
|
34
|
-
</Radio.Button>
|
|
35
|
-
))
|
|
36
|
-
}
|
|
37
|
-
</Radio.Group>
|
|
38
|
-
<div>
|
|
39
|
-
Store:
|
|
40
|
-
<Badge
|
|
41
|
-
style={{ marginLeft: 10 }}
|
|
42
|
-
count={props.$store.user.name}
|
|
43
|
-
/>
|
|
44
|
-
<Button
|
|
45
|
-
style={{ marginLeft: 10 }}
|
|
46
|
-
onClick={() => props.$dispatch('card', 'getName', 'Card')}
|
|
47
|
-
>
|
|
48
|
-
Card Name
|
|
49
|
-
</Button>
|
|
50
|
-
</div>
|
|
51
|
-
</>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export default H
|
package/src/entry/entry.less
DELETED
package/src/entry/error.tsx
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React, { FC } from 'react'
|
|
2
|
-
import { Alert, Button } from 'antd'
|
|
3
|
-
import { ErrorProps } from '@variousjs/various'
|
|
4
|
-
|
|
5
|
-
const errorComponent: FC<ErrorProps> = ({ $reload, $type, $message }) => (
|
|
6
|
-
<>
|
|
7
|
-
<Alert
|
|
8
|
-
message="Error"
|
|
9
|
-
description={`[${$type}]: ${$message || '组件错误'}`}
|
|
10
|
-
type="error"
|
|
11
|
-
style={{ marginTop: 30 }}
|
|
12
|
-
/>
|
|
13
|
-
{
|
|
14
|
-
$reload && <Button onClick={$reload}>刷新</Button>
|
|
15
|
-
}
|
|
16
|
-
</>
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
export default errorComponent
|
package/src/entry/index.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|