@nsnanocat/preference-panes 0.3.1 → 0.4.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/README.md +39 -2
- package/dist/settings/app.mjs +1044 -0
- package/dist/settings/home.css +134 -0
- package/dist/settings/index.html +15 -0
- package/dist/settings/panel.css +325 -0
- package/package.json +3 -2
- package/src/PreferencesHandler.mjs +50 -0
- package/src/browser/app.mjs +154 -0
- package/src/browser/home.css +134 -0
- package/src/browser/site.html +15 -0
- package/src/index.d.ts +23 -0
- package/src/index.mjs +1 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/* 通用菜单样式;项目可通过 JSON 引用官方组件样式。
|
|
2
|
+
* Generic menu styles; projects may reference official component styles through JSON. */
|
|
3
|
+
body {
|
|
4
|
+
margin: 0;
|
|
5
|
+
overflow-x: hidden;
|
|
6
|
+
font-family: system-ui, sans-serif;
|
|
7
|
+
background: #f6f7f8;
|
|
8
|
+
color: #18191c;
|
|
9
|
+
}
|
|
10
|
+
.pp-home {
|
|
11
|
+
max-width: 720px;
|
|
12
|
+
margin: auto;
|
|
13
|
+
padding: 32px 16px;
|
|
14
|
+
}
|
|
15
|
+
.brand-logo {
|
|
16
|
+
display: block;
|
|
17
|
+
width: 64px;
|
|
18
|
+
height: 64px;
|
|
19
|
+
margin: auto;
|
|
20
|
+
}
|
|
21
|
+
.brand-logo img {
|
|
22
|
+
display: block;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
object-fit: contain;
|
|
26
|
+
}
|
|
27
|
+
.pp-home h1 {
|
|
28
|
+
text-align: center;
|
|
29
|
+
font-size: 26px;
|
|
30
|
+
margin: 12px 0 32px;
|
|
31
|
+
}
|
|
32
|
+
.self-panel {
|
|
33
|
+
padding: 12px;
|
|
34
|
+
background: #fff;
|
|
35
|
+
border-radius: 12px;
|
|
36
|
+
}
|
|
37
|
+
.self-panel .header {
|
|
38
|
+
font-size: 16px;
|
|
39
|
+
margin: 0;
|
|
40
|
+
padding: 0 6px;
|
|
41
|
+
}
|
|
42
|
+
.self-panel .container {
|
|
43
|
+
margin-top: 16px;
|
|
44
|
+
}
|
|
45
|
+
.self-panel .self-item {
|
|
46
|
+
width: 25%;
|
|
47
|
+
min-width: 0;
|
|
48
|
+
border: 0;
|
|
49
|
+
background: none;
|
|
50
|
+
padding: 12px 2px;
|
|
51
|
+
color: inherit;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
.self-panel .self-item .logo {
|
|
55
|
+
display: block;
|
|
56
|
+
width: 56px;
|
|
57
|
+
height: 56px;
|
|
58
|
+
padding: 10px;
|
|
59
|
+
box-sizing: border-box;
|
|
60
|
+
border-radius: 50%;
|
|
61
|
+
background: #f1f2f3;
|
|
62
|
+
}
|
|
63
|
+
.self-panel .logo img {
|
|
64
|
+
display: block;
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 100%;
|
|
67
|
+
object-fit: contain;
|
|
68
|
+
}
|
|
69
|
+
.self-panel .self-item.is-zh .name {
|
|
70
|
+
font-size: 13px;
|
|
71
|
+
line-height: 20px;
|
|
72
|
+
margin-top: 8px;
|
|
73
|
+
white-space: normal;
|
|
74
|
+
}
|
|
75
|
+
.module-status {
|
|
76
|
+
font-size: 11px;
|
|
77
|
+
line-height: 16px;
|
|
78
|
+
min-height: 16px;
|
|
79
|
+
color: #9499a0;
|
|
80
|
+
}
|
|
81
|
+
.self-item:disabled {
|
|
82
|
+
opacity: 0.45;
|
|
83
|
+
cursor: default;
|
|
84
|
+
}
|
|
85
|
+
.settings-note {
|
|
86
|
+
font-size: 13px;
|
|
87
|
+
line-height: 1.6;
|
|
88
|
+
color: #797f89;
|
|
89
|
+
padding: 16px 0;
|
|
90
|
+
}
|
|
91
|
+
@media (prefers-color-scheme: dark) {
|
|
92
|
+
body {
|
|
93
|
+
background: #101114;
|
|
94
|
+
color: #e3e5e7;
|
|
95
|
+
}
|
|
96
|
+
.self-panel {
|
|
97
|
+
background: #1c1d20;
|
|
98
|
+
}
|
|
99
|
+
.self-panel .self-item .logo {
|
|
100
|
+
background: #303136;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
:root[data-theme="dark"] body {
|
|
104
|
+
background: #101114;
|
|
105
|
+
color: #e3e5e7;
|
|
106
|
+
}
|
|
107
|
+
:root[data-theme="dark"] .self-panel {
|
|
108
|
+
background: #1c1d20;
|
|
109
|
+
}
|
|
110
|
+
:root[data-theme="dark"] .self-panel .self-item .logo {
|
|
111
|
+
background: #303136;
|
|
112
|
+
}
|
|
113
|
+
:root[data-theme="light"] body {
|
|
114
|
+
background: #f6f7f8;
|
|
115
|
+
color: #18191c;
|
|
116
|
+
}
|
|
117
|
+
:root[data-theme="light"] .self-panel {
|
|
118
|
+
background: #fff;
|
|
119
|
+
}
|
|
120
|
+
:root[data-theme="light"] .self-panel .self-item .logo {
|
|
121
|
+
background: #f1f2f3;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.self-panel .scroll {
|
|
125
|
+
display: flex;
|
|
126
|
+
}
|
|
127
|
+
.self-panel .self-item {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
align-items: center;
|
|
131
|
+
}
|
|
132
|
+
.pp-site-error {
|
|
133
|
+
padding: 16px;
|
|
134
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
|
6
|
+
<meta name="color-scheme" content="light dark">
|
|
7
|
+
<title>Preferences</title>
|
|
8
|
+
<link rel="stylesheet" href="/settings/assets/panel.css?v=__VERSION__">
|
|
9
|
+
<link rel="stylesheet" href="/settings/assets/home.css?v=__VERSION__">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<main id="preferences"></main>
|
|
13
|
+
<script type="module" src="/settings/assets/app.mjs?v=__VERSION__"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
package/src/index.d.ts
CHANGED
|
@@ -84,6 +84,29 @@ export interface SettingsHandlerOptions {
|
|
|
84
84
|
/** 默认 X-Settings-Client,值必须为 1;不是认证凭据 / Defaults to X-Settings-Client with value 1; not an authentication credential. */
|
|
85
85
|
requestHeader?: string;
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* 原生 Mock 的等价资源映射,支持不具备该语法的代理。
|
|
89
|
+
* Equivalent resource mapping for proxies lacking native Mock syntax.
|
|
90
|
+
*/
|
|
91
|
+
export interface PreferencesHandlerOptions extends SettingsHandlerOptions {
|
|
92
|
+
/** 按 pathname 匹配,不匹配下载源自身 / Match pathnames without intercepting the download source itself. */
|
|
93
|
+
resources: Array<{
|
|
94
|
+
/** 锚定的 pathname 正则 / Anchored pathname regular expression. */
|
|
95
|
+
pattern: string;
|
|
96
|
+
/** HTTPS 下载源 / HTTPS resource source. */
|
|
97
|
+
source: string;
|
|
98
|
+
/** 响应媒体类型 / Response media type. */
|
|
99
|
+
contentType: string;
|
|
100
|
+
}>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 通用安装入口;API 保持无网络读写,静态请求才下载资源。
|
|
104
|
+
* Generic installation entry; APIs remain network-free and only static requests download resources.
|
|
105
|
+
*/
|
|
106
|
+
export class PreferencesHandler extends SettingsHandler {
|
|
107
|
+
/** @param options 安装 JSON 配置 / Installation JSON configuration. */
|
|
108
|
+
constructor(options: PreferencesHandlerOptions);
|
|
109
|
+
}
|
|
87
110
|
/**
|
|
88
111
|
* 属于单个模块的字段、存储根及可选展示元数据。
|
|
89
112
|
* Fields, storage root and optional display metadata belonging to one module.
|
package/src/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { normalizeBoxJs } from "./lib/boxjs.mjs";
|
|
2
2
|
export { parseSettingsPath } from "./lib/settings-path.mjs";
|
|
3
|
+
export { PreferencesHandler } from "./PreferencesHandler.mjs";
|
|
3
4
|
/**
|
|
4
5
|
* 通用代理处理器与配置解析的公开入口。
|
|
5
6
|
* Public entry for the proxy handler and configuration parsing.
|