Match-id-05a4de3e07f8aacea4330e0c77c5fafb9b376d67

This commit is contained in:
* 2023-07-29 14:58:26 +08:00
parent 253511351c
commit dd9b9664d7
217 changed files with 1400 additions and 24611 deletions

32
.prettierrc.js Normal file
View File

@ -0,0 +1,32 @@
/*
* Copyright (c) 2020 Huawei Technologies Co.,Ltd.
*
* openGauss is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
'use strict';
module.exports = {
printWidth: 120, // 一行120字符数如果超过会进行换行
tabWidth: 2, // tab等2个空格
useTabs: false, // 用空格缩进行
semi: true, // 行尾使用分号
singleQuote: true, // 字符串使用单引号
quoteProps: 'as-needed', // 仅在需要时在对象属性添加引号
jsxSingleQuote: false, // 在JSX中使用双引号
trailingComma: 'es5', // 使用尾逗号(对象、数组等)
bracketSpacing: true, // 对象的括号间增加空格
bracketSameLine: false, // 将多行JSX元素的>放在最后一行的末尾
arrowParens: 'avoid', // 在唯一的arrow函数参数周围省略括号
vueIndentScriptAndStyle: false, // 不缩进Vue文件中的<script>和<style>标记内的代码
endOfLine: 'lf', // 仅限换行(\n
};

View File

@ -1,32 +1,39 @@
# 0.0.1 版本 # 0.0.1 版本
## 新特性 ## 新特性
- **功能名称 1**: 描述新功能的详细说明。 - **功能名称 1**: 描述新功能的详细说明。
- **功能名称 2**: 描述新功能的详细说明。 - **功能名称 2**: 描述新功能的详细说明。
- **功能名称 3**: 描述新功能的详细说明。 - **功能名称 3**: 描述新功能的详细说明。
## API变更 ## API变更
- **API变更 1**: 描述API变更的详细说明。 - **API变更 1**: 描述API变更的详细说明。
- **API变更 2**: 描述API变更的详细说明。 - **API变更 2**: 描述API变更的详细说明。
- **API变更 3**: 描述API变更的详细说明。 - **API变更 3**: 描述API变更的详细说明。
## Bug修复 ## Bug修复
- **Bug修复项 1**: 描述修复的bug的详细说明。 - **Bug修复项 1**: 描述修复的bug的详细说明。
- **Bug修复项 2**: 描述修复的bug的详细说明。 - **Bug修复项 2**: 描述修复的bug的详细说明。
- **Bug修复项 3**: 描述修复的bug的详细说明。 - **Bug修复项 3**: 描述修复的bug的详细说明。
## CVE漏洞修复 ## CVE漏洞修复
- **CVE漏洞修复项 1**: 描述修复的CVE漏洞的详细说明。 - **CVE漏洞修复项 1**: 描述修复的CVE漏洞的详细说明。
- **CVE漏洞修复项 2**: 描述修复的CVE漏洞的详细说明。 - **CVE漏洞修复项 2**: 描述修复的CVE漏洞的详细说明。
- **CVE漏洞修复项 3**: 描述修复的CVE漏洞的详细说明。 - **CVE漏洞修复项 3**: 描述修复的CVE漏洞的详细说明。
## 已知问题 ## 已知问题
- **已知问题 1**: 描述已知问题的详细说明。 - **已知问题 1**: 描述已知问题的详细说明。
- **已知问题 2**: 描述已知问题的详细说明。 - **已知问题 2**: 描述已知问题的详细说明。
- **已知问题 3**: 描述已知问题的详细说明。 - **已知问题 3**: 描述已知问题的详细说明。
## 支持与反馈 ## 支持与反馈
如您在使用过程中遇到任何问题或需要帮助,请联系我们的支持团队。您可以通过以下方式与我们取得联系: 如您在使用过程中遇到任何问题或需要帮助,请联系我们的支持团队。您可以通过以下方式与我们取得联系:
- 支持网站/页面链接 - 支持网站/页面链接
- 电子邮件地址 - 电子邮件地址
- 其他联系方式(如社交媒体账号) - 其他联系方式(如社交媒体账号)

View File

@ -38,7 +38,10 @@ function UserModal({ item = {}, onOk, form, ...modalProps }) {
<Form <Form
ref={formRef} ref={formRef}
name="control-ref" name="control-ref"
initialValues={{ ...item, address: item.address && item.address.split(' ') }} initialValues={{
...item,
address: item.address && item.address.split(' '),
}}
layout="horizontal" layout="horizontal"
> >
<FormItem name="name" rules={[{ required: true }]} label={t`Name`} hasFeedback {...formItemLayout}> <FormItem name="name" rules={[{ required: true }]} label={t`Name`} hasFeedback {...formItemLayout}>
@ -62,7 +65,13 @@ function UserModal({ item = {}, onOk, form, ...modalProps }) {
</FormItem> </FormItem>
<FormItem <FormItem
name="phone" name="phone"
rules={[{ required: true, pattern: /^1[34578]\d{9}$/, message: t`The input is not valid phone!` }]} rules={[
{
required: true,
pattern: /^1[34578]\d{9}$/,
message: t`The input is not valid phone!`,
},
]}
label={t`Phone`} label={t`Phone`}
hasFeedback hasFeedback
{...formItemLayout} {...formItemLayout}

View File

@ -15,7 +15,11 @@ function User({ location, history }) {
useEffect(() => { useEffect(() => {
if (pathToRegexp('/user').exec(location.pathname)) { if (pathToRegexp('/user').exec(location.pathname)) {
const payload = { page: 1, pageSize: 10, ...parseSearch(location.search) }; const payload = {
page: 1,
pageSize: 10,
...parseSearch(location.search),
};
st.query(payload); st.query(payload);
} }
}, [st.pagination.total]); }, [st.pagination.total]);

View File

@ -4,10 +4,8 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"dev:admin": "node ./webpack/devServer.js admin", "start": "node ./webpack/devServer.js admin",
"build:admin": "webpack --config ./webpack/admin/webpack.prod.js", "build": "webpack --config ./webpack/admin/webpack.prod.js"
"build-dev:admin": "webpack --config ./webpack/admin/webpack.dev.js",
"build:proxy": "node ./proxy.js"
}, },
"devDependencies": { "devDependencies": {
"@babel/plugin-proposal-class-properties": "7.18.6", "@babel/plugin-proposal-class-properties": "7.18.6",

View File

@ -1,11 +1,11 @@
import inula from 'inulajs'; import Inula from 'inulajs';
import { BrowserRouter } from 'react-router-dom'; import { BrowserRouter } from 'react-router-dom';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import Layout from './layouts'; import Layout from './layouts';
inula.render( Inula.render(
<BrowserRouter> <BrowserRouter>
<Layout></Layout> <Layout></Layout>
</BrowserRouter>, </BrowserRouter>,

View File

@ -0,0 +1,22 @@
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const configs = require(`./webpack.dev`);
const compiler = webpack(configs);
const devServerOptions = {
setupMiddlewares: (middlewares, devServer) => {
// 支持mock能力
require('./mockServer.js')(devServer.app);
return middlewares;
},
host: 'localhost',
port: '8890',
open: true,
historyApiFallback: true, // 使用HTML5 History API时/dashboard 会返回404需要这个配置项解决
};
const server = new WebpackDevServer(compiler, devServerOptions);
server.startCallback(() => {
console.log(`工程已启动, http://localhost:8888`);
});

View File

@ -0,0 +1,124 @@
const chokidar = require('chokidar');
const bodyParser = require('body-parser');
const glob = require('glob');
const { join } = require('path');
const mockDir = join(process.cwd(), 'mock');
const HTTP_METHODS = ['get', 'post', 'put', 'patch', 'delete', 'options', 'head'];
const jsonParser = bodyParser.json();
const urlencodedParser = bodyParser.urlencoded({
extended: true,
});
// 读取 mock 文件夹下的 js 文件
function getMocksFile() {
const mockFiles = glob.sync('**/*.js', {
cwd: mockDir,
});
let ret = mockFiles.reduce((mocks, mockFile) => {
if (!mockFile.startsWith('_')) {
mocks = {
...mocks,
...require(join(mockDir, mockFile)),
};
}
return mocks;
}, {});
return ret;
}
// 生成 express 路由
function generateRoutes(app) {
let mockStartIndex = app._router.stack.length,
mocks = {};
try {
mocks = getMocksFile();
} catch (error) {
console.error(error);
}
for (const mockItem in mocks) {
if (Object.prototype.hasOwnProperty.call(mocks, mockItem)) {
try {
const trimMockItemArr = mockItem
.replace(/(^\s*)|(\s*$)/g, '')
.replace(/\s+/g, ' ')
.split(' ');
const respond = mocks[mockItem];
let mockType = 'get',
mockUrl;
if (trimMockItemArr.length === 1) {
mockUrl = trimMockItemArr[0];
} else {
[mockType, mockUrl] = trimMockItemArr;
}
const mockTypeLowerCase = mockType.toLowerCase();
if (!HTTP_METHODS.includes(mockTypeLowerCase)) {
throw new Error(`Invalid HTTP request method ${mockType} for path ${mockUrl}`);
}
app[mockTypeLowerCase](
mockUrl,
[jsonParser, urlencodedParser],
respond instanceof Function
? respond
: (_req, res) => {
res.send(respond);
}
);
} catch (error) {
console.error(error);
}
}
}
return {
mockRoutesLength: app._router.stack.length - mockStartIndex,
mockStartIndex: mockStartIndex,
};
}
// 清除 mock 文件下的 require 缓存
function cleanRequireCache() {
Object.keys(require.cache).forEach(key => {
if (key.includes(mockDir)) {
delete require.cache[require.resolve(key)];
}
});
}
module.exports = app => {
const mockRoutes = generateRoutes(app);
let { mockRoutesLength } = mockRoutes;
let { mockStartIndex } = mockRoutes;
// 监听 mock 文件夹下文件变化
chokidar
.watch(mockDir, {
ignoreInitial: true,
})
.on('all', (event, _path) => {
if (event === 'change' || event === 'add') {
try {
// 删除中间件映射
app._router.stack.splice(mockStartIndex, mockRoutesLength);
cleanRequireCache();
const mockRoutes = generateRoutes(app);
mockRoutesLength = mockRoutes.mockRoutesLength;
mockStartIndex = mockRoutes.mockStartIndex;
} catch (error) {
console.error(error);
}
}
});
};

