tona-options 1.0.21 → 1.0.22

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/README.md CHANGED
@@ -1,18 +1,49 @@
1
1
  # tona-options
2
2
 
3
- Collection of Option Utilities for Tona.
3
+ <p align="center">
4
+ <img src="../../assets/tona.png" alt="Tona" width="100" />
5
+ </p>
4
6
 
5
- ## Usage
7
+ <p align="center">
8
+ Pre-defined option utilities for Tona themes.
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/tona-options"><img src="https://img.shields.io/npm/v/tona-options?style=flat-square" alt="npm version"></a>
13
+ <a href="LICENSE"><img src="https://img.shields.io/npm/l/tona-options?style=flat-square" alt="license"></a>
14
+ </p>
15
+
16
+ **English** | [中文](./README.zh-CN.md)
17
+
18
+ ## Features
19
+
20
+ - **Pre-configured Options** - Common theme options ready to use
21
+ - **Type-safe** - Full TypeScript support
22
+ - **Composable** - Mix and match options as needed
23
+ - **Default Values** - Sensible defaults for all options
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm install tona-options
29
+ ```
6
30
 
7
31
  ```bash
8
- npm i tona-options
32
+ pnpm add tona-options
9
33
  ```
10
34
 
11
- ```js
35
+ ```bash
36
+ yarn add tona-options
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ ```typescript
12
42
  import { getBackgroundOptions } from 'tona-options'
13
43
 
14
- const backgroundOptions = getBackgroundOptions()
15
- console.log(backgroundOptions)
44
+ // Get default options
45
+ const options = getBackgroundOptions()
46
+ console.log(options)
16
47
  // {
17
48
  // enable: false,
18
49
  // value: "",
@@ -21,15 +52,58 @@ console.log(backgroundOptions)
21
52
  // }
