Skip to content

Commit c40cc7f

Browse files
committed
Refactor documentation for storage, string, theme, and utility functions
- Updated `storage.md` to improve clarity and consistency in API descriptions for dbStorage, jsSession, jsCookie, and jsLocal. - Enhanced `string.md` with detailed descriptions for string manipulation functions including camelize, hyphenate, and trim. - Added new documentation for theme-related functions in `theme.md`, including useSystemColor. - Introduced new utility functions in `to.md` for converting data formats, including arrayToExcel, base64ToBlob, and fileToBase64. - Created new type definitions in `types.md` to enhance type safety and documentation. - Added Vite plugin documentation in `vite.md` for various Vite plugins. - Improved waterfall layout documentation in `waterfall.md` for better understanding of parameters and usage. - Established foundational documentation for Web Components in `webComponent.md`, detailing shadow DOM management.
1 parent 4e20296 commit c40cc7f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+8346
-6946
lines changed

src/content/docs/api/animate.md

Lines changed: 440 additions & 0 deletions
Large diffs are not rendered by default.

src/content/docs/api/array.md

Lines changed: 125 additions & 345 deletions
Large diffs are not rendered by default.

src/content/docs/api/canvas.md

Lines changed: 33 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -3,206 +3,72 @@ title: Canvas
33
description: Canvas
44
---
55

6-
## sliderValidation
7-
8-
🧿 滑块验证功能
9-
10-
```typescript
11-
/**
12-
* @Class sliderValidation
13-
* @param { string } url 背景图片地址
14-
* @param { string | Element } container 滑块容器
15-
* @param { number } width 滑块大小 默认42px
16-
* @param { () => void } callback 滑块验证成功回调函数
17-
* @return { void }
18-
* @desc 📝 滑块验证功能
19-
* @example
20-
import { sliderValidation } from './lazy-js-utils'
21-
22-
sliderValidation('/assets/image.jpg', document.body)
23-
*/
24-
```
25-
266
## Canvas
277

28-
🧿 快速拿到 canvas 和 ctx
29-
30-
```typescript
31-
/**
32-
* @Class Canvas
33-
* @param { number } width canvas宽度
34-
* @param { number } height canvas高度
35-
* @desc 📝 快速拿到canvas和ctx
36-
* @return { { canvas, ctx } }
37-
* @example
38-
import { Canvas } from './lazy-js-utils'
39-
40-
const { canvas, ctx } = new Canvas(150,150)
41-
*/
42-
```
43-
44-
## getImageData
45-
46-
🧿 快速获取 canvas 的 imageData
47-
48-
```typescript
49-
/**
50-
* @Class getImageData
51-
* @param { string } src 图片地址
52-
* @desc 📝 快速获取canvas的imageData
53-
* @return { { data, width, height } }
54-
* @example
55-
import { getImageData } from './lazy-js-utils'
56-
57-
const { data, width, height } = await getImageData('/assets/image.jpg')
58-
*/
59-
```
8+
_暂无文档注释,欢迎补充。_
609

6110
## CreateSignatureCanvas
6211

63-
🧿CreateSignatureCanvas
12+
创建签名画布工具类
13+
EN: Utility class to create and manage a signature canvas with drawing, undo/redo, and export features.
6414

65-
```typescript
15+
```ts
6616
/**
67-
* @Class CreateSignatureCanvas
68-
* @param { number } width canvas宽度
69-
* @param { number } height canvas高度
70-
* @desc 📝 生成一个签名的canvas模板, 默认监听键盘事件ctrl+z撤销 ctrl+x恢复
71-
* @return { signature }
72-
* @example
73-
import { CreateSignatureCanvas } from './lazy-js-utils'
74-
75-
const signature = new CreateSignatureCanvas(400, 400)
76-
document.body.appendChild(signature.canvas)
77-
const base64 = signature.save()
78-
signature.clear() // 清除签名
79-
signature.undo() // 撤销上一步
80-
signature.redo() // 恢复上一步
17+
* 创建签名画布工具类
18+
* @description EN: Utility class to create and manage a signature canvas with drawing, undo/redo, and export features.
8119
*/
8220
```
8321

8422
## DotImageCanvas
8523

86-
🧿 将图片的像素转为点阵图片
24+
DotImageCanvas 将图片转换为点阵图形式展示,并提供动画绘制效果
25+
EN: Convert an image to a dot-matrix representation and provide animated drawing controls with various directions, colors, background and animation options.
8726

88-
```typescript
27+
```ts
8928
/**
90-
* @Class DotImageCanvas
91-
* @param { string } src 图片路径
92-
* @param { string } color 点阵的颜色 为空则取原像素颜色
93-
* @param { number } fontWeight 点阵的粗细
94-
* @param { string } bgColor 图片背景色 默认为白色
95-
* @desc 📝 将图片的像素转为点阵图片
96-
* @return { dotImage }
97-
* @example
98-
import { DotImageCanvas } from './lazy-js-utils'
99-
100-
const dotImage = new DotImageCanvas('./img/1.jpg','red', 1, '#000')
101-
dotImage.append('#main')
102-
// 如果有更新,可以调用dotImage.repaint('xxx','xxx',x)更新,url一致回会服用上次的图片,只更新颜色和粗细
103-
setTimeout(() => {
104-
dotImage.repaint('./img/1.jpg','yellow' 1, '#000')
105-
}, 1000)
29+
* DotImageCanvas 将图片转换为点阵图形式展示,并提供动画绘制效果
30+
*
31+
* 支持多种绘制方向,颜色控制,背景设置,以及动画效果控制
32+
* @class
33+
* @description EN: Convert an image to a dot-matrix representation and provide animated drawing controls with various directions, colors, background and animation options.
10634
*/
10735
```
10836