View File

@ -2,7 +2,8 @@
box-sizing: border-box; box-sizing: border-box;
} }
body, html { body,
html {
margin: 0; margin: 0;
padding: 0; padding: 0;
font-family: 'Montserrat', sans-serif; font-family: 'Montserrat', sans-serif;
@ -44,7 +45,8 @@ body, html {
backdrop-filter: blur(4px); backdrop-filter: blur(4px);
} }
.card h2, .card p { .card h2,
.card p {
color: #fff; color: #fff;
} }

View File

@ -1,25 +1,32 @@
import inula from 'inulajs'; import Inula from 'inulajs';
import './index.css'; import './index.css';
function App() { function App() {
return ( return (
<div class="container"> <div class="container">
<div class="hero"> <div class="hero">
<h1 class="hero-title animate__animated animate__bounceInDown">欢迎来到 Inula 项目!</h1> <h1 class="hero-title animate__animated animate__bounceInDown">欢迎来到 Inula 项目!</h1>
<p class="hero-subtitle animate__animated animate__bounceInUp">你已成功创建你的第一个 Inula 项目</p> <p class="hero-subtitle animate__animated animate__bounceInUp">你已成功创建你的第一个 Inula 项目</p>
</div>
<div class="content">
<div class="card animate__animated animate__zoomIn">
<h2>开始吧</h2>
<p>
编辑 <code>src/index.jsx</code> 并保存以重新加载
</p>
</div> </div>
<div class="content"> <div class="card animate__animated animate__zoomIn">
<div class="card animate__animated animate__zoomIn"> <h2>了解更多</h2>
<h2>开始吧</h2> <p>
<p>编辑 <code>src/index.jsx</code> 并保存以重新加载</p> 要了解 Inula查看{' '}
</div> <a href="https://inula-docs.com" target="_blank">
<div class="card animate__animated animate__zoomIn"> Inula 文档
<h2>了解更多</h2> </a>
<p>要了解 Inula查看 <a href="https://inula-docs.com" target="_blank">Inula 文档</a></p> </p>
</div>
</div> </div>
</div> </div>
</div>
); );
} }
inula.render(<App />, document.getElementById('root')); Inula.render(<App />, document.getElementById('root'));

View File

@ -1,23 +1,30 @@
import inula from 'inulajs'; import Inula from 'inulajs';
import './styles.css'; import './styles.css';
class App extends inula.Component { class App extends Inula.Component {
render() { render() {
return ( return (
<div class="container"> <div class="container">
<div class="hero"> <div class="hero">
<h1 class="hero-title animate__animated animate__bounceInDown">欢迎来到 Inula 项目!</h1> <h1 class="hero-title animate__animated animate__bounceInDown">欢迎来到 Inula 项目!</h1>
<p class="hero-subtitle animate__animated animate__bounceInUp">你已成功创建你的第一个 Inula 项目</p> <p class="hero-subtitle animate__animated animate__bounceInUp">你已成功创建你的第一个 Inula 项目</p>
</div> </div>
<div class="content"> <div class="content">
<div class="card animate__animated animate__zoomIn"> <div class="card animate__animated animate__zoomIn">
<h2>开始吧</h2> <h2>开始吧</h2>
<p>编辑 <code>src/App.js</code> </p> <p>
</div> 编辑 <code>src/App.js</code>
<div class="card animate__animated animate__zoomIn"> </p>
<h2>了解更多</h2> </div>
<p>要了解 Inula查看 <a href="https://inula-docs.com" target="_blank">Inula 文档</a></p> <div class="card animate__animated animate__zoomIn">
</div> <h2>了解更多</h2>
<p>
要了解 Inula查看{' '}
<a href="https://inula-docs.com" target="_blank">
Inula 文档
</a>
</p>
</div>
</div> </div>
</div> </div>
); );

View File

@ -1,4 +1,4 @@
import inula from 'inulajs'; import Inula from 'inulajs';
import App from './App'; import App from './App';
inula.render(<App />, document.getElementById('root')); Inula.render(<App />, document.getElementById('root'));

View File

@ -2,7 +2,8 @@
box-sizing: border-box; box-sizing: border-box;
} }
body, html { body,
html {
margin: 0; margin: 0;
padding: 0; padding: 0;
font-family: 'Montserrat', sans-serif; font-family: 'Montserrat', sans-serif;
@ -44,7 +45,8 @@ body, html {
backdrop-filter: blur(4px); backdrop-filter: blur(4px);
} }
.card h2, .card p { .card h2,
.card p {
color: #fff; color: #fff;
} }

View File

@ -1,6 +1,7 @@
node_modules node_modules
.idea .idea
.vscode .vscode
build
package-lock.json package-lock.json
libs/**/dist libs/**/dist
scripts/*.ejs scripts/*.ejs

View File

@ -1,5 +1,7 @@
# 欢迎使用 InulaJS! # 欢迎使用 InulaJS!
## 项目介绍: ## 项目介绍:
InulaJS 是用于构建用户界面的Javascript库与React保持一致API的特性 InulaJS 是用于构建用户界面的Javascript库与React保持一致API的特性
同时可以无缝兼容到React的相关生态react-redux、react-router、react-intl、axios等 同时可以无缝兼容到React的相关生态react-redux、react-router、react-intl、axios等
InulaJS 提供响应式API、相比virtual dom方式提升渲染效率30%以上。 InulaJS 提供响应式API、相比virtual dom方式提升渲染效率30%以上。
@ -64,20 +66,24 @@ yarn add inulaJS
## 用户使用指南 ## 用户使用指南
### 创建应用 ### 创建应用
#### 渲染入口 #### 渲染入口
InulaJS提供一个render方法将InulaJS根组件绑定到DOM节点进行渲染 InulaJS提供一个render方法将InulaJS根组件绑定到DOM节点进行渲染
```JavaScript ```JavaScript
import InulaJS from 'inulaJS'; import Inula from 'inulaJS';
import App from './components/App'; import App from './components/App';
InulaJS.render(<App />, document.querySelector('#root')); Inula.render(<App />, document.querySelector('#root'));
``` ```
#### 根组件 #### 根组件
InulaJS应用通常是一颗嵌套的、可重用的组件树组成。这里我们示例中根组件没有嵌套子组件仅作为简单应用展示 InulaJS应用通常是一颗嵌套的、可重用的组件树组成。这里我们示例中根组件没有嵌套子组件仅作为简单应用展示
```JavaScript ```JavaScript
import InulaJS from 'inulaJS'; import Inula from 'inulaJS';
import Box from './Box'; import Box from './Box';
const App = () => { const App = () => {
    return <p>Hello world!</p>;     return <p>Hello world!</p>;
@ -87,25 +93,35 @@ export default App;
``` ```
### jsx语法 ### jsx语法
#### 基本语法 #### 基本语法
jsx写法上和HTML类似但是比HTML更加严格标签必须闭合。组件返回的jsx标签必须包含在一个标签内。jsx中常量"greet"可以直接用双引号包裹赋值给className属性 style属性值则需要{{}}包裹style属性名采用驼峰风格。 jsx写法上和HTML类似但是比HTML更加严格标签必须闭合。组件返回的jsx标签必须包含在一个标签内。jsx中常量"greet"可以直接用双引号包裹赋值给className属性 style属性值则需要{{}}包裹style属性名采用驼峰风格。
```JavaScript ```JavaScript
<div className="greet" style={{ fontSize: '16px'}}> <div className="greet" style={{ fontSize: '16px'}}>
<p>你好</p> <p>你好</p>
</div> </div>
``` ```
#### 变量绑定 #### 变量绑定
在jsx中给一个属性绑定变量需要用{}包裹。将user的class和name字段绑定到dom节点上如下所示 在jsx中给一个属性绑定变量需要用{}包裹。将user的class和name字段绑定到dom节点上如下所示
```JavaScript ```JavaScript
<div className={ user.class } style={{ fontSize: '16px'}}> <div className={ user.class } style={{ fontSize: '16px'}}>
<p>{ user.name }</p> <p>{ user.name }</p>
</div> </div>
``` ```
#### 事件绑定 #### 事件绑定
在jsx中事件绑定需要在事件名前加'on事件名采用驼峰风格如onMouseMove。onClick事件绑定如下所示 在jsx中事件绑定需要在事件名前加'on事件名采用驼峰风格如onMouseMove。onClick事件绑定如下所示
```JavaScript ```JavaScript
<button onClick={(e)=>{console.log('click')}}></button> <button onClick={(e)=>{console.log('click')}}></button>
``` ```
#### 在JSX中使用JavaScript #### 在JSX中使用JavaScript
在 JSX 中,可以使用大括号 `{}` 来嵌入 JavaScript 表达式和代码。这允许我们在 JSX 中使用变量、函数调用、条件语句等 JavaScript 功能,以便动态地生成和渲染组件。 在 JSX 中,可以使用大括号 `{}` 来嵌入 JavaScript 表达式和代码。这允许我们在 JSX 中使用变量、函数调用、条件语句等 JavaScript 功能,以便动态地生成和渲染组件。
@ -146,7 +162,7 @@ const numbers = [1, 2, 3, 4, 5];
const NumberList = () => { const NumberList = () => {
return ( return (
<ul> <ul>
{numbers.map((number) => ( {numbers.map(number => (
<li key={number}>{number}</li> <li key={number}>{number}</li>
))} ))}
</ul> </ul>
@ -158,11 +174,7 @@ const NumberList = () => {
```jsx ```jsx
const ShowExample = ({ isShow }) => { const ShowExample = ({ isShow }) => {
return ( return <div>{isShow && <p>这是一个简单示例</p>}</div>;
<div>
{isShow && <p>这是一个简单示例</p>}
</div>
);
}; };
``` ```
@ -183,6 +195,7 @@ const Greeting = ({ name }) => {
在上述示例中,如果 `name` 属性存在,则渲染 `name` 的值,否则渲染默认值 `'小明'` 在上述示例中,如果 `name` 属性存在,则渲染 `name` 的值,否则渲染默认值 `'小明'`
### 组件 ### 组件
InulaJS界面开发都是以组件为基础的。组件可以将界面分为若干独立的可重用的部分。组件通过嵌套、排列组成一颗组件树将内部逻辑进行隔离。InulaJS可以支持函数式组件和class组件这里不再对class组件进行介绍。 InulaJS界面开发都是以组件为基础的。组件可以将界面分为若干独立的可重用的部分。组件通过嵌套、排列组成一颗组件树将内部逻辑进行隔离。InulaJS可以支持函数式组件和class组件这里不再对class组件进行介绍。
#### props #### props
@ -463,34 +476,42 @@ alias: {
- 其他有理由认定为违反职业操守的不当行为 - 其他有理由认定为违反职业操守的不当行为
#### 责任和权力 #### 责任和权力
社区领袖有责任解释和落实我们所认可的行为准则,并妥善公正地对他们认为不当、威胁、冒犯或有害的任何行为采取纠正措施。 社区领袖有责任解释和落实我们所认可的行为准则,并妥善公正地对他们认为不当、威胁、冒犯或有害的任何行为采取纠正措施。
社区领导有权力和责任删除、编辑或拒绝或拒绝与本行为准则不相符的评论comment、提交commits、代码、维基wiki编辑、议题issues或其他贡献并在适当时机知采取措施的理由。 社区领导有权力和责任删除、编辑或拒绝或拒绝与本行为准则不相符的评论comment、提交commits、代码、维基wiki编辑、议题issues或其他贡献并在适当时机知采取措施的理由。
#### 适用范围 #### 适用范围
本行为准则适用于所有社区场合,也适用于在公共场所代表社区时的个人。 本行为准则适用于所有社区场合,也适用于在公共场所代表社区时的个人。
代表社区的情形包括使用官方电子邮件地址、通过官方社交媒体帐户发帖或在线上或线下活动中担任指定代表。 代表社区的情形包括使用官方电子邮件地址、通过官方社交媒体帐户发帖或在线上或线下活动中担任指定代表。
#### 监督 #### 监督
辱骂、骚扰或其他不可接受的行为可通过 XX@XXX.com 向负责监督的社区领袖报告。 所有投诉都将得到及时和公平的审查和调查。 辱骂、骚扰或其他不可接受的行为可通过 XX@XXX.com 向负责监督的社区领袖报告。 所有投诉都将得到及时和公平的审查和调查。
所有社区领袖都有义务尊重任何事件报告者的隐私和安全。 所有社区领袖都有义务尊重任何事件报告者的隐私和安全。
#### 参见 #### 参见
本行为准则改编自 Contributor Covenant 2.1 版, 参见 https://www.contributor-covenant.org/version/2/1/code_of_conduct.html。 本行为准则改编自 Contributor Covenant 2.1 版, 参见 https://www.contributor-covenant.org/version/2/1/code_of_conduct.html。
### 公正透明的开发流程 ### 公正透明的开发流程
我们所有的工作都会放在 [Gitee](https://www.gitee.com) 上。不管是核心团队的成员还是外部贡献者的 pull request 都需要经过同样流程的 review。 我们所有的工作都会放在 [Gitee](https://www.gitee.com) 上。不管是核心团队的成员还是外部贡献者的 pull request 都需要经过同样流程的 review。
### 分支管理 ### 分支管理
InulaJS长期维护XX分支。如果你要修复一个Bug或增加一个新的功能那么请Pull Request到XX分支上 InulaJS长期维护XX分支。如果你要修复一个Bug或增加一个新的功能那么请Pull Request到XX分支上
### Bug提交 ### Bug提交
我们使用 Gitee Issues来进行Bug跟踪。在你发现Bug后请通过我们提供的模板来提Issue以便你发现的Bug能被快速解决。 我们使用 Gitee Issues来进行Bug跟踪。在你发现Bug后请通过我们提供的模板来提Issue以便你发现的Bug能被快速解决。
在你报告一个 bug 之前请先确保不和已有Issue重复以及查阅了我们的用户使用指南。 在你报告一个 bug 之前请先确保不和已有Issue重复以及查阅了我们的用户使用指南。
### 新增功能 ### 新增功能
如果你有帮助我们改进API或者新增功能的想法我们同样推荐你使用我们提供Issue模板来新建一个添加新功能的 Issue。 如果你有帮助我们改进API或者新增功能的想法我们同样推荐你使用我们提供Issue模板来新建一个添加新功能的 Issue。
### 第一次贡献 ### 第一次贡献

View File

@ -1,8 +0,0 @@
import { asyncUpdates } from '../renderer/Renderer';
import { createPortal } from '../renderer/components/CreatePortal';
import type { Container } from './DOMOperator';
import { Callback } from '../renderer/UpdateHandler';
declare function executeRender(children: any, container: Container, callback?: Callback): Element | Text;
declare function findDOMNode(domOrEle?: Element): null | Element | Text;
declare function destroy(container: Container): boolean;
export { createPortal, asyncUpdates as unstable_batchedUpdates, findDOMNode, executeRender as render, destroy as unmountComponentAtNode, };

View File

@ -1,12 +0,0 @@
/**
* dom节点赋 VNode
*/
import type { VNode } from '../renderer/Types';
import type { Container, Props } from './DOMOperator';
export declare function getDom(vNode: VNode): Element | Text | null;
export declare function saveVNode(vNode: VNode, dom: Element | Text | Container): void;
export declare function getVNode(dom: Node | Container): VNode | null;
export declare function getNearestVNode(dom: Node): null | VNode;
export declare function getVNodeProps(dom: Element | Text): Props | null;
export declare function updateVNodeProps(dom: Element | Text, props: Props): void;
export declare function getNonDelegatedListenerMap(dom: Element | Text): Map<string, EventListener>;

View File

@ -1,31 +0,0 @@
import type { VNode } from '../renderer/Types';
export declare type Props = Record<string, any> & {
autoFocus?: boolean;
children?: any;
dangerouslySetInnerHTML?: any;
disabled?: boolean;
hidden?: boolean;
style?: {
display?: string;
};
};
export declare type Container = (Element & {
_treeRoot?: VNode | null;
}) | (Document & {
_treeRoot?: VNode | null;
});
export declare function getNSCtx(parentNS: string, type: string, dom?: Container): string;
export declare function prepareForSubmit(): void;
export declare function resetAfterSubmit(): void;
export declare function newDom(tagName: string, props: Props, parentNamespace: string, vNode: VNode): Element;
export declare function initDomProps(dom: Element, tagName: string, rawProps: Props): boolean;
export declare function getPropChangeList(dom: Element, type: string, lastRawProps: Props, nextRawProps: Props): Object;
export declare function isTextChild(type: string, props: Props): boolean;
export declare function newTextDom(text: string, processing: VNode): Text;
export declare function submitDomUpdate(tag: string, vNode: VNode): void;
export declare function clearText(dom: Element): void;
export declare function appendChildElement(parent: Element | Container, child: Element | Text): void;
export declare function insertDomBefore(parent: Element | Container, child: Element | Text, beforeChild: Element | Text): void;
export declare function removeChildDom(parent: Element | Container, child: Element | Text): void;
export declare function hideDom(tag: string, dom: Element | Text): void;
export declare function unHideDom(tag: string, dom: Element | Text, props?: Props): void;

View File

@ -1,2 +0,0 @@
export declare function setDomProps(dom: Element, props: Object, isNativeTag: boolean, isInit: boolean): void;
export declare function compareProps(oldProps: Object, newProps: Object): Object;

View File

@ -1,10 +0,0 @@
/**
* width: 10 => width: 10px
*
*
*/
export declare function adjustStyleValue(name: any, value: any): any;
/**
* DOM style
*/
export declare function setStyles(dom: any, styles: any): void;

View File

@ -1,6 +0,0 @@
/**
* dom
* attrName class
* attrName DOM 使 property
*/
export declare function updateCommonProp(dom: Element, attrName: string, value: any, isNativeTag: boolean): void;

View File

@ -1,16 +0,0 @@
export declare function hasSelectionProperties(dom: any): boolean;
export declare function getSelectionInfo(): {
focusedDom: import("./utils/Interface").InulaDom;
selectionRange: {
start: number;
end: number;
};
};
export interface SelectionData {
focusedDom: HTMLInputElement | HTMLTextAreaElement | void;
selectionRange?: {
start: number;
end: number;
};
}
export declare function resetSelectionRange(preSelectionRangeData: SelectionData): void;

View File

@ -1,17 +0,0 @@
import { InulaDom } from './Interface';
import { Props } from '../DOMOperator';
/**
* input textarea
* @param doc document
*/
export declare function getFocusedDom(doc?: Document): InulaDom | null;
export declare function getIFrameFocusedDom(): InulaDom;
export declare function isElement(dom: any): boolean;
export declare function isText(dom: any): boolean;
export declare function isComment(dom: any): boolean;
export declare function isDocument(dom: any): boolean;
export declare function isDocumentFragment(dom: any): boolean;
export declare function getDomTag(dom: any): any;
export declare function isInputElement(dom: Element): dom is HTMLInputElement;
export declare function shouldAutoFocus(tagName: string, props: Props): boolean;
export declare function isNotNull(object: any): boolean;

View File

@ -1,6 +0,0 @@
export declare const NSS: {
html: string;
math: string;
svg: string;
};
export declare function createDom(tagName: string, parentNamespace: string, doc: Document): Element;

View File

@ -1,7 +0,0 @@
export interface Props {
[propName: string]: any;
}
export interface InulaSelect extends HTMLSelectElement {
_multiple?: boolean;
}
export declare type InulaDom = Element | HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;

View File

@ -1,13 +0,0 @@
export declare enum PROPERTY_TYPE {
BOOLEAN = 0,
STRING = 1,
SPECIAL = 2,
BOOLEAN_STR = 3
}
export declare type PropDetails = {
propName: string;
type: PROPERTY_TYPE;
attrName: string;
attrNS: string | null;
};
export declare function getPropDetails(name: string): PropDetails | null;

View File

@ -1,5 +0,0 @@
import { PropDetails } from './PropertiesData';
export declare function isNativeElement(tagName: string, props: Record<string, any>): boolean;
export declare function isEventProp(propName: any): boolean;
export declare function isInvalidValue(name: string, value: any, propDetails: PropDetails | null, isNativeTag: boolean): boolean;
export declare function validateProps(type: any, props: any): void;

View File

@ -1,9 +0,0 @@
import { Props } from '../utils/Interface';
export declare function getInputPropsWithoutValue(dom: HTMLInputElement, props: Props): {
value: any;
defaultValue: any;
defaultChecked: any;
checked: any;
};
export declare function updateInputValue(dom: HTMLInputElement, props: Props): void;
export declare function setInitInputValue(dom: HTMLInputElement, props: Props): void;

View File

@ -1,4 +0,0 @@
import { Props } from '../utils/Interface';
export declare function getOptionPropsWithoutValue(dom: Element, props: Props): {
children: string;
};

View File

@ -1,12 +0,0 @@
import { InulaSelect, Props } from '../utils/Interface';
export declare function getSelectPropsWithoutValue(dom: InulaSelect, properties: Object): {
value: any;
constructor: Function;
toString(): string;
toLocaleString(): string;
valueOf(): Object;
hasOwnProperty(v: PropertyKey): boolean;
isPrototypeOf(v: Object): boolean;
propertyIsEnumerable(v: PropertyKey): boolean;
};
export declare function updateSelectValue(dom: InulaSelect, props: Props, isInit?: boolean): void;

View File

@ -1,12 +0,0 @@
import { Props } from '../utils/Interface';
export declare function getTextareaPropsWithoutValue(dom: HTMLTextAreaElement, properties: Object): {
value: any;
constructor: Function;
toString(): string;
toLocaleString(): string;
valueOf(): Object;
hasOwnProperty(v: PropertyKey): boolean;
isPrototypeOf(v: Object): boolean;
propertyIsEnumerable(v: PropertyKey): boolean;
};
export declare function updateTextareaValue(dom: HTMLTextAreaElement, props: Props, isInit?: boolean): void;

View File

@ -1,7 +0,0 @@
/**
* value值发生变化时value的gettersetter
* currentVal input
* change事件
*/
export declare function watchValueChange(dom: any): void;
export declare function updateInputHandlerIfChanged(dom: any): boolean;

View File

@ -1,9 +0,0 @@
/**
* <input> <textarea> <select> <option> value
*
*/
import { InulaDom, Props } from '../utils/Interface';
declare function getPropsWithoutValue(type: string, dom: InulaDom, props: Props): Props;
declare function setInitValue(type: string, dom: InulaDom, props: Props): void;
declare function updateValue(type: string, dom: InulaDom, props: Props): void;
export { getPropsWithoutValue, setInitValue, updateValue };

View File

@ -1,4 +0,0 @@
import { VNode } from '../renderer/vnode/VNode';
export declare function lazyDelegateOnRoot(currentRoot: VNode, eventName: string): void;
export declare function listenSimulatedDelegatedEvents(root: VNode): void;
export declare function listenNonDelegatedEvent(inulaEventName: string, domElement: Element, listener: any): void;

View File

@ -1,43 +0,0 @@
export declare const allDelegatedInulaEvents: Map<any, any>;
export declare const simulatedDelegatedEvents: string[];
export declare const allDelegatedNativeEvents: Set<unknown>;
export declare const inulaEventToNativeMap: Map<string, string[]>;
export declare const NativeEventToInulaMap: {
click: string;
wheel: string;
dblclick: string;
contextmenu: string;
dragend: string;
focusin: string;
focusout: string;
input: string;
select: string;
keydown: string;
keypress: string;
keyup: string;
mousedown: string;
mouseup: string;
touchend: string;
touchstart: string;
mousemove: string;
mouseout: string;
mouseover: string;
pointermove: string;
pointerout: string;
pointerover: string;
selectionchange: string;
textInput: string;
touchmove: string;
animationend: string;
animationiteration: string;
animationstart: string;
transitionend: string;
compositionstart: string;
compositionend: string;
compositionupdate: string;
};
export declare const CHAR_CODE_SPACE = 32;
export declare const EVENT_TYPE_BUBBLE = "Bubble";
export declare const EVENT_TYPE_CAPTURE = "Capture";
export declare const EVENT_TYPE_ALL = "All";
export declare function transformToInulaEvent(nativeEvtName: string): string;

View File

@ -1,20 +0,0 @@
import { AnyNativeEvent } from './Types';
export declare class WrappedEvent {
customEventName: string;
nativeEvent: AnyNativeEvent;
nativeEventType: string;
type: string;
key: string;
currentTarget: EventTarget | null;
target: HTMLElement;
relatedTarget: HTMLElement;
stopPropagation: () => void;
preventDefault: () => void;
propagationStopped: boolean;
isPropagationStopped: () => boolean;
getModifierState?: (keyArgs: string) => boolean;
persist: () => void;
constructor(customEventName: string, nativeEvtName: string, nativeEvent: AnyNativeEvent);
isDefaultPrevented(): boolean;
}
export declare function decorateNativeEvent(customEventName: string, nativeEvtName: string, nativeEvent: AnyNativeEvent): WrappedEvent;

View File

@ -1,3 +0,0 @@
export declare function recordChangeEventTargets(target: EventTarget): void;
export declare function shouldControlValue(): boolean;
export declare function tryControlValue(): void;

View File

@ -1,3 +0,0 @@
import { AnyNativeEvent } from './Types';
import type { VNode } from '../renderer/Types';
export declare function handleEventMain(nativeEvtName: string, isCapture: boolean, nativeEvent: AnyNativeEvent, vNode: null | VNode, targetDom: EventTarget): void;

View File

@ -1,5 +0,0 @@
import { VNode } from '../renderer/Types';
import { WrappedEvent } from './EventWrapper';
import { ListenerUnitList } from './Types';
export declare function getListenersFromTree(targetVNode: VNode | null, inulaEvtName: string | null, nativeEvent: WrappedEvent, eventType: string): ListenerUnitList;
export declare function collectMouseListeners(leaveEvent: null | WrappedEvent, enterEvent: null | WrappedEvent, from: VNode | null, to: VNode | null): ListenerUnitList;

View File

@ -1,3 +0,0 @@
import { VNode } from '../renderer/vnode/VNode';
import { AnyNativeEvent, ListenerUnitList } from './Types';
export declare function getMouseEnterListeners(domEventName: string, targetInst: null | VNode, nativeEvent: AnyNativeEvent, nativeEventTarget: null | EventTarget): ListenerUnitList;

View File

@ -1,13 +0,0 @@
import type { VNode } from '../renderer/Types';
import { WrappedEvent } from './EventWrapper';
export declare type AnyNativeEvent = KeyboardEvent | MouseEvent | TouchEvent | UIEvent | Event;
export interface InulaEventListener {
(event: WrappedEvent): void;
}
export declare type ListenerUnit = {
vNode: null | VNode;
listener: InulaEventListener;
currentTarget: EventTarget;
event: WrappedEvent;
};
export declare type ListenerUnitList = Array<ListenerUnit>;

View File

@ -1,4 +0,0 @@
import { VNode } from '../renderer/vnode/VNode';
export declare function isInputElement(dom?: HTMLElement): boolean;
export declare function setPropertyWritable(obj: any, propName: any): void;
export declare function getNearestMountedVNode(vNode: VNode): null | VNode;

View File

@ -1,9 +0,0 @@
declare function mapChildren(children: any, func: Function, context?: any): Array<any>;
declare const Children: {
forEach: (children: any, func: any, context?: any) => void;
map: typeof mapChildren;
count: (children: any) => number;
only: (children: any) => any;
toArray: (children: any) => any[];
};
export { Children };

View File

@ -1,9 +0,0 @@
export declare function isElement(ele: any): boolean;
export declare function isFragment(ele: any): boolean;
export declare function isForwardRef(ele: any): boolean;
export declare function isLazy(ele: any): boolean;
export declare function isMemo(ele: any): boolean;
export declare function isPortal(ele: any): boolean;
export declare function isContextProvider(ele: any): boolean;
export declare function isContextConsumer(ele: any): boolean;
export declare function isValidElementType(type: any): boolean;

View File

@ -1,45 +0,0 @@
import { Source } from '../renderer/Types';
/**
* vtype element
* type dom节点的名称或者组件的函数地址
* key key属性
* ref ref属性
* props
*/
export declare function JSXElement(type: any, key: any, ref: any, vNode: any, props: any, source: Source | null): {
[x: string]: any;
vtype: number;
src: any;
type: any;
key: any;
ref: any;
props: any;
};
export declare function createElement(type: any, setting: any, ...children: any[]): {
[x: string]: any;
vtype: number;
src: any;
type: any;
key: any;
ref: any;
props: any;
};
export declare function cloneElement(element: any, setting: any, ...children: any[]): {
[x: string]: any;
vtype: number;
src: any;
type: any;
key: any;
ref: any;
props: any;
};
export declare function isValidElement(element: any): boolean;
export declare function jsx(type: any, setting: any, key: any): {
[x: string]: any;
vtype: number;
src: any;
type: any;
key: any;
ref: any;
props: any;
};

View File

@ -1,11 +0,0 @@
export declare const TYPE_COMMON_ELEMENT = 1;
export declare const TYPE_PORTAL = 2;
export declare const TYPE_FRAGMENT = 3;
export declare const TYPE_STRICT_MODE = 4;
export declare const TYPE_PROVIDER = 5;
export declare const TYPE_CONTEXT = 6;
export declare const TYPE_FORWARD_REF = 7;
export declare const TYPE_SUSPENSE = 8;
export declare const TYPE_PROFILER = 9;
export declare const TYPE_MEMO = 10;
export declare const TYPE_LAZY = 11;

View File

@ -1,5 +0,0 @@
interface Thenable {
then(resolve: (val?: any) => void, reject: (err: any) => void): void;
}
declare function act(fun: () => void | Thenable): Thenable;
export { act };

View File

@ -1,17 +0,0 @@
import { Hook } from '../renderer/hooks/HookType';
import { VNode } from '../renderer/vnode/VNode';
import { JSXElement } from '../renderer/Types';
export declare const helper: {
travelVNodeTree: (rootVNode: any, fun: any, childFilter?: (node: VNode) => boolean) => void;
getHookInfo: (hook: Hook<any, any>) => {
name: string;
hIndex: number;
value: any;
};
updateProps: (vNode: VNode, props: any) => void;
updateState: (vNode: VNode, nextState: any) => void;
updateHooks: (vNode: VNode, hIndex: any, nextState: any) => void;
getComponentInfo: (vNode: VNode) => any;
getElementTag: (element: JSXElement) => string;
};
export declare function injectUpdater(): void;

View File

@ -1,78 +0,0 @@
import { TYPE_FRAGMENT as Fragment, TYPE_PROFILER as Profiler, TYPE_STRICT_MODE as StrictMode, TYPE_SUSPENSE as Suspense, TYPE_FORWARD_REF as ForwardRef, TYPE_MEMO as Memo } from './external/JSXElementType';
import { Component, PureComponent } from './renderer/components/BaseClassComponent';
import { createRef } from './renderer/components/CreateRef';
import { Children } from './external/ChildrenUtil';
import { createElement, cloneElement, isValidElement } from './external/JSXElement';
import { createContext } from './renderer/components/context/CreateContext';
import { lazy } from './renderer/components/Lazy';
import { forwardRef } from './renderer/components/ForwardRef';
import { memo } from './renderer/components/Memo';
import './external/devtools';
import { useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, useDebugValue } from './renderer/hooks/HookExternal';
import { isContextProvider, isContextConsumer, isElement, isValidElementType, isForwardRef, isFragment, isLazy, isMemo, isPortal } from './external/InulaIs';
import { createStore, useStore, clearStore } from './inulax/store/StoreHandler';
import * as reduxAdapter from './inulax/adapters/redux';
import { watch } from './inulax/proxy/watch';
import { act } from './external/TestUtil';
import { render, createPortal, unstable_batchedUpdates, findDOMNode, unmountComponentAtNode } from './dom/DOMExternal';
import { syncUpdates as flushSync } from './renderer/TreeBuilder';
import { toRaw } from './inulax/proxy/ProxyHandler';
declare const Inula: {
Children: {
forEach: (children: any, func: any, context?: any) => void;
map: (children: any, func: Function, context?: any) => any[];
count: (children: any) => number;
only: (children: any) => any;
toArray: (children: any) => any[];
};
createRef: typeof createRef;
Component: typeof Component;
PureComponent: typeof PureComponent;
createContext: typeof createContext;
forwardRef: typeof forwardRef;
lazy: typeof lazy;
memo: typeof memo;
useDebugValue: () => void;
useCallback: typeof useCallback;
useContext: typeof useContext;
useEffect: typeof useEffect;
useImperativeHandle: typeof useImperativeHandle;
useLayoutEffect: typeof useLayoutEffect;
useMemo: typeof useMemo;
useReducer: typeof useReducer;
useRef: typeof useRef;
useState: typeof useState;
createElement: typeof createElement;
cloneElement: typeof cloneElement;
isValidElement: typeof isValidElement;
render: typeof render;
createPortal: typeof createPortal;
unstable_batchedUpdates: typeof unstable_batchedUpdates;
findDOMNode: typeof findDOMNode;
unmountComponentAtNode: typeof unmountComponentAtNode;
act: typeof act;
flushSync: typeof flushSync;
createStore: typeof createStore;
useStore: typeof useStore;
clearStore: typeof clearStore;
reduxAdapter: typeof reduxAdapter;
watch: typeof watch;
isFragment: typeof isFragment;
isElement: typeof isElement;
isValidElementType: typeof isValidElementType;
isForwardRef: typeof isForwardRef;
isLazy: typeof isLazy;
isMemo: typeof isMemo;
isPortal: typeof isPortal;
isContextProvider: typeof isContextProvider;
isContextConsumer: typeof isContextConsumer;
ForwardRef: number;
Memo: number;
Fragment: number;
Profiler: number;
StrictMode: number;
Suspense: number;
};
export declare const version: any;
export { Children, createRef, Component, PureComponent, createContext, forwardRef, lazy, memo, useDebugValue, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, createElement, cloneElement, isValidElement, render, createPortal, unstable_batchedUpdates, findDOMNode, unmountComponentAtNode, act, flushSync, createStore, useStore, clearStore, reduxAdapter, watch, toRaw, isFragment, isElement, isValidElementType, isForwardRef, isLazy, isMemo, isPortal, isContextProvider, isContextConsumer, ForwardRef, Memo, Fragment, Profiler, StrictMode, Suspense, };
export default Inula;

View File

@ -1,14 +0,0 @@
export declare function isObject(obj: any): boolean;
export declare function isSet(obj: any): boolean;
export declare function isWeakSet(obj: any): boolean;
export declare function isMap(obj: any): boolean;
export declare function isWeakMap(obj: any): boolean;
export declare function isArray(obj: any): boolean;
export declare function isCollection(obj: any): boolean;
export declare function isString(obj: any): boolean;
export declare function isValidIntegerKey(key: any): boolean;
export declare function isPromise(obj: any): boolean;
export declare function isSame(x: any, y: any): boolean;
export declare function getDetailedType(val: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "map" | "null" | "promise" | "array" | "weakMap" | "weakSet" | "set";
export declare function resolveMutation(from: any, to: any): any;
export declare function omit(obj: any, ...attrs: any[]): any;

View File

@ -1,2 +0,0 @@
export declare const OBSERVER_KEY: string | symbol;
export declare const RAW_VALUE = "_rawValue";

View File

@ -1,38 +0,0 @@
export { thunk } from './reduxThunk';
export { Provider, useSelector, useStore, useDispatch, connect, createSelectorHook, createDispatchHook, } from './reduxReact';
export declare type ReduxStoreHandler = {
reducer: (state: any, action: {
type: string;
}) => any;
dispatch: (action: {
type: string;
}) => void;
getState: () => any;
subscribe: (listener: () => void) => () => void;
replaceReducer: (reducer: (state: any, action: {
type: string;
}) => any) => void;
};
export declare type ReduxAction = {
type: string;
[key: string]: any;
};
export declare type ReduxMiddleware = (store: ReduxStoreHandler, extraArgument?: any) => (next: (action: ReduxAction) => any) => (action: ReduxAction | ((dispatch: (action: ReduxAction) => void, store: ReduxStoreHandler, extraArgument?: any) => any)) => ReduxStoreHandler;
declare type Reducer = (state: any, action: ReduxAction) => any;
export declare function createStore(reducer: Reducer, preloadedState?: any, enhancers?: any): ReduxStoreHandler;
export declare function combineReducers(reducers: {
[key: string]: Reducer;
}): Reducer;
export declare function applyMiddleware(...middlewares: ReduxMiddleware[]): (store: ReduxStoreHandler) => void;
declare type ActionCreator = (...params: any[]) => ReduxAction;
declare type ActionCreators = {
[key: string]: ActionCreator;
};
export declare type BoundActionCreator = (...params: any[]) => void;
declare type BoundActionCreators = {
[key: string]: BoundActionCreator;
};
declare type Dispatch = (action: any) => any;
export declare function bindActionCreators(actionCreators: ActionCreators, dispatch: Dispatch): BoundActionCreators;
export declare function compose(...middlewares: ReduxMiddleware[]): (store: ReduxStoreHandler, extraArgument: any) => any;
export declare function batch(fn: () => void): void;

View File

@ -1,2 +0,0 @@
import { ReduxMiddleware } from './redux';
export declare const thunk: ReduxMiddleware;

View File

@ -1,10 +0,0 @@
export declare const INITIALIZED = "inulax store initialized";
export declare const STATE_CHANGE = "inulax state change";
export declare const SUBSCRIBED = "inulax subscribed";
export declare const UNSUBSCRIBED = "inulax unsubscribed";
export declare const ACTION = "inulax action";
export declare const ACTION_QUEUED = "inulax action queued";
export declare const QUEUE_PENDING = "inulax queue pending";
export declare const QUEUE_FINISHED = "inulax queue finished";
export declare const RENDER_TRIGGERED = "inulax render triggered";
export declare const OBSERVED_COMPONENTS = "inulax observed components";

View File

@ -1,5 +0,0 @@
export declare function isPanelActive(): any;
export declare const devtools: {
getVNodeId: (vNode: any) => any;
emit: (type: any, data: any) => void;
};

View File

@ -1,16 +0,0 @@
import type { IObserver } from './Observer';
/**
* Observer
*/
export declare class HooklessObserver implements IObserver {
listeners: ((mutation: any) => void)[];
useProp(key: string | symbol): void;
addListener(listener: (mutation: any) => void): void;
removeListener(listener: (mutation: any) => void): void;
getListeners(): ((mutation: any) => void)[];
setProp(key: string | symbol, mutation: any): void;
triggerChangeListeners(mutation: any): void;
triggerUpdate(vNode: any): void;
allChange(): void;
clearByVNode(vNode: any): void;
}

View File

@ -1,33 +0,0 @@
import { VNode } from '../../renderer/vnode/VNode';
export interface IObserver {
useProp: (key: string) => void;
addListener: (listener: () => void) => void;
removeListener: (listener: () => void) => void;
setProp: (key: string, mutation: any) => void;
triggerChangeListeners: (mutation: any) => void;
triggerUpdate: (vNode: any) => void;
allChange: () => void;
clearByVNode: (vNode: any) => void;
}
/**
* Observer
*/
export declare class Observer implements IObserver {
vNodeKeys: WeakMap<object, any>;
keyVNodes: Map<any, any>;
listeners: ((mutation: any) => void)[];
watchers: {
[key: string]: ((key: string, oldValue: any, newValue: any, mutation: any) => void)[];
};
useProp(key: string | symbol): void;
setProp(key: string | symbol, mutation: any): void;
triggerUpdate(vNode: VNode): void;
addListener(listener: (mutation: any) => void): void;
removeListener(listener: (mutation: any) => void): void;
triggerChangeListeners({ mutation, vNodes }: {
mutation: any;
vNodes: any;
}): void;
allChange(): void;
clearByVNode(vNode: VNode): void;
}

View File

@ -1,7 +0,0 @@
import { Observer } from './Observer';
export declare const hookObserverMap: WeakMap<object, any>;
export declare function getObserver(rawObj: any): Observer;
export declare function createProxy(rawObj: any, listener: {
current: (...args: any[]) => any;
}, isHookObserver?: boolean): any;
export declare function toRaw<T>(observed: T): T;

View File

@ -1,3 +0,0 @@
export declare function createArrayProxy(rawObj: any[], listener: {
current: (...args: any[]) => any;
}): any[];

View File

@ -1,3 +0,0 @@
export declare function createCollectionProxy(rawObj: Object, listener: {
current: (...args: any[]) => any;
}, hookObserver?: boolean): Object;

View File

@ -1,3 +0,0 @@
export declare function createMapProxy(rawObj: Object, listener: {
current: (...args: any[]) => any;
}, hookObserver?: boolean): Object;

View File

@ -1,3 +0,0 @@
export declare function createObjectProxy<T extends object>(rawObj: T, listener: {
current: (...args: any[]) => any;
}, singleLevel?: boolean): ProxyHandler<T>;

View File

@ -1,3 +0,0 @@
export declare function createSetProxy<T extends object>(rawObj: T, listener: {
current: (...args: any[]) => any;
}, hookObserver?: boolean): ProxyHandler<T>;

View File

@ -1,3 +0,0 @@
export declare function createWeakMapProxy(rawObj: Object, listener: {
current: (...args: any[]) => any;
}, hookObserver?: boolean): Object;

View File

@ -1,3 +0,0 @@
export declare function createWeakSetProxy<T extends object>(rawObj: T, listener: {
current: (...args: any[]) => any;
}, hookObserver?: boolean): ProxyHandler<T>;

View File

@ -1,2 +0,0 @@
export declare function readonlyProxy<T extends object>(rawObj: T): ProxyHandler<T>;
export default readonlyProxy;

View File

@ -1 +0,0 @@
export declare function watch(stateVariable: any, listener: (state: any) => void): () => void;

View File

@ -1,10 +0,0 @@
import type { StoreConfig, StoreObj, UserActions, UserComputedValues } from '../types';
import { VNode } from '../../renderer/vnode/VNode';
export declare function clearVNodeObservers(vNode: VNode): void;
export declare function createStore<S extends object, A extends UserActions<S>, C extends UserComputedValues<S>>(config: StoreConfig<S, A, C>): () => StoreObj<S, A, C>;
export declare function useStore<S extends object, A extends UserActions<S>, C extends UserComputedValues<S>>(id: string): StoreObj<S, A, C>;
export declare function getStore(id: string): StoreObj<any, any, any>;
export declare function getAllStores(): {
[k: string]: StoreObj<any, any, any>;
};
export declare function clearStore(id: string): void;

View File

@ -1,3 +0,0 @@
import { TYPE_FRAGMENT as Fragment } from './external/JSXElementType';
import { jsx as jsxDEV } from './external/JSXElement';
export { jsxDEV, Fragment };

View File

@ -1,3 +0,0 @@
import { TYPE_FRAGMENT as Fragment } from './external/JSXElementType';
import { jsx, jsx as jsxs } from './external/JSXElement';
export { jsx, jsxs, Fragment };

View File

@ -1,11 +0,0 @@
/**
* context
* capture阶段会修改一些全局的值bubble阶段会恢复
*/
import type { VNode } from './Types';
import type { Container } from '../dom/DOMOperator';
export declare function setNamespaceCtx(vNode: VNode, dom?: Container): void;
export declare function resetNamespaceCtx(vNode: VNode): void;
export declare function getNamespaceCtx(): string;
export declare function setContext<T>(providerVNode: VNode, nextValue: T): void;
export declare function resetContext(providerVNode: VNode): void;

View File

@ -1,7 +0,0 @@
/**
*
*/
import type { PromiseType, VNode } from './Types';
export declare function isPromise(error: any): error is PromiseType<any>;
export declare function handleRenderThrowError(sourceVNode: VNode, error: any): void;
export declare function handleSubmitError(vNode: VNode, error: any): void;

View File

@ -1,22 +0,0 @@
export declare const ByAsync = "BY_ASYNC";
export declare const BySync = "BY_SYNC";
export declare const InRender = "IN_RENDER";
export declare const InEvent = "IN_EVENT";
declare type RenderMode = typeof ByAsync | typeof BySync | typeof InRender | typeof InEvent;
declare let executeMode: {
BY_ASYNC: boolean;
BY_SYNC: boolean;
IN_RENDER: boolean;
IN_EVENT: boolean;
};
export declare function changeMode(mode: RenderMode, state?: boolean): void;
export declare function checkMode(mode: RenderMode): boolean;
export declare function isExecuting(): boolean;
export declare function copyExecuteMode(): {
BY_ASYNC: boolean;
BY_SYNC: boolean;
IN_RENDER: boolean;
IN_EVENT: boolean;
};
export declare function setExecuteMode(mode: typeof executeMode): void;
export {};

View File

@ -1,15 +0,0 @@
import type { VNode } from './Types';
export declare function getProcessingClassVNode(): VNode | null;
export declare function setProcessingClassVNode(vNode: VNode | null): void;
export declare function getProcessingVNode(): VNode;
export declare function setProcessingVNode(vNode: VNode | null): void;
export declare function getStartVNode(): VNode | null;
export declare function setStartVNode(vNode: VNode | null): void;
declare type BuildVNodeResult = 0 | 1 | 2 | 3;
export declare const BuildInComplete = 0;
export declare const BuildFatalErrored = 1;
export declare const BuildErrored = 2;
export declare const BuildCompleted = 3;
export declare function setBuildResult(result: BuildVNodeResult): void;
export declare function getBuildResult(): BuildVNodeResult;
export {};

View File

@ -1,9 +0,0 @@
import type { VNode } from './Types';
import { asyncUpdates, syncUpdates, runDiscreteUpdates } from './TreeBuilder';
import { runAsyncEffects } from './submit/HookEffectHandler';
import { Callback } from './UpdateHandler';
export { createVNode, createTreeRootVNode } from './vnode/VNodeCreator';
export { createPortal } from './components/CreatePortal';
export { asyncUpdates, syncUpdates, runDiscreteUpdates, runAsyncEffects };
export declare function startUpdate(element: any, treeRoot: VNode, callback?: Callback): void;
export declare function getFirstCustomDom(treeRoot?: VNode | null): Element | Text | null;

View File

@ -1,4 +0,0 @@
import { VNode } from './vnode/VNode';
export declare function getCurrentRoot(): VNode;
export declare function pushCurrentRoot(root: VNode): void;
export declare function popCurrentRoot(): VNode;

View File

@ -1,8 +0,0 @@
import type { VNode } from './Types';
export declare function setProcessing(vNode: VNode | null): void;
export declare function calcStartUpdateVNode(treeRoot: VNode): VNode;
export declare function tryRenderFromRoot(treeRoot: VNode): void;
export declare function launchUpdateFromVNode(vNode: VNode): void;
export declare function runDiscreteUpdates(): void;
export declare function asyncUpdates(fn: any, ...param: any[]): any;
export declare function syncUpdates(fn: any): any;

View File

@ -1,53 +0,0 @@
export { VNode } from './vnode/VNode';
declare type Trigger<A> = (A: any) => void;
export declare type UseStateHookType = {
useState<S>(initialState: (() => S) | S): [S, Trigger<((S: any) => S) | S>];
};
export declare type UseReducerHookType = {
useReducer<S, P, A>(reducer: (S: any, A: any) => S, initArg: P, init?: (P: any) => S): [S, Trigger<A>];
};
export declare type UseContextHookType = {
useContext<T>(context: ContextType<T>): T;
};
export declare type JSXElement = {
vtype: any;
src: any;
type: any;
key: any;
ref: any;
props: any;
};
export declare type ProviderType<T> = {
vtype: number;
_context: ContextType<T>;
};
export declare type ContextType<T> = {
vtype: number;
Consumer: ContextType<T> | null;
Provider: ProviderType<T> | null;
value: T;
};
export declare type PortalType = {
vtype: number;
key: null | string;
realNode: any;
children: any;
};
export declare type RefType = {
current: any;
};
export interface PromiseType<R> {
then<U>(onFulfill: (value: R) => void | PromiseType<U> | U, onReject: (error: any) => void | PromiseType<U> | U): void | PromiseType<U>;
}
export interface SuspenseState {
promiseSet: Set<PromiseType<any>> | null;
childStatus: string;
oldChildStatus: string;
didCapture: boolean;
promiseResolved: boolean;
}
export declare type Source = {
fileName: string;
lineNumber: number;
};
export declare type Callback = () => void;

View File

@ -1,17 +0,0 @@
import type { VNode, Callback } from './Types';
export declare type Update = {
type: 'Update' | 'Override' | 'ForceUpdate' | 'Error';
content: any;
callback: Callback | null;
};
export declare type Updates = Array<Update> | null;
export declare enum UpdateState {
Update = "Update",
Override = "Override",
ForceUpdate = "ForceUpdate",
Error = "Error"
}
export declare function newUpdate(): Update;
export declare function pushUpdate(vNode: VNode, update: Update): void;
export declare function processUpdates(vNode: VNode, inst: any, props: any): void;
export declare function pushForceUpdate(vNode: VNode): void;

View File

@ -1,21 +0,0 @@
import { Callback } from '../Types';
/**
* Component的api setState和forceUpdate在实例生成阶段实现
*/
declare class Component<P, S, C> {
props: P;
context: C;
state: S | null;
refs: any;
forceUpdate: any;
isReactComponent: boolean;
constructor(props: P, context: C);
setState(state: S, callback?: Callback): void;
}
/**
* PureComponent
*/
declare class PureComponent<P, S, C> extends Component<P, S, C> {
constructor(props: P, context: C);
}
export { Component, PureComponent };

View File

@ -1,2 +0,0 @@
import type { PortalType } from '../Types';
export declare function createPortal(children: any, realNode: any, key?: string): PortalType;

View File

@ -1,2 +0,0 @@
import type { RefType } from '../Types';
export declare function createRef(): RefType;

View File

@ -1,5 +0,0 @@
export declare function forwardRef(render: Function): {
vtype: number;
$$typeof: number;
render: Function;
};

View File

@ -1,16 +0,0 @@
import type { PromiseType } from '../Types';
declare type LazyContent<T> = {
_status: string;
_value: () => PromiseType<{
default: T;
}> | PromiseType<T> | T | any;
};
export declare type LazyComponent<T, P> = {
vtype: number;
_content: P;
_load: (content: P) => T;
};
export declare function lazy<T>(promiseCtor: () => PromiseType<{
default: T;
}>): LazyComponent<T, LazyContent<T>>;
export {};

View File

@ -1,6 +0,0 @@
export declare function memo<Props>(type: any, compare?: (oldProps: Props, newProps: Props) => boolean): {
vtype: number;
$$typeof: number;
type: any;
compare: (oldProps: Props, newProps: Props) => boolean;
};

View File

@ -1,3 +0,0 @@
import type { VNode, ContextType } from '../../Types';
export declare function resetDepContexts(vNode: VNode): void;
export declare function getNewContext<T>(vNode: VNode, ctx: ContextType<T>, isUseContext?: boolean): T;

View File

@ -1,2 +0,0 @@
import type { ContextType } from '../../Types';
export declare function createContext<T>(val: T): ContextType<T>;

View File

@ -1,6 +0,0 @@
import type { VNode, JSXElement } from '../Types';
export declare const isSameType: (vNode: VNode, ele: JSXElement) => boolean;
export declare function isTextType(newChild: any): boolean;
export declare function isIteratorType(newChild: any): any;
export declare function getIteratorFn(maybeIterable: any): () => Iterator<any>;
export declare function isObjectType(newChild: any): boolean;

View File

@ -1,2 +0,0 @@
import type { VNode } from '../Types';
export declare function createChildrenByDiff(parentNode: VNode, firstChild: VNode | null, newChild: any, isComparing: boolean): VNode | null;

View File

@ -1,8 +0,0 @@
import type { Hook } from './HookType';
export declare function getLastTimeHook(): Hook<any, any>;
export declare function setLastTimeHook(hook: Hook<any, any> | null): void;
export declare function setCurrentHook(hook: Hook<any, any> | null): void;
export declare function throwNotInFuncError(): never;
export declare function createHook(state?: any): Hook<any, any>;
export declare function getNextHook(hook: Hook<any, any>, hooks: Array<Hook<any, any>>): Hook<any, any> | null;
export declare function getCurrentHook(): Hook<any, any>;

View File

@ -1,19 +0,0 @@
import type { ContextType } from '../Types';
import { Ref, Trigger } from './HookType';
declare type BasicStateAction<S> = ((S: any) => S) | S;
declare type Dispatch<A> = (value: A) => void;
export declare function useContext<T>(Context: ContextType<T>): T;
export declare function useState<S = undefined>(): [S | undefined, Dispatch<BasicStateAction<S | undefined>>];
export declare function useState<S>(initialState: (() => S) | S): [S, Dispatch<BasicStateAction<S>>];
export declare function useReducer<S, I, A>(reducer: (S: any, A: any) => S, initialArg: I, init?: (I: any) => S): [S, Trigger<A>];
export declare function useRef<T = undefined>(): Ref<T | undefined>;
export declare function useRef<T>(initialValue: T): Ref<T>;
export declare function useEffect(create: () => (() => void) | void, deps?: Array<any> | null): void;
export declare function useLayoutEffect(create: () => (() => void) | void, deps?: Array<any> | null): void;
export declare function useCallback<T>(callback: T, deps?: Array<any> | null): T;
export declare function useMemo<T>(create: () => T, deps?: Array<any> | null): T;
export declare function useImperativeHandle<T>(ref: {
current: T | null;
} | ((inst: T | null) => any) | null | void, create: () => T, deps?: Array<any> | null): void;
export declare const useDebugValue: () => void;
export {};

View File

@ -1,2 +0,0 @@
import type { VNode } from '../Types';
export declare function runFunctionWithHooks<Props extends Record<string, any>, Arg>(funcComp: (props: Props, arg: Arg) => any, props: Props, arg: Arg, processing: VNode): any;

View File

@ -1,6 +0,0 @@
export declare enum HookStage {
Init = 1,
Update = 2
}
export declare function getHookStage(): HookStage;
export declare function setHookStage(phase: HookStage | null): void;

View File

@ -1,38 +0,0 @@
import { EffectConstant } from './EffectConstant';
declare type ValueOf<T> = T[keyof T];
export interface Hook<S, A> {
state: Reducer<S, A> | Effect | Memo<S> | CallBack<S> | Ref<S>;
hIndex: number;
}
export interface Reducer<S, A> {
stateValue: S | null;
trigger: Trigger<A> | null;
reducer: ((S: any, A: any) => S) | null;
updates: Array<Update<S, A>> | null;
isUseState: boolean;
}
export declare type Update<S, A> = {
action: A;
didCalculated: boolean;
state: S | null;
};
export declare type EffectList = Array<Effect> | null;
export declare type Effect = {
effect: () => (() => void) | void;
removeEffect: (() => void) | void;
dependencies: Array<any> | null;
effectConstant: ValueOf<typeof EffectConstant>;
};
export declare type Memo<V> = {
result: V | null;
dependencies: Array<any> | null;
};
export declare type CallBack<F> = {
func: F | null;
dependencies: Array<any> | null;
};
export declare type Ref<V> = {
current: V;
};
export declare type Trigger<A> = (state: A) => void;
export {};

View File

@ -1 +0,0 @@
export declare function useCallbackImpl<F>(func: F, dependencies?: Array<any> | null): F;

View File

@ -1,4 +0,0 @@
export declare function useEffectForInit(effectFunc: any, deps: any, effectType: any): void;
export declare function useEffectForUpdate(effectFunc: any, deps: any, effectType: any): void;
export declare function useEffectImpl(effectFunc: () => (() => void) | void, deps?: Array<any> | null): void;
export declare function useLayoutEffectImpl(effectFunc: () => (() => void) | void, deps?: Array<any> | null): void;

View File

@ -1,3 +0,0 @@
export declare function useImperativeHandleImpl<R>(ref: {
current: R | null;
} | ((any: any) => any) | null | void, func: () => R, dependencies?: Array<any> | null): void;

View File

@ -1 +0,0 @@
export declare function useMemoImpl<V>(fun: () => V, deps?: Array<any> | null): V;

View File

@ -1,5 +0,0 @@
import type { Hook, Trigger } from './HookType';
import type { VNode } from '../Types';
export declare function TriggerAction<S, A>(vNode: VNode, hook: Hook<S, A>, isUseState: boolean, action: A): void;
export declare function useReducerForInit<S, A>(reducer: any, initArg: any, init: any, isUseState?: boolean): [S, Trigger<A>];
export declare function useReducerImpl<S, P, A>(reducer: (S: any, A: any) => S, initArg: P, init?: (P: any) => S, isUseState?: boolean): [S, Trigger<A>] | void;

View File

@ -1,2 +0,0 @@
import type { Ref } from './HookType';
export declare function useRefImpl<V>(value?: V): Ref<V>;

Some files were not shown because too many files have changed in this diff Show More