22
53
  ```
23
54
 
24
- ```js
25
- const backgroundOptions = getBackgroundOptions({
55
+ ### With Custom Configuration
56
+
57
+ ```typescript
58
+ import { getBackgroundOptions } from 'tona-options'
59
+
60
+ // Override defaults
61
+ const options = getBackgroundOptions({
26
62
  enable: true,
63
+ value: '#f5f5f5',
27
64
  })
28
- console.log(backgroundOptions)
65
+ console.log(options)
29
66
  // {
30
67
  // enable: true,
31
- // value: "",
68
+ // value: "#f5f5f5",
32
69
  // opacity: 0.85,
33
70
  // repeat: false,
34
71
  // }
35
72
  ```
73
+
74
+ ## Available Options
75
+
76
+ ### Background Options
77
+
78
+ ```typescript
79
+ import { getBackgroundOptions } from 'tona-options'
80
+
81
+ const options = getBackgroundOptions({
82
+ enable: true, // Enable background
83
+ value: '#f5f5f5', // Background color or image URL
84
+ opacity: 0.85, // Background opacity
85
+ repeat: false, // Repeat background image
86
+ })
87
+ ```
88
+
89
+ ## Creating Custom Options
90
+
91
+ For creating your own options, use the core `defineOptions` API:
92
+
93
+ ```typescript
94
+ import { defineOptions } from 'tona'
95
+
96
+ const getCustomOptions = defineOptions('customKey', {
97
+ enable: false,
98
+ color: '#000',
99
+ size: 16,
100
+ })
101
+
102
+ // Use in your theme
103
+ const options = getCustomOptions(userConfig)
104
+ ```
105
+
106
+ ## Related
107
+
108
+ - [tona](https://github.com/guangzan/tona/tree/main/packages/core) - Core framework with `defineOptions`
109
+ - [tona-plugins](https://github.com/guangzan/tona/tree/main/packages/plugins) - Official plugins using these options
@@ -0,0 +1,109 @@
1
+ # tona-options
2
+
3
+ <p align="center">
4
+ <img src="../../assets/tona.png" alt="Tona" width="100" />
5
+ </p>
6
+
7
+ <p align="center">
8
+ Tona 主题的预定义配置工具集。
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/tona-options"><img src="https://img.shields.io/npm/v/tona-options?style=flat-square" alt="npm version"></a>
13
+ <a href="LICENSE"><img src="https://img.shields.io/npm/l/tona-options?style=flat-square" alt="license"></a>
14
+ </p>
15
+
16
+ [English](./README.md) | **中文**
17
+
18
+ ## 特性
19
+
20
+ - **预配置选项** - 即用的常用主题选项
21
+ - **类型安全** - 完整的 TypeScript 支持
22
+ - **可组合** - 按需混合搭配选项
23
+ - **默认值** - 所有选项都有合理的默认值
24
+
25
+ ## 安装
26
+
27
+ ```bash
28
+ npm install tona-options
29
+ ```
30
+
31
+ ```bash
32
+ pnpm add tona-options
33
+ ```
34
+
35
+ ```bash
36
+ yarn add tona-options
37
+ ```
38
+
39
+ ## 使用
40
+
41
+ ```typescript
42
+ import { getBackgroundOptions } from 'tona-options'
43
+
44
+ // 获取默认选项
45
+ const options = getBackgroundOptions()
46
+ console.log(options)
47
+ // {
48
+ // enable: false,
49
+ // value: "",
50
+ // opacity: 0.85,
51
+ // repeat: false,
52
+ // }
53
+ ```
54
+
55
+ ### 使用自定义配置
56
+
57
+ ```typescript
58
+ import { getBackgroundOptions } from 'tona-options'
59
+
60
+ // 覆盖默认值
61
+ const options = getBackgroundOptions({
62
+ enable: true,
63
+ value: '#f5f5f5',
64
+ })
65
+ console.log(options)
66
+ // {
67
+ // enable: true,
68
+ // value: "#f5f5f5",
69
+ // opacity: 0.85,
70
+ // repeat: false,
71
+ // }
72
+ ```
73
+
74
+ ## 可用选项
75
+
76
+ ### 背景选项
77
+
78
+ ```typescript
79
+ import { getBackgroundOptions } from 'tona-options'
80
+
81
+ const options = getBackgroundOptions({
82
+ enable: true, // 启用背景
83
+ value: '#f5f5f5', // 背景颜色或图片 URL
84
+ opacity: 0.85, // 背景透明度
85
+ repeat: false, // 重复背景图片
86
+ })
87
+ ```
88
+
89
+ ## 创建自定义选项
90
+
91
+ 要创建自己的选项,请使用核心 `defineOptions` API:
92
+
93
+ ```typescript
94
+ import { defineOptions } from 'tona'
95
+
96
+ const getCustomOptions = defineOptions('customKey', {
97
+ enable: false,
98
+ color: '#000',
99
+ size: 16,
100
+ })
101
+
102
+ // 在主题中使用
103
+ const options = getCustomOptions(userConfig)
104
+ ```
105
+
106
+ ## 相关
107
+
108
+ - [tona](https://github.com/guangzan/tona/tree/main/packages/core) - 包含 `defineOptions` 的核心框架
109
+ - [tona-plugins](https://github.com/guangzan/tona/tree/main/packages/plugins) - 使用这些选项的官方插件
package/dist/index.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import { defineOptions } from "tona";
2
-
3
2
  //#region src/index.ts
4
3
  const getThemeOptions = defineOptions("theme", {
5
4
  name: "reacg",
@@ -210,6 +209,5 @@ const getItemGroupsOptions = defineOptions("itemGroups", {
210
209
  enable: false,
211
210
  groups: []
212
211
  });
213
-
214
212
  //#endregion
215
- export { getAboutOptions, getBackgroundOptions, getBarragesOptions, getCatalogOptions, getChartsOptions, getClickEffectsOptions, getCodeCopyOptions, getCodeHighlightOptions, getCodeLangOptions, getCodeLinenumbersOptions, getCodeTrafficLightOptions, getDarkModeOptions, getDonationOptions, getEmojiOptions, getGiteeOptions, getGithubOptions, getImagePreviewOptions, getItemGroupsOptions, getLicenseOptions, getLinksOptions, getLive2dOptions, getLockScreenOptions, getMusicPlayerOptions, getNotationOptions, getNoticeOptions, getPostBottomImageOptions, getPostListImageOptions, getPostTopImageOptions, getQrcodeOptions, getSignatureOptions, getThemeOptions, getToolsOptions, getWebsiteTagOptions };
213
+ export { getAboutOptions, getBackgroundOptions, getBarragesOptions, getCatalogOptions, getChartsOptions, getClickEffectsOptions, getCodeCopyOptions, getCodeHighlightOptions, getCodeLangOptions, getCodeLinenumbersOptions, getCodeTrafficLightOptions, getDarkModeOptions, getDonationOptions, getEmojiOptions, getGiteeOptions, getGithubOptions, getImagePreviewOptions, getItemGroupsOptions, getLicenseOptions, getLinksOptions, getLive2dOptions, getLockScreenOptions, getMusicPlayerOptions, getNotationOptions, getNoticeOptions, getPostBottomImageOptions, getPostListImageOptions, getPostTopImageOptions, getQrcodeOptions, getSignatureOptions, getThemeOptions, getToolsOptions, getWebsiteTagOptions };
package/package.json CHANGED
@@ -1,33 +1,30 @@
1
1
  {
2
2
  "name": "tona-options",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "",
5
+ "keywords": [
6
+ "博客园"
7
+ ],
8
+ "homepage": "https://github.com/guangzan/tona/tree/main/packages/options#readme",
9
+ "bugs": {
10
+ "url": "https://github.com/guangzan/tona/issues"
11
+ },
12
+ "license": "MIT",
5
13
  "author": {
6
14
  "name": "guangzan",
7
- "url": "https://www.cnblogs.com/guangzan",
8
- "email": "guangzan1999@outlook.com"
15
+ "email": "guangzan1999@outlook.com",
16
+ "url": "https://www.cnblogs.com/guangzan"
9
17
  },
10
- "license": "MIT",
11
- "homepage": "https://github.com/guangzan/tona/tree/main/packages/options#readme",
12
18
  "repository": {
13
19
  "type": "git",
14
20
  "url": "git+https://github.com/guangzan/tona.git",
15
21
  "directory": "packages/options"
16
22
  },
17
- "bugs": {
18
- "url": "https://github.com/guangzan/tona/issues"
19
- },
20
- "keywords": [
21
- "博客园"
23
+ "files": [
24
+ "dist"
22
25
  ],
23
- "sideEffects": false,
24
26
  "type": "module",
25
- "exports": {
26
- ".": {
27
- "types": "./dist/index.d.ts",
28
- "import": "./dist/index.mjs"
29
- }
30
- },
27
+ "sideEffects": false,
31
28
  "main": "./dist/index.mjs",
32
29
  "module": "./dist/index.mjs",
33
30
  "types": "./dist/index.d.ts",
@@ -39,21 +36,24 @@
39
36
  ]
40
37
  }
41
38
  },
42
- "files": [
43
- "dist"
44
- ],
39
+ "exports": {
40
+ ".": {
41
+ "types": "./dist/index.d.ts",
42
+ "import": "./dist/index.mjs"
43
+ }
44
+ },
45
45
  "dependencies": {
46
- "tona": "1.0.21"
46
+ "tona": "1.0.22"
47
47
  },
48
48
  "devDependencies": {
49
- "@types/node": "^25.0.3",
50
- "tsdown": "latest",
51
- "vitest": "^4.0.16"
49
+ "@types/node": "^25.5.0",
50
+ "vite-plus": "latest",
51
+ "vitest": "npm:@voidzero-dev/vite-plus-test@latest"
52
52
  },
53
53
  "scripts": {
54
- "dev": "tsdown --watch",
55
- "build": "tsdown",
56
- "test": "vitest",
57
- "test:run": "vitest run"
54
+ "dev": "vp pack --watch",
55
+ "build": "vp pack",
56
+ "test": "vp test",
57
+ "test:run": "vp test run"
58
58
  }
59
59
  }