@nsnanocat/preference-panes 0.2.0 → 0.3.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.
@@ -1,126 +1,325 @@
1
+ /* 分组列表沿用 Bilibili 设置页的行结构,样式限定在面板内。
2
+ * Grouped rows follow the Bilibili settings layout, scoped to the panel. */
1
3
  .pp-panel {
2
- font:
3
- 15px / 1.5 system-ui,
4
- sans-serif;
5
- color: var(--pp-text, #18191c);
6
- background: var(--pp-background, #f6f7f8);
7
- max-width: 760px;
8
- margin: auto;
9
- position: relative;
4
+ --pp-text: #18191c;
5
+ --pp-background: #f6f7f8;
6
+ --pp-surface: #fff;
7
+ --pp-border: #e3e5e7;
8
+ --pp-muted: #9499a0;
9
+ --pp-accent: #fb7299;
10
+ font:
11
+ 15px / 1.5 -apple-system,
12
+ BlinkMacSystemFont,
13
+ "Segoe UI",
14
+ sans-serif;
15
+ color: var(--pp-text);
16
+ background: var(--pp-background);
17
+ position: relative;
18
+ min-height: 100vh;
10
19
  }
11
20
  .pp-panel * {
12
- box-sizing: border-box;
21
+ box-sizing: border-box;
22
+ letter-spacing: 0;
13
23
  }
14
24
  .pp-header {
15
- display: flex;
16
- align-items: center;
17
- gap: 12px;
18
- padding: 12px 16px;
19
- background: var(--pp-surface, #fff);
25
+ height: calc(52px + env(safe-area-inset-top));
26
+ padding: env(safe-area-inset-top) 12px 0;
27
+ display: flex;
28
+ align-items: center;
29
+ background: var(--pp-surface);
30
+ border-bottom: 1px solid var(--pp-border);
31
+ position: relative;
20
32
  }
21
33
  .pp-title {
22
- font-size: 18px;
23
- margin: 0;
24
- overflow-wrap: anywhere;
25
- min-width: 0;
34
+ font-size: 17px;
35
+ font-weight: 500;
36
+ margin: 0;
37
+ min-width: 0;
38
+ overflow-wrap: anywhere;
26
39
  }
27
- .pp-module-info {
28
- display: flex;
29
- gap: 12px;
30
- margin-bottom: 16px;
40
+ .pp-header .pp-title {
41
+ flex: 1;
42
+ text-align: center;
31
43
  }
32
- .pp-module-icon {
33
- width: 48px;
34
- height: 48px;
35
- flex: none;
36
- object-fit: contain;
44
+ .pp-nav-spacer {
45
+ width: 44px;
46
+ flex: none;
37
47
  }
38
- .pp-module-details {
39
- min-width: 0;
40
- overflow-wrap: anywhere;
48
+ .pp-panel button {
49
+ font: inherit;
50
+ cursor: pointer;
51
+ border: 0;
52
+ background: none;
53
+ color: inherit;
41
54
  }
42
- .pp-module-source {
43
- color: inherit;
44
- text-decoration: underline;
55
+ .pp-panel .pp-back {
56
+ width: 44px;
57
+ height: 44px;
58
+ flex: none;
59
+ font-size: 34px;
60
+ line-height: 32px;
61
+ padding: 0;
62
+ }
63
+ .pp-panel button:disabled {
64
+ opacity: 0.5;
65
+ cursor: wait;
45
66
  }
46
67
  .pp-viewport {
47
- max-height: 80vh;
48
- overflow: auto;
49
- padding: 16px;
68
+ position: relative;
69
+ height: calc(100vh - 52px - env(safe-area-inset-top));
70
+ overflow: hidden;
50
71
  }
51
- .pp-panel button {
52
- font: inherit;
53
- cursor: pointer;
54
- border: 1px solid var(--pp-border, #d8dce0);
55
- border-radius: 8px;
56
- padding: 8px 12px;
57
- color: inherit;
58
- background: var(--pp-surface, #fff);
72
+ @supports (height: 100dvh) {
73
+ .pp-viewport {
74
+ height: calc(100dvh - 52px - env(safe-area-inset-top));
75
+ }
59
76
  }
60
- .pp-panel button:disabled {
61
- opacity: 0.45;
62
- cursor: default;
77
+ .pp-fields,
78
+ .pp-choice-page {
79
+ position: absolute;
80
+ inset: 0;
81
+ overflow: auto;
82
+ padding: 12px max(16px, calc((100% - 688px) / 2)) calc(28px + env(safe-area-inset-bottom));
83
+ background: var(--pp-background);
63
84
  }
64
- .pp-field {
65
- margin: 0 0 16px;
66
- padding: 16px;
67
- border: 1px solid var(--pp-border, #d8dce0);
68
- border-radius: 10px;
69
- background: var(--pp-surface, #fff);
70
- min-width: 0;
85
+ .pp-panel .form-group {
86
+ margin: 0 0 12px;
71
87
  }
72
- .pp-description {
73
- font-size: 13px;
74
- opacity: 0.7;
75
- margin: 0 0 8px;
76
- white-space: pre-wrap;
77
- overflow-wrap: anywhere;
78
- }
79
- .pp-input:not([type="checkbox"]) {
80
- width: 100%;
81
- font: inherit;
82
- padding: 8px;
83
- border: 1px solid var(--pp-border, #d8dce0);
84
- border-radius: 6px;
85
- background: var(--pp-surface, #fff);
86
- color: inherit;
88
+ .pp-panel .form-group__title {
89
+ font-size: 12px;
90
+ line-height: 17px;
91
+ font-weight: 400;
92
+ color: var(--pp-muted);
93
+ padding-left: 12px;
94
+ margin: 12px 0 6px;
95
+ }
96
+ .pp-panel .form-group__row {
97
+ border-radius: 8px;
98
+ overflow: hidden;
99
+ background: var(--pp-surface);
100
+ }
101
+ .pp-panel .form-row {
102
+ position: relative;
103
+ display: flex;
104
+ align-items: center;
105
+ width: 100%;
106
+ min-height: 46px;
107
+ padding: 12px;
108
+ border: 0;
109
+ border-bottom: 1px solid var(--pp-border);
110
+ background: var(--pp-surface);
111
+ gap: 12px;
112
+ }
113
+ .pp-panel .form-row:last-child {
114
+ border-bottom: 0;
115
+ }
116
+ .pp-panel .form-row__text {
117
+ flex: 1;
118
+ min-width: 0;
119
+ margin: 0;
120
+ display: flex;
121
+ flex-direction: column;
122
+ }
123
+ .pp-panel .form-row__title {
124
+ font-size: 15px;
125
+ line-height: 22px;
126
+ color: var(--pp-text);
127
+ text-align: left;
128
+ }
129
+ .pp-panel .form-row__subtitle {
130
+ font-size: 12px;
131
+ line-height: 18px;
132
+ color: var(--pp-muted);
133
+ overflow-wrap: anywhere;
134
+ margin-top: 2px;
135
+ }
136
+ .pp-choice-link {
137
+ display: flex;
138
+ align-items: center;
139
+ justify-content: flex-end;
140
+ gap: 8px;
141
+ max-width: 45%;
142
+ min-width: 44px;
143
+ min-height: 44px;
144
+ padding: 0;
145
+ text-align: right;
146
+ flex: 1;
147
+ }
148
+ .pp-summary {
149
+ color: var(--pp-muted);
150
+ font-size: 13px;
151
+ line-height: 18px;
152
+ display: -webkit-box;
153
+ -webkit-line-clamp: 2;
154
+ -webkit-box-orient: vertical;
155
+ overflow: hidden;
156
+ overflow-wrap: anywhere;
157
+ }
158
+ .pp-chevron {
159
+ color: var(--pp-muted);
160
+ font-size: 22px;
161
+ flex: none;
162
+ }
163
+ .pp-input {
164
+ font: inherit;
165
+ color: var(--pp-text);
166
+ background: var(--pp-surface);
167
+ border: 1px solid var(--pp-border);
168
+ border-radius: 6px;
169
+ padding: 8px;
170
+ min-width: 0;
171
+ max-width: 45%;
172
+ width: 45%;
173
+ }
174
+ select.pp-input {
175
+ text-overflow: ellipsis;
176
+ font-size: 13px;
177
+ }
178
+ .pp-panel .pp-multiline {
179
+ display: block;
180
+ }
181
+ .pp-multiline .pp-input {
182
+ max-width: 100%;
183
+ width: 100%;
184
+ margin-top: 10px;
185
+ }
186
+ .pp-switch {
187
+ appearance: none;
188
+ -webkit-appearance: none;
189
+ position: relative;
190
+ flex: none;
191
+ width: 32px;
192
+ height: 20px;
193
+ max-width: none;
194
+ border: 0;
195
+ border-radius: 15px;
196
+ padding: 0;
197
+ background: #c9ccd0;
198
+ cursor: pointer;
199
+ transition: background 0.2s;
200
+ }
201
+ .pp-switch::before {
202
+ content: "";
203
+ position: absolute;
204
+ top: 3px;
205
+ left: 3px;
206
+ width: 14px;
207
+ height: 14px;
208
+ border-radius: 50%;
209
+ background: white;
210
+ transition: transform 0.2s;
211
+ }
212
+ .pp-switch:checked {
213
+ background: var(--pp-accent);
214
+ }
215
+ .pp-switch:checked::before {
216
+ transform: translateX(12px);
87
217
  }
88
218
  .pp-choice {
89
- display: block;
90
- margin: 6px 0;
219
+ justify-content: space-between;
220
+ cursor: pointer;
91
221
  }
92
222
  .pp-choice input {
93
- margin-right: 8px;
223
+ width: 20px;
224
+ height: 20px;
225
+ flex: none;
226
+ accent-color: var(--pp-accent);
227
+ margin: 0;
228
+ }
229
+ .pp-description {
230
+ font-size: 12px;
231
+ line-height: 1.6;
232
+ color: var(--pp-muted);
233
+ white-space: pre-wrap;
234
+ overflow-wrap: anywhere;
235
+ }
236
+ .pp-module-info {
237
+ display: flex;
238
+ gap: 12px;
239
+ margin: 12px 0;
240
+ }
241
+ .pp-module-icon {
242
+ width: 48px;
243
+ height: 48px;
244
+ object-fit: contain;
245
+ flex: none;
246
+ }
247
+ .pp-module-details {
248
+ min-width: 0;
249
+ overflow-wrap: anywhere;
250
+ }
251
+ .pp-module-source {
252
+ color: inherit;
253
+ text-decoration: underline;
254
+ }
255
+ .pp-maintenance {
256
+ margin-top: 24px;
94
257
  }
95
258
  .pp-actions {
96
- display: flex;
97
- gap: 8px;
98
- margin-top: 12px;
259
+ display: flex;
260
+ flex-wrap: wrap;
261
+ gap: 8px;
262
+ }
263
+ .pp-actions button,
264
+ .pp-error button {
265
+ min-height: 44px;
266
+ padding: 8px 12px;
267
+ border-radius: 6px;
268
+ background: var(--pp-surface);
269
+ }
270
+ .pp-panel .pp-danger {
271
+ color: #e45656;
272
+ }
273
+ .pp-cache {
274
+ max-height: 320px;
275
+ overflow: auto;
276
+ white-space: pre-wrap;
277
+ overflow-wrap: anywhere;
99
278
  }
100
279
  .pp-toast {
101
- position: fixed;
102
- bottom: 32px;
103
- left: 50%;
104
- transform: translateX(-50%);
105
- padding: 10px 18px;
106
- border-radius: 10px;
107
- background: #252525;
108
- color: #fff;
109
- max-width: 90vw;
110
- z-index: 1000;
280
+ pointer-events: none;
281
+ position: fixed;
282
+ bottom: calc(30px + env(safe-area-inset-bottom));
283
+ left: 50%;
284
+ transform: translateX(-50%);
285
+ max-width: 90vw;
286
+ padding: 10px 16px;
287
+ border-radius: 8px;
288
+ background: #333e;
289
+ color: white;
290
+ font-size: 13px;
291
+ z-index: 20;
111
292
  }
112
293
  .pp-toast[data-kind="error"] {
113
- background: #8d2424;
294
+ background: #8d2424;
114
295
  }
115
296
  .pp-panel :focus-visible {
116
- outline: 2px solid #008ac5;
117
- outline-offset: 2px;
297
+ outline: 2px solid var(--pp-accent);
298
+ outline-offset: -2px;
118
299
  }
119
300
  @media (prefers-color-scheme: dark) {
120
- .pp-panel {
121
- --pp-text: #eee;
122
- --pp-background: #18191c;
123
- --pp-surface: #25262a;
124
- --pp-border: #47494e;
125
- }
301
+ .pp-panel {
302
+ --pp-text: #e3e5e7;
303
+ --pp-background: #17181a;
304
+ --pp-surface: #232427;
305
+ --pp-border: #343538;
306
+ }
307
+ }
308
+ :root[data-theme="dark"] .pp-panel {
309
+ --pp-text: #e3e5e7;
310
+ --pp-background: #17181a;
311
+ --pp-surface: #232427;
312
+ --pp-border: #343538;
313
+ }
314
+ :root[data-theme="light"] .pp-panel {
315
+ --pp-text: #18191c;
316
+ --pp-background: #f6f7f8;
317
+ --pp-surface: #fff;
318
+ --pp-border: #e3e5e7;
319
+ }
320
+ @media (prefers-reduced-motion: reduce) {
321
+ .pp-panel .pp-switch,
322
+ .pp-panel .pp-switch::before {
323
+ transition: none;
324
+ }
126
325
  }