Skip to content

Commit

Permalink
feat: update github actions (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaxus authored Aug 12, 2023
1 parent de3f2e3 commit 5deec3d
Show file tree
Hide file tree
Showing 44 changed files with 21,477 additions and 15,645 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = defineConfig({
tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'],
},
],
'no-restricted-globals':'off',
'no-restricted-globals': 'off',
'regexp/no-obscure-range': 'off',
'node/no-missing-require': [
'error',
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ jobs:
- name: Install deps
run: pnpm install

- name: Build
run: pnpm run build

- name: format
run: pnpm run format

- name: Lint
run: pnpm run lint

- name: Test
run: pnpm run test

- name: Lint
run: pnpm run lint
- name: Build
run: pnpm run build
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist/
LICENSE.md
pnpm-lock.yaml
pnpm-workspace.yaml
pnpm-workspace.yaml
assets
2 changes: 1 addition & 1 deletion bin/test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pnpm -F ranuts test
pnpm -F ranuts build
# pnpm -F ranui test
pnpm -F ranui test
13 changes: 0 additions & 13 deletions packages/docs/.vitepress/cache/deps/_metadata.json

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions packages/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export default defineConfig({
vue: {
template: {
compilerOptions: {
isCustomElement: (tag) => {
return tag.startsWith('r-')
}
}
}
isCustomElement: (tag) => {
return tag.startsWith('r-')
},
},
},
},
head: [
['link', { rel: 'icon', href: '/favicon.ico' }],
Expand Down Expand Up @@ -88,6 +88,7 @@ export default defineConfig({
items: [
{ text: 'Message 全局提示', link: '/src/ranui/message/' },
{ text: 'Skeleton 骨架屏', link: '/src/ranui/skeleton/' },
// { text: 'Modal 对话框', link: '/src/ranui/modal/' },
],
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
if (typeof window !== 'undefined') {
const script = document.createElement('script')
script.async = true
script.setAttribute('src',GTAG)
script.setAttribute('src', GTAG)
const codeScript = document.createElement('script')
codeScript.innerText = code
document.body.appendChild(script)
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"vitepress": "1.0.0-alpha.65"
},
"dependencies": {
"ranui": "workspace:0.1.1-alpha.9",
"ranui": "workspace:0.1.1-alpha.10",
"ranuts": "0.1.0-alpha.5"
}
}
2 changes: 1 addition & 1 deletion packages/docs/src/article/astParse/tokenizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ type SingleCharTokens = '(' | ')' | '{' | '}' | '='
// 单字符到 Token 生成器的映射
const KNOWN_SINGLE_CHAR_TOKENS = new Map<
SingleCharTokens,
typeof TOKENS_GENERATOR[keyof typeof TOKENS_GENERATOR]
(typeof TOKENS_GENERATOR)[keyof typeof TOKENS_GENERATOR]
>([
['(', TOKENS_GENERATOR.leftParen],
[')', TOKENS_GENERATOR.rightParen],
Expand Down
28 changes: 11 additions & 17 deletions packages/docs/src/ranui/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
<script src="./ranui/dist/index.umd.cjs"></script>

<body>
<r-button>Button</r-button>
<r-button>Button</r-button>
</body>
```

- vue

```vue
<template>
<r-button>Button</r-button>
<r-button>Button</r-button>
</template>
```

Expand All @@ -42,26 +42,24 @@
```jsx
import Button from 'ranui'
const App = () => {
return (
<>
<r-button>Button</r-button>
</>
)
return (
<>
<r-button>Button</r-button>
</>
)
}

```


- js

```js
import 'ranui'

const Button = document.createElement('r-button')
const Button = document.createElement('r-button')
Button.appendChild('this is button text')
document.body.appendChild(Button)

```

大多数情况都可以像原生的`div`标签一样使用

## 全量引入
Expand All @@ -70,7 +68,6 @@ document.body.appendChild(Button)
import 'ranui'
```


## 按需引入

```ts
Expand Down Expand Up @@ -133,7 +130,7 @@ import Button from 'ranui'
<r-button onclick="message.warning('这是一条提示')">警告提示</r-button>
<r-button onclick="message.error('这是一条提示')">错误提示</r-button>
<r-button onclick="message.success('这是一条提示')">成功提示</r-button>
<r-button onclick="message.toast('这是一条提示')">toast提示</r-button>
<r-button onclick="message.toast('这是一条提示')">toast 提示</r-button>

- Tab

Expand All @@ -145,13 +142,10 @@ import Button from 'ranui'
</r-tabs>
</div>



## 兼容性

- 不支持 IE,其他均有较好支持
![](../../assets/ranui/customElements.png)

![](../../assets/ranui/customElements.png)

## 相关资源

Expand Down
Empty file.
74 changes: 35 additions & 39 deletions packages/docs/src/ranui/preview/index.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,51 @@
# preview 预览组件

支持`docx``pptx``pdf`文件的预览
支持`docx``pptx``pdf`,`xlsx`文件的预览

## 代码演示

预览`docx`

<div style="width: 100px;margin-top:10px">
<r-preview id="docx"><r-icon name="preview" size="30" color="#1E90FF"></r-icon>点击预览</r-preview>
<r-button type="primary" onclick="uploadFile('docx')">上传docx</r-button>
<div style="width: 100px; margin-top:10px">
<r-preview id="preview"></r-preview>
<r-button type="primary" onclick="uploadFile('preview')">choose file to preview</r-button>
</div>

```xml
<r-preview >点击预览</r-preview>
<r-button type="primary" onclick="uploadFile()">上传docx</r-button>
```html
<r-preview ></r-preview>
<r-button type="primary" onclick="uploadFile()">上传docx</r-button>

<script>
const uploadFile = () => {
const preview = document.getElementById('preview')
const uploadFile = document.createElement('input')
uploadFile.setAttribute('type', 'file')
uploadFile.click()
uploadFile.onchange = (e) => {
const { files = [] } = uploadFile
if (files.length > 0) {
preview.setAttribute('src', '')
const file = files[0]
const url = URL.createObjectURL(file)
preview.setAttribute('src', url)
}
}
}
</script>
```

预览`pptx`

<div style="width: 100px;margin-top:10px">
<r-preview id="pptx"><r-icon name="preview" size="30" color="#1E90FF"></r-icon>点击预览</r-preview>
<r-button type="primary" onclick="uploadFile('pptx')">上传pptx</r-button>
</div>
## 属性

```xml
<r-icon name="eye"></r-icon><r-preview >点击预览</r-preview>
<r-button type="primary" onclick="uploadFile()">上传pptx</r-button>
```
### 资源地址`src`

预览`pdf`
`src` 地址即可打开弹窗,没有`src`就不展示

<div style="width: 100px;margin-top:10px">
<r-preview id="pdf"><r-icon name="preview" size="30" color="#1E90FF"></r-icon>点击预览</r-preview>
<r-button type="primary" onclick="uploadFile('pdf')">上传pptx</r-button>
</div>

```xml
<r-icon name="eye"></r-icon><r-preview >点击预览</r-preview>
<r-button type="primary" onclick="uploadFile()">上传pdf</r-button>
```html
<r-preview src=""></r-preview>
```

## 属性

### 预览的文件地址`src`
### 是否可关闭`closeable`

需要注意的是,链接需要支持跨域,否则请求不了资源
`closeable` 不设置默认为 `true` ,可以关闭,传 `false` 表示不展示关闭按钮,不可关闭

<r-icon name="preview" size="30" color="#1E90FF"></r-icon>点击预览
<r-preview src="//www.ecma-international.org/wp-content/uploads/ECMA-423_1st_edition_june_2023.pdf"></r-preview>

```xml
<r-icon name="preview" size="30" color="#1E90FF"></r-icon>点击预览
<r-preview src="//www.ecma-international.org/wp-content/uploads/ECMA-422_1st_edition_december_2022.pdf"></r-preview>
```
```html
<r-preview closeable="false"></r-preview>
```
6 changes: 3 additions & 3 deletions packages/docs/src/ranui/tabs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@

```html
<r-tabs>
<r-tab icon="home" iconSize='22'>tab1</r-tab>
<r-tab icon="message" iconSize='22'>tab2</r-tab>
<r-tab icon="user" iconSize='22'>tab3</r-tab>
<r-tab icon="home" iconSize="22">tab1</r-tab>
<r-tab icon="message" iconSize="22">tab2</r-tab>
<r-tab icon="user" iconSize="22">tab3</r-tab>
</r-tabs>
```

Expand Down
Loading

0 comments on commit 5deec3d

Please sign in to comment.