10937
## DotTextCanvas
11038

111-
🧿 根据文字返回一个点阵的 canvas
39+
DotTextCanvas 将文字转换为点阵形式展示,并提供动画绘制效果
40+
EN: Convert text into a dot-matrix representation and animate the drawing with configurable direction, color and spacing options.
11241

113-
```typescript
42+
```ts
11443
/**
115-
* @Class DotTextCanvas
116-
* @param { string } text 文字
117-
* @param { number } fontSize 字体大小
118-
* @param { string } color 字体颜色
119-
* @param { number } fontWeight 点阵粗细
120-
* @desc 📝 根据文字返回一个点阵的canvas
121-
* @return { dotText }
122-
* @example
123-
import { DotTextCanvas } from './lazy-js-utils'
124-
125-
// 可从dotText.status判断是否加载完成,如果加载完成,可以调用dotText.repaint(xxx)更新文字
126-
const dotText = DotTextCanvas('hello', 20, '#000', 1)
127-
dotText.append('#main') // 将canvas插入到指定元素中
44+
* DotTextCanvas 将文字转换为点阵形式展示,并提供动画绘制效果
45+
*
46+
* 支持多种绘制方向、颜色控制、间距设置以及动画效果
47+
* @class
48+
* @description EN: Convert text into a dot-matrix representation and animate the drawing with configurable direction, color and spacing options.
12849
*/
12950
```
13051

52+
## getImageData
53+
54+
_暂无文档注释,欢迎补充。_
55+
13156
## removeRoundSpace
13257

133-
🧿 删除二维数组周围为 0 的长度,一般用于图片或者 canvas 的处理
58+
_暂无文档注释,欢迎补充。_
13459

135-
```typescript
136-
/**
137-
* @Class removeRoundSpace
138-
* @param { number[][] } data 二维数组
139-
* @desc 📝 删除二维数组周围为0的长度
140-
* @return { number[][] }
141-
* @example
142-
import { removeRoundSpace } from './lazy-js-utils'
143-
144-
const data = [
145-
[0,0,0,0,0],
146-
[0,1,1,1,0],
147-
[0,1,1,1,0],
148-
[0,0,0,0,0]
149-
]
150-
removeRoundSpace(data) // [[1,1,1],[1,1,1]]
151-
*/
152-
```
60+
## sliderValidation
61+
62+
_暂无文档注释,欢迎补充。_
15363

15464
## Line
15565

156-
🧿 快速画线
157-
158-
```typescript
159-
/**
160-
* @Class Line
161-
* @param { ctx: CanvasRenderingContext2D
162-
color: string
163-
isFill: boolean }
164-
* @example
165-
import { Line } from './lazy-js-utils'
166-
167-
const line = new Line(ctx,'red')
168-
line.draw([0,0],[100,100])
169-
*/
170-
```
66+
_暂无文档注释,欢迎补充。_
17167

17268
## Point
17369

174-
🧿 快速画点
175-
176-
```typescript
177-
/**
178-
* @Class Point
179-
* @param { r: number
180-
ctx: CanvasRenderingContext2D
181-
color: string
182-
}
183-
* @example
184-
import { Point } from './lazy-js-utils'
185-
186-
const point = new Point(ctx,'red')
187-
point.draw(0,0,'red',10)
188-
*/
189-
```
70+
_暂无文档注释,欢迎补充。_
19071

19172
## Square
19273

193-
🧿 快速画矩形
194-
195-
```typescript
196-
/**
197-
* @Class Square
198-
* @param { r: number
199-
ctx: CanvasRenderingContext2D
200-
color: string
201-
}
202-
* @example
203-
import { Point } from './lazy-js-utils'
204-
205-
const square = new Square(ctx,'red')
206-
square.draw(0,0,'red',10)
207-
*/
208-
```
74+
_暂无文档注释,欢迎补充。_

0 commit comments

Comments
 (0)