@x-otto/ui-token 0.0.0-stage → 0.3.0-beta.0
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/dist/build-revision.json +4 -0
- package/dist/index.d.ts +224 -0
- package/dist/index.js +2886 -0
- package/dist/tokens.css +913 -0
- package/dist/workbench.css +817 -0
- package/docs/token-usage.md +80 -0
- package/package.json +23 -4
- package/preview/index.html +1002 -0
- package/README.md +0 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,2886 @@
|
|
|
1
|
+
//#region src/ladder.ts
|
|
2
|
+
const RAMP_NAMES = [
|
|
3
|
+
"neon",
|
|
4
|
+
"violet",
|
|
5
|
+
"navy",
|
|
6
|
+
"ink",
|
|
7
|
+
"grass",
|
|
8
|
+
"amber",
|
|
9
|
+
"red"
|
|
10
|
+
];
|
|
11
|
+
const RAMPS = {
|
|
12
|
+
neon: {
|
|
13
|
+
light: {
|
|
14
|
+
1: "#f6fdfe",
|
|
15
|
+
2: "#e8f9fc",
|
|
16
|
+
3: "#d6f5fa",
|
|
17
|
+
4: "#baeff7",
|
|
18
|
+
5: "#95e7f4",
|
|
19
|
+
6: "#6ddff1",
|
|
20
|
+
7: "#4dd9ef",
|
|
21
|
+
8: "#32d5ee",
|
|
22
|
+
9: "#22d3ee",
|
|
23
|
+
10: "#0ebfe2",
|
|
24
|
+
11: "#0891b2",
|
|
25
|
+
12: "#155e75"
|
|
26
|
+
},
|
|
27
|
+
dark: {
|
|
28
|
+
1: "#05282e",
|
|
29
|
+
2: "#07323c",
|
|
30
|
+
3: "#09424e",
|
|
31
|
+
4: "#0b5b6b",
|
|
32
|
+
5: "#0d7a91",
|
|
33
|
+
6: "#6ddff1",
|
|
34
|
+
7: "#4dd9ef",
|
|
35
|
+
8: "#32d5ee",
|
|
36
|
+
9: "#22d3ee",
|
|
37
|
+
10: "#0ebfe2",
|
|
38
|
+
11: "#0891b2",
|
|
39
|
+
12: "#b9f0f6"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
violet: {
|
|
43
|
+
light: {
|
|
44
|
+
1: "#fdfbff",
|
|
45
|
+
2: "#f6f0ff",
|
|
46
|
+
3: "#ede3ff",
|
|
47
|
+
4: "#e1d2ff",
|
|
48
|
+
5: "#d1bcff",
|
|
49
|
+
6: "#bda1fe",
|
|
50
|
+
7: "#a688f7",
|
|
51
|
+
8: "#9678ee",
|
|
52
|
+
9: "#a28ef9",
|
|
53
|
+
10: "#9277f5",
|
|
54
|
+
11: "#6d4fd6",
|
|
55
|
+
12: "#2e2251"
|
|
56
|
+
},
|
|
57
|
+
dark: {
|
|
58
|
+
1: "#171126",
|
|
59
|
+
2: "#1d1631",
|
|
60
|
+
3: "#2a2340",
|
|
61
|
+
4: "#31284a",
|
|
62
|
+
5: "#3a2e5c",
|
|
63
|
+
6: "#5b4a95",
|
|
64
|
+
7: "#8b7ad0",
|
|
65
|
+
8: "#9d8ce0",
|
|
66
|
+
9: "#a28ef9",
|
|
67
|
+
10: "#9277f5",
|
|
68
|
+
11: "#c4b8f2",
|
|
69
|
+
12: "#efe9ff"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
navy: {
|
|
73
|
+
light: {
|
|
74
|
+
1: "#f8f9fd",
|
|
75
|
+
2: "#eff1f9",
|
|
76
|
+
3: "#e0e4f3",
|
|
77
|
+
4: "#cdd2ea",
|
|
78
|
+
5: "#b4bedf",
|
|
79
|
+
6: "#94a2d0",
|
|
80
|
+
7: "#6977b4",
|
|
81
|
+
8: "#3751a3",
|
|
82
|
+
9: "#14348c",
|
|
83
|
+
10: "#0f2a73",
|
|
84
|
+
11: "#0a1e54",
|
|
85
|
+
12: "#060e2e"
|
|
86
|
+
},
|
|
87
|
+
dark: {
|
|
88
|
+
1: "#10131f",
|
|
89
|
+
2: "#14182a",
|
|
90
|
+
3: "#1a1d2e",
|
|
91
|
+
4: "#202440",
|
|
92
|
+
5: "#242840",
|
|
93
|
+
6: "#3c4c86",
|
|
94
|
+
7: "#6e80c0",
|
|
95
|
+
8: "#4a5cb0",
|
|
96
|
+
9: "#14348c",
|
|
97
|
+
10: "#0f2a73",
|
|
98
|
+
11: "#a8b4e0",
|
|
99
|
+
12: "#d5dcf5"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
ink: {
|
|
103
|
+
light: {
|
|
104
|
+
1: "#ffffff",
|
|
105
|
+
2: "#f5f6fa",
|
|
106
|
+
3: "#eef0f9",
|
|
107
|
+
4: "#e4e6f0",
|
|
108
|
+
5: "#dbddeb",
|
|
109
|
+
6: "#c8cbdb",
|
|
110
|
+
7: "#aeb2c8",
|
|
111
|
+
8: "#9498b8",
|
|
112
|
+
9: "#7a7ea0",
|
|
113
|
+
10: "#626688",
|
|
114
|
+
11: "#565a78",
|
|
115
|
+
12: "#12152b"
|
|
116
|
+
},
|
|
117
|
+
dark: {
|
|
118
|
+
1: "#1c1c1f",
|
|
119
|
+
2: "#131315",
|
|
120
|
+
3: "#232326",
|
|
121
|
+
4: "#2a2a2e",
|
|
122
|
+
5: "#313136",
|
|
123
|
+
6: "#3a3a40",
|
|
124
|
+
7: "#48484f",
|
|
125
|
+
8: "#5c5c66",
|
|
126
|
+
9: "#78787f",
|
|
127
|
+
10: "#8f8f96",
|
|
128
|
+
11: "#a3a3ab",
|
|
129
|
+
12: "#f2f2f3"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
grass: {
|
|
133
|
+
light: {
|
|
134
|
+
9: "#a4f5a6",
|
|
135
|
+
11: "#1f7a2e",
|
|
136
|
+
12: "#123a1a"
|
|
137
|
+
},
|
|
138
|
+
dark: {
|
|
139
|
+
9: "#2f6e40",
|
|
140
|
+
11: "#7ee095",
|
|
141
|
+
12: "#d3f5da"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
amber: {
|
|
145
|
+
light: {
|
|
146
|
+
9: "#ffd89d",
|
|
147
|
+
11: "#935e0f",
|
|
148
|
+
12: "#4a3208"
|
|
149
|
+
},
|
|
150
|
+
dark: {
|
|
151
|
+
9: "#8a5a18",
|
|
152
|
+
11: "#ffc966",
|
|
153
|
+
12: "#ffe9c2"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
red: {
|
|
157
|
+
light: {
|
|
158
|
+
3: "#fce8e8",
|
|
159
|
+
9: "#e5484d",
|
|
160
|
+
11: "#822025"
|
|
161
|
+
},
|
|
162
|
+
dark: {
|
|
163
|
+
3: "#3c181a",
|
|
164
|
+
9: "#e5484d",
|
|
165
|
+
11: "#ff9592"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const SEMANTIC_SURFACES = {
|
|
170
|
+
light: {
|
|
171
|
+
grass: "#eafcea",
|
|
172
|
+
amber: "#fff3e0",
|
|
173
|
+
red: "#fce8e8"
|
|
174
|
+
},
|
|
175
|
+
dark: {
|
|
176
|
+
grass: "#183820",
|
|
177
|
+
amber: "#3d2e12",
|
|
178
|
+
red: "#3c181a"
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const SPECTRUM = {
|
|
182
|
+
light: [
|
|
183
|
+
"#b5403a",
|
|
184
|
+
"#b45f1f",
|
|
185
|
+
"#96740f",
|
|
186
|
+
"#4e7a34",
|
|
187
|
+
"#2364a8",
|
|
188
|
+
"#7b4fc4"
|
|
189
|
+
],
|
|
190
|
+
dark: [
|
|
191
|
+
"#e06c75",
|
|
192
|
+
"#d19a66",
|
|
193
|
+
"#e5c07b",
|
|
194
|
+
"#98c379",
|
|
195
|
+
"#61afef",
|
|
196
|
+
"#c678dd"
|
|
197
|
+
]
|
|
198
|
+
};
|
|
199
|
+
function rampStepColor(ramp, step, mode) {
|
|
200
|
+
const color = RAMPS[ramp][mode][step];
|
|
201
|
+
if (color === void 0) throw new Error(`ui-token: ramp "${ramp}" has no step ${step} in ${mode} mode`);
|
|
202
|
+
return color;
|
|
203
|
+
}
|
|
204
|
+
function rampStepsOf(ramp, mode) {
|
|
205
|
+
return Object.keys(RAMPS[ramp][mode]).map((key) => Number(key)).sort((left, right) => left - right);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/tool-roles.ts
|
|
210
|
+
const TOOL_ROLE_NAMES = [
|
|
211
|
+
"tool.execute",
|
|
212
|
+
"tool.read",
|
|
213
|
+
"tool.write",
|
|
214
|
+
"tool.edit",
|
|
215
|
+
"tool.search",
|
|
216
|
+
"tool.network",
|
|
217
|
+
"tool.plan",
|
|
218
|
+
"tool.memory",
|
|
219
|
+
"tool.inspect",
|
|
220
|
+
"tool.misc"
|
|
221
|
+
];
|
|
222
|
+
const FALLBACK_ROLE = "tool.misc";
|
|
223
|
+
const TOOL_ROLE_TABLE = {
|
|
224
|
+
"tool.execute": {
|
|
225
|
+
light: ramp$1("neon", 12),
|
|
226
|
+
dark: ramp$1("neon", 9)
|
|
227
|
+
},
|
|
228
|
+
"tool.read": {
|
|
229
|
+
light: ramp$1("navy", 9),
|
|
230
|
+
dark: ramp$1("navy", 7)
|
|
231
|
+
},
|
|
232
|
+
"tool.write": {
|
|
233
|
+
light: ramp$1("grass", 11),
|
|
234
|
+
dark: ramp$1("grass", 11)
|
|
235
|
+
},
|
|
236
|
+
"tool.edit": {
|
|
237
|
+
light: ramp$1("amber", 11),
|
|
238
|
+
dark: ramp$1("amber", 11)
|
|
239
|
+
},
|
|
240
|
+
"tool.search": {
|
|
241
|
+
light: ramp$1("violet", 12),
|
|
242
|
+
dark: ramp$1("violet", 9)
|
|
243
|
+
},
|
|
244
|
+
"tool.network": {
|
|
245
|
+
light: ramp$1("navy", 12),
|
|
246
|
+
dark: ramp$1("navy", 12)
|
|
247
|
+
},
|
|
248
|
+
"tool.plan": {
|
|
249
|
+
light: ramp$1("violet", 11),
|
|
250
|
+
dark: ramp$1("violet", 10)
|
|
251
|
+
},
|
|
252
|
+
"tool.memory": {
|
|
253
|
+
light: ramp$1("grass", 12),
|
|
254
|
+
dark: ramp$1("grass", 12)
|
|
255
|
+
},
|
|
256
|
+
"tool.inspect": {
|
|
257
|
+
light: ramp$1("navy", 10),
|
|
258
|
+
dark: ramp$1("navy", 11)
|
|
259
|
+
},
|
|
260
|
+
"tool.misc": {
|
|
261
|
+
light: ramp$1("ink", 11),
|
|
262
|
+
dark: ramp$1("ink", 9)
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
const ROLE_BY_TOOL_NAME = {
|
|
266
|
+
bash: "tool.execute",
|
|
267
|
+
shell: "tool.execute",
|
|
268
|
+
run: "tool.execute",
|
|
269
|
+
read: "tool.read",
|
|
270
|
+
cat: "tool.read",
|
|
271
|
+
view: "tool.read",
|
|
272
|
+
write: "tool.write",
|
|
273
|
+
create: "tool.write",
|
|
274
|
+
edit: "tool.edit",
|
|
275
|
+
str_replace: "tool.edit",
|
|
276
|
+
patch: "tool.edit",
|
|
277
|
+
grep: "tool.search",
|
|
278
|
+
find: "tool.search",
|
|
279
|
+
search: "tool.search",
|
|
280
|
+
tool_search: "tool.search",
|
|
281
|
+
web_fetch: "tool.network",
|
|
282
|
+
web_search: "tool.network",
|
|
283
|
+
fetch: "tool.network",
|
|
284
|
+
grill_me: "tool.plan",
|
|
285
|
+
task_write: "tool.plan",
|
|
286
|
+
agent_spawn: "tool.plan",
|
|
287
|
+
agent_send: "tool.plan",
|
|
288
|
+
job_output: "tool.plan",
|
|
289
|
+
job_list: "tool.plan",
|
|
290
|
+
job_abort: "tool.plan",
|
|
291
|
+
schedule_create: "tool.plan",
|
|
292
|
+
schedule_list: "tool.plan",
|
|
293
|
+
schedule_delete: "tool.plan",
|
|
294
|
+
memory_record: "tool.memory",
|
|
295
|
+
memory_read: "tool.memory",
|
|
296
|
+
memory_archive_read: "tool.memory",
|
|
297
|
+
memory_archive_list: "tool.memory",
|
|
298
|
+
tui_inspect: "tool.inspect",
|
|
299
|
+
session_manage: "tool.inspect",
|
|
300
|
+
list_models: "tool.inspect",
|
|
301
|
+
skill_run: "tool.inspect",
|
|
302
|
+
skill_load: "tool.inspect"
|
|
303
|
+
};
|
|
304
|
+
const TOOL_ROLE_SET = new Set(TOOL_ROLE_NAMES);
|
|
305
|
+
function isToolRole(value) {
|
|
306
|
+
return TOOL_ROLE_SET.has(value);
|
|
307
|
+
}
|
|
308
|
+
function toolRoleOf(toolName) {
|
|
309
|
+
if (typeof toolName !== "string") return FALLBACK_ROLE;
|
|
310
|
+
return ROLE_BY_TOOL_NAME[toolName.trim().toLowerCase()] ?? FALLBACK_ROLE;
|
|
311
|
+
}
|
|
312
|
+
function ramp$1(rampName, step) {
|
|
313
|
+
return {
|
|
314
|
+
ramp: rampName,
|
|
315
|
+
step
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/roles.ts
|
|
321
|
+
const ROLE_NAMES = [
|
|
322
|
+
"surface.page",
|
|
323
|
+
"surface.card",
|
|
324
|
+
"surface.subtle",
|
|
325
|
+
"surface.pillSubtle",
|
|
326
|
+
"surface.dark",
|
|
327
|
+
"surface.userMessage",
|
|
328
|
+
"surface.navGlass",
|
|
329
|
+
"surface.scrim",
|
|
330
|
+
"surface.success",
|
|
331
|
+
"surface.warning",
|
|
332
|
+
"surface.danger",
|
|
333
|
+
"text.primary",
|
|
334
|
+
"text.secondary",
|
|
335
|
+
"text.muted",
|
|
336
|
+
"text.onDark",
|
|
337
|
+
"text.onAccent",
|
|
338
|
+
"text.onAccentSecondary",
|
|
339
|
+
"text.onNeon",
|
|
340
|
+
"brand.primary",
|
|
341
|
+
"brand.primaryHover",
|
|
342
|
+
"brand.primarySoft",
|
|
343
|
+
"brand.primarySolid",
|
|
344
|
+
"brand.primarySolidHover",
|
|
345
|
+
"brand.decor",
|
|
346
|
+
"brand.mark",
|
|
347
|
+
"brand.dim",
|
|
348
|
+
"brand.neon",
|
|
349
|
+
"brand.neonText",
|
|
350
|
+
"brand.navy",
|
|
351
|
+
"brand.navyDeep",
|
|
352
|
+
"brand.ink",
|
|
353
|
+
"brand.peri",
|
|
354
|
+
"brand.periSoft",
|
|
355
|
+
"brand.cream",
|
|
356
|
+
"brand.coverGrid",
|
|
357
|
+
"focus.ring",
|
|
358
|
+
"selection.text",
|
|
359
|
+
"link.active",
|
|
360
|
+
"status.success",
|
|
361
|
+
"status.successStrong",
|
|
362
|
+
"status.successSurface",
|
|
363
|
+
"status.warning",
|
|
364
|
+
"status.warningStrong",
|
|
365
|
+
"status.warningSurface",
|
|
366
|
+
"status.danger",
|
|
367
|
+
"status.dangerStrong",
|
|
368
|
+
"status.dangerSurface",
|
|
369
|
+
"status.info",
|
|
370
|
+
"icon.search",
|
|
371
|
+
"icon.file",
|
|
372
|
+
"icon.write",
|
|
373
|
+
"icon.browse",
|
|
374
|
+
"icon.bash",
|
|
375
|
+
"icon.dotTertiary",
|
|
376
|
+
"border.defaultColor",
|
|
377
|
+
"border.subtleColor",
|
|
378
|
+
"border.timeline",
|
|
379
|
+
"diff.addedBackground",
|
|
380
|
+
"diff.addedSign",
|
|
381
|
+
"diff.removedBackground",
|
|
382
|
+
"diff.removedSign",
|
|
383
|
+
"diff.content",
|
|
384
|
+
"scrollbar.track",
|
|
385
|
+
"scrollbar.thumb",
|
|
386
|
+
"tag.background",
|
|
387
|
+
"overlay.background",
|
|
388
|
+
"overlay.text",
|
|
389
|
+
"syntax.builtin",
|
|
390
|
+
"button.filledText",
|
|
391
|
+
"line.default",
|
|
392
|
+
"paper.base",
|
|
393
|
+
"paper.raise",
|
|
394
|
+
...TOOL_ROLE_NAMES
|
|
395
|
+
];
|
|
396
|
+
function toolRoleContrast() {
|
|
397
|
+
const rules = {};
|
|
398
|
+
for (const role of TOOL_ROLE_NAMES) rules[role] = {
|
|
399
|
+
level: "graphic",
|
|
400
|
+
surfaces: ["surface.page", "surface.card"]
|
|
401
|
+
};
|
|
402
|
+
return rules;
|
|
403
|
+
}
|
|
404
|
+
function ramp(rampName, step) {
|
|
405
|
+
return {
|
|
406
|
+
ramp: rampName,
|
|
407
|
+
step
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
function literal(color) {
|
|
411
|
+
return { literal: color };
|
|
412
|
+
}
|
|
413
|
+
function surface(name) {
|
|
414
|
+
return { surface: name };
|
|
415
|
+
}
|
|
416
|
+
const ROLE_TABLE = {
|
|
417
|
+
"surface.page": {
|
|
418
|
+
light: ramp("ink", 4),
|
|
419
|
+
dark: literal("#0c0c0e")
|
|
420
|
+
},
|
|
421
|
+
"surface.card": {
|
|
422
|
+
light: ramp("ink", 1),
|
|
423
|
+
dark: ramp("ink", 1)
|
|
424
|
+
},
|
|
425
|
+
"surface.subtle": {
|
|
426
|
+
light: ramp("ink", 3),
|
|
427
|
+
dark: ramp("ink", 3)
|
|
428
|
+
},
|
|
429
|
+
"surface.pillSubtle": {
|
|
430
|
+
light: ramp("ink", 2),
|
|
431
|
+
dark: ramp("ink", 2)
|
|
432
|
+
},
|
|
433
|
+
"surface.dark": {
|
|
434
|
+
light: ramp("ink", 12),
|
|
435
|
+
dark: ramp("ink", 12)
|
|
436
|
+
},
|
|
437
|
+
"surface.userMessage": {
|
|
438
|
+
light: ramp("ink", 3),
|
|
439
|
+
dark: ramp("ink", 4)
|
|
440
|
+
},
|
|
441
|
+
"surface.navGlass": {
|
|
442
|
+
light: literal("rgba(255, 255, 255, .72)"),
|
|
443
|
+
dark: literal("rgba(12, 12, 14, .72)")
|
|
444
|
+
},
|
|
445
|
+
"surface.scrim": {
|
|
446
|
+
light: literal("rgba(0, 0, 0, .4)"),
|
|
447
|
+
dark: literal("rgba(0, 0, 0, .4)")
|
|
448
|
+
},
|
|
449
|
+
"surface.success": {
|
|
450
|
+
light: surface("grass"),
|
|
451
|
+
dark: surface("grass")
|
|
452
|
+
},
|
|
453
|
+
"surface.warning": {
|
|
454
|
+
light: surface("amber"),
|
|
455
|
+
dark: surface("amber")
|
|
456
|
+
},
|
|
457
|
+
"surface.danger": {
|
|
458
|
+
light: surface("red"),
|
|
459
|
+
dark: surface("red")
|
|
460
|
+
},
|
|
461
|
+
"text.primary": {
|
|
462
|
+
light: ramp("ink", 12),
|
|
463
|
+
dark: ramp("ink", 12)
|
|
464
|
+
},
|
|
465
|
+
"text.secondary": {
|
|
466
|
+
light: ramp("ink", 11),
|
|
467
|
+
dark: ramp("ink", 11)
|
|
468
|
+
},
|
|
469
|
+
"text.muted": {
|
|
470
|
+
light: ramp("ink", 11),
|
|
471
|
+
dark: ramp("ink", 11)
|
|
472
|
+
},
|
|
473
|
+
"text.onDark": {
|
|
474
|
+
light: ramp("ink", 1),
|
|
475
|
+
dark: ramp("ink", 1)
|
|
476
|
+
},
|
|
477
|
+
"text.onAccent": {
|
|
478
|
+
light: literal("#ffffff"),
|
|
479
|
+
dark: literal("#ffffff")
|
|
480
|
+
},
|
|
481
|
+
"text.onAccentSecondary": {
|
|
482
|
+
light: literal("rgba(255, 255, 255, .85)"),
|
|
483
|
+
dark: literal("rgba(255, 255, 255, .85)")
|
|
484
|
+
},
|
|
485
|
+
"text.onNeon": {
|
|
486
|
+
light: ramp("ink", 12),
|
|
487
|
+
dark: literal("#12152b")
|
|
488
|
+
},
|
|
489
|
+
"brand.primary": {
|
|
490
|
+
light: ramp("violet", 11),
|
|
491
|
+
dark: ramp("violet", 9)
|
|
492
|
+
},
|
|
493
|
+
"brand.primaryHover": {
|
|
494
|
+
light: ramp("violet", 10),
|
|
495
|
+
dark: ramp("violet", 10)
|
|
496
|
+
},
|
|
497
|
+
"brand.primarySoft": {
|
|
498
|
+
light: ramp("violet", 3),
|
|
499
|
+
dark: ramp("violet", 3)
|
|
500
|
+
},
|
|
501
|
+
"brand.primarySolid": {
|
|
502
|
+
light: ramp("violet", 11),
|
|
503
|
+
dark: literal("#6d4fd6")
|
|
504
|
+
},
|
|
505
|
+
"brand.primarySolidHover": {
|
|
506
|
+
light: literal("#5b3fc4"),
|
|
507
|
+
dark: literal("#7d61e0")
|
|
508
|
+
},
|
|
509
|
+
"brand.decor": {
|
|
510
|
+
light: ramp("violet", 9),
|
|
511
|
+
dark: ramp("violet", 9)
|
|
512
|
+
},
|
|
513
|
+
"brand.mark": {
|
|
514
|
+
light: ramp("violet", 9),
|
|
515
|
+
dark: ramp("violet", 9)
|
|
516
|
+
},
|
|
517
|
+
"brand.dim": {
|
|
518
|
+
light: ramp("ink", 9),
|
|
519
|
+
dark: ramp("ink", 9)
|
|
520
|
+
},
|
|
521
|
+
"brand.neon": {
|
|
522
|
+
light: ramp("neon", 11),
|
|
523
|
+
dark: ramp("neon", 9)
|
|
524
|
+
},
|
|
525
|
+
"brand.neonText": {
|
|
526
|
+
light: ramp("neon", 12),
|
|
527
|
+
dark: ramp("neon", 9)
|
|
528
|
+
},
|
|
529
|
+
"brand.navy": {
|
|
530
|
+
light: ramp("navy", 9),
|
|
531
|
+
dark: ramp("navy", 9)
|
|
532
|
+
},
|
|
533
|
+
"brand.navyDeep": {
|
|
534
|
+
light: ramp("navy", 10),
|
|
535
|
+
dark: ramp("navy", 10)
|
|
536
|
+
},
|
|
537
|
+
"brand.ink": {
|
|
538
|
+
light: ramp("ink", 12),
|
|
539
|
+
dark: ramp("ink", 12)
|
|
540
|
+
},
|
|
541
|
+
"brand.peri": {
|
|
542
|
+
light: ramp("navy", 7),
|
|
543
|
+
dark: ramp("navy", 7)
|
|
544
|
+
},
|
|
545
|
+
"brand.periSoft": {
|
|
546
|
+
light: ramp("navy", 3),
|
|
547
|
+
dark: ramp("navy", 5)
|
|
548
|
+
},
|
|
549
|
+
"brand.cream": {
|
|
550
|
+
light: literal("#f7f5f0"),
|
|
551
|
+
dark: literal("#161514")
|
|
552
|
+
},
|
|
553
|
+
"brand.coverGrid": {
|
|
554
|
+
light: literal("rgba(255, 255, 255, .07)"),
|
|
555
|
+
dark: literal("rgba(255, 255, 255, .07)")
|
|
556
|
+
},
|
|
557
|
+
"focus.ring": {
|
|
558
|
+
light: ramp("neon", 12),
|
|
559
|
+
dark: ramp("neon", 9)
|
|
560
|
+
},
|
|
561
|
+
"selection.text": {
|
|
562
|
+
light: ramp("neon", 12),
|
|
563
|
+
dark: ramp("neon", 9)
|
|
564
|
+
},
|
|
565
|
+
"link.active": {
|
|
566
|
+
light: ramp("neon", 12),
|
|
567
|
+
dark: ramp("neon", 9)
|
|
568
|
+
},
|
|
569
|
+
"status.success": {
|
|
570
|
+
light: ramp("grass", 11),
|
|
571
|
+
dark: ramp("grass", 11)
|
|
572
|
+
},
|
|
573
|
+
"status.successStrong": {
|
|
574
|
+
light: ramp("grass", 12),
|
|
575
|
+
dark: ramp("grass", 12)
|
|
576
|
+
},
|
|
577
|
+
"status.successSurface": {
|
|
578
|
+
light: surface("grass"),
|
|
579
|
+
dark: surface("grass")
|
|
580
|
+
},
|
|
581
|
+
"status.warning": {
|
|
582
|
+
light: ramp("amber", 11),
|
|
583
|
+
dark: ramp("amber", 11)
|
|
584
|
+
},
|
|
585
|
+
"status.warningStrong": {
|
|
586
|
+
light: ramp("amber", 12),
|
|
587
|
+
dark: ramp("amber", 12)
|
|
588
|
+
},
|
|
589
|
+
"status.warningSurface": {
|
|
590
|
+
light: surface("amber"),
|
|
591
|
+
dark: surface("amber")
|
|
592
|
+
},
|
|
593
|
+
"status.danger": {
|
|
594
|
+
light: ramp("red", 11),
|
|
595
|
+
dark: ramp("red", 11)
|
|
596
|
+
},
|
|
597
|
+
"status.dangerStrong": {
|
|
598
|
+
light: ramp("red", 11),
|
|
599
|
+
dark: ramp("red", 11)
|
|
600
|
+
},
|
|
601
|
+
"status.dangerSurface": {
|
|
602
|
+
light: surface("red"),
|
|
603
|
+
dark: surface("red")
|
|
604
|
+
},
|
|
605
|
+
"status.info": {
|
|
606
|
+
light: literal("#0369a1"),
|
|
607
|
+
dark: literal("#38bdf8")
|
|
608
|
+
},
|
|
609
|
+
"icon.search": {
|
|
610
|
+
light: ramp("violet", 9),
|
|
611
|
+
dark: ramp("violet", 9)
|
|
612
|
+
},
|
|
613
|
+
"icon.file": {
|
|
614
|
+
light: ramp("violet", 9),
|
|
615
|
+
dark: ramp("violet", 9)
|
|
616
|
+
},
|
|
617
|
+
"icon.write": {
|
|
618
|
+
light: ramp("violet", 10),
|
|
619
|
+
dark: ramp("violet", 10)
|
|
620
|
+
},
|
|
621
|
+
"icon.browse": {
|
|
622
|
+
light: ramp("grass", 11),
|
|
623
|
+
dark: ramp("grass", 11)
|
|
624
|
+
},
|
|
625
|
+
"icon.bash": {
|
|
626
|
+
light: ramp("grass", 11),
|
|
627
|
+
dark: ramp("grass", 11)
|
|
628
|
+
},
|
|
629
|
+
"icon.dotTertiary": {
|
|
630
|
+
light: ramp("ink", 8),
|
|
631
|
+
dark: ramp("ink", 8)
|
|
632
|
+
},
|
|
633
|
+
"border.defaultColor": {
|
|
634
|
+
light: ramp("ink", 6),
|
|
635
|
+
dark: ramp("ink", 6)
|
|
636
|
+
},
|
|
637
|
+
"border.subtleColor": {
|
|
638
|
+
light: ramp("ink", 4),
|
|
639
|
+
dark: ramp("ink", 4)
|
|
640
|
+
},
|
|
641
|
+
"border.timeline": {
|
|
642
|
+
light: ramp("ink", 7),
|
|
643
|
+
dark: ramp("ink", 7)
|
|
644
|
+
},
|
|
645
|
+
"diff.addedBackground": {
|
|
646
|
+
light: surface("grass"),
|
|
647
|
+
dark: literal("#1c2b25")
|
|
648
|
+
},
|
|
649
|
+
"diff.addedSign": {
|
|
650
|
+
light: ramp("grass", 11),
|
|
651
|
+
dark: ramp("grass", 11)
|
|
652
|
+
},
|
|
653
|
+
"diff.removedBackground": {
|
|
654
|
+
light: surface("red"),
|
|
655
|
+
dark: literal("#2e1e22")
|
|
656
|
+
},
|
|
657
|
+
"diff.removedSign": {
|
|
658
|
+
light: ramp("red", 11),
|
|
659
|
+
dark: ramp("red", 11)
|
|
660
|
+
},
|
|
661
|
+
"diff.content": {
|
|
662
|
+
light: ramp("ink", 12),
|
|
663
|
+
dark: ramp("ink", 12)
|
|
664
|
+
},
|
|
665
|
+
"scrollbar.track": {
|
|
666
|
+
light: ramp("ink", 4),
|
|
667
|
+
dark: ramp("ink", 3)
|
|
668
|
+
},
|
|
669
|
+
"scrollbar.thumb": {
|
|
670
|
+
light: ramp("ink", 6),
|
|
671
|
+
dark: ramp("ink", 7)
|
|
672
|
+
},
|
|
673
|
+
"tag.background": {
|
|
674
|
+
light: ramp("ink", 4),
|
|
675
|
+
dark: ramp("ink", 3)
|
|
676
|
+
},
|
|
677
|
+
"overlay.background": {
|
|
678
|
+
light: ramp("ink", 1),
|
|
679
|
+
dark: ramp("ink", 1)
|
|
680
|
+
},
|
|
681
|
+
"overlay.text": {
|
|
682
|
+
light: ramp("ink", 12),
|
|
683
|
+
dark: ramp("ink", 12)
|
|
684
|
+
},
|
|
685
|
+
"syntax.builtin": {
|
|
686
|
+
light: ramp("violet", 11),
|
|
687
|
+
dark: ramp("violet", 11)
|
|
688
|
+
},
|
|
689
|
+
"button.filledText": {
|
|
690
|
+
light: literal("#ffffff"),
|
|
691
|
+
dark: literal("#0f0f14")
|
|
692
|
+
},
|
|
693
|
+
"line.default": {
|
|
694
|
+
light: ramp("ink", 3),
|
|
695
|
+
dark: ramp("ink", 3)
|
|
696
|
+
},
|
|
697
|
+
"paper.base": {
|
|
698
|
+
light: ramp("ink", 4),
|
|
699
|
+
dark: literal("#0c0c0e")
|
|
700
|
+
},
|
|
701
|
+
"paper.raise": {
|
|
702
|
+
light: ramp("ink", 1),
|
|
703
|
+
dark: ramp("ink", 1)
|
|
704
|
+
},
|
|
705
|
+
...TOOL_ROLE_TABLE
|
|
706
|
+
};
|
|
707
|
+
const CONTRAST_THRESHOLDS = {
|
|
708
|
+
text: 4.5,
|
|
709
|
+
graphic: 3
|
|
710
|
+
};
|
|
711
|
+
const ROLE_CONTRAST = {
|
|
712
|
+
"text.primary": {
|
|
713
|
+
level: "text",
|
|
714
|
+
surfaces: ["surface.page", "surface.card"]
|
|
715
|
+
},
|
|
716
|
+
"text.secondary": {
|
|
717
|
+
level: "text",
|
|
718
|
+
surfaces: ["surface.page", "surface.card"]
|
|
719
|
+
},
|
|
720
|
+
"text.muted": {
|
|
721
|
+
level: "text",
|
|
722
|
+
surfaces: ["surface.page", "surface.card"]
|
|
723
|
+
},
|
|
724
|
+
"text.onDark": {
|
|
725
|
+
level: "text",
|
|
726
|
+
surfaces: ["surface.dark"]
|
|
727
|
+
},
|
|
728
|
+
"text.onNeon": {
|
|
729
|
+
level: "text",
|
|
730
|
+
surfaces: ["brand.neon"]
|
|
731
|
+
},
|
|
732
|
+
"text.onAccent": {
|
|
733
|
+
level: "text",
|
|
734
|
+
surfaces: ["brand.primarySolid"]
|
|
735
|
+
},
|
|
736
|
+
"brand.primary": {
|
|
737
|
+
level: "text",
|
|
738
|
+
surfaces: ["surface.page", "surface.card"]
|
|
739
|
+
},
|
|
740
|
+
"brand.neonText": {
|
|
741
|
+
level: "text",
|
|
742
|
+
surfaces: ["surface.page", "surface.card"]
|
|
743
|
+
},
|
|
744
|
+
"link.active": {
|
|
745
|
+
level: "text",
|
|
746
|
+
surfaces: ["surface.page", "surface.card"]
|
|
747
|
+
},
|
|
748
|
+
"selection.text": {
|
|
749
|
+
level: "text",
|
|
750
|
+
surfaces: ["surface.page", "surface.card"]
|
|
751
|
+
},
|
|
752
|
+
"brand.neon": {
|
|
753
|
+
level: "graphic",
|
|
754
|
+
surfaces: ["surface.card"]
|
|
755
|
+
},
|
|
756
|
+
"focus.ring": {
|
|
757
|
+
level: "graphic",
|
|
758
|
+
surfaces: ["surface.page", "surface.card"]
|
|
759
|
+
},
|
|
760
|
+
"status.success": {
|
|
761
|
+
level: "text",
|
|
762
|
+
surfaces: ["surface.card"]
|
|
763
|
+
},
|
|
764
|
+
"status.successStrong": {
|
|
765
|
+
level: "text",
|
|
766
|
+
surfaces: ["surface.card"]
|
|
767
|
+
},
|
|
768
|
+
"status.warning": {
|
|
769
|
+
level: "text",
|
|
770
|
+
surfaces: ["surface.card"]
|
|
771
|
+
},
|
|
772
|
+
"status.warningStrong": {
|
|
773
|
+
level: "text",
|
|
774
|
+
surfaces: ["surface.card"]
|
|
775
|
+
},
|
|
776
|
+
"status.danger": {
|
|
777
|
+
level: "text",
|
|
778
|
+
surfaces: ["surface.card"]
|
|
779
|
+
},
|
|
780
|
+
"status.dangerStrong": {
|
|
781
|
+
level: "text",
|
|
782
|
+
surfaces: ["surface.card"]
|
|
783
|
+
},
|
|
784
|
+
"overlay.text": {
|
|
785
|
+
level: "text",
|
|
786
|
+
surfaces: ["overlay.background"]
|
|
787
|
+
},
|
|
788
|
+
"syntax.builtin": {
|
|
789
|
+
level: "text",
|
|
790
|
+
surfaces: ["surface.card"]
|
|
791
|
+
},
|
|
792
|
+
"diff.addedSign": {
|
|
793
|
+
level: "text",
|
|
794
|
+
surfaces: ["diff.addedBackground"]
|
|
795
|
+
},
|
|
796
|
+
"diff.removedSign": {
|
|
797
|
+
level: "text",
|
|
798
|
+
surfaces: ["diff.removedBackground"]
|
|
799
|
+
},
|
|
800
|
+
...toolRoleContrast()
|
|
801
|
+
};
|
|
802
|
+
function resolveRole(name, mode) {
|
|
803
|
+
const value = ROLE_TABLE[name][mode];
|
|
804
|
+
if ("ramp" in value) return rampStepColor(value.ramp, value.step, mode);
|
|
805
|
+
if ("surface" in value) {
|
|
806
|
+
const color = SEMANTIC_SURFACES[mode][value.surface];
|
|
807
|
+
if (color === void 0) throw new Error(`ui-token: unknown surface "${value.surface}"`);
|
|
808
|
+
return color;
|
|
809
|
+
}
|
|
810
|
+
return value.literal;
|
|
811
|
+
}
|
|
812
|
+
function roleVariableName(name) {
|
|
813
|
+
return `--otto-${name.replaceAll(".", "-")}`;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
//#endregion
|
|
817
|
+
//#region src/contrast.ts
|
|
818
|
+
function parseHexColor(color) {
|
|
819
|
+
const trimmed = color.trim().replace(/^#/, "");
|
|
820
|
+
const expanded = trimmed.length === 3 ? trimmed.split("").map((part) => part + part).join("") : trimmed;
|
|
821
|
+
if (!/^[0-9a-fA-F]{6}$/.test(expanded)) return void 0;
|
|
822
|
+
return {
|
|
823
|
+
red: Number.parseInt(expanded.slice(0, 2), 16),
|
|
824
|
+
green: Number.parseInt(expanded.slice(2, 4), 16),
|
|
825
|
+
blue: Number.parseInt(expanded.slice(4, 6), 16)
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
function channelLuminance(channel) {
|
|
829
|
+
const ratio = channel / 255;
|
|
830
|
+
return ratio <= .03928 ? ratio / 12.92 : ((ratio + .055) / 1.055) ** 2.4;
|
|
831
|
+
}
|
|
832
|
+
function relativeLuminance(color) {
|
|
833
|
+
const channels = parseHexColor(color);
|
|
834
|
+
if (channels === void 0) throw new Error(`ui-token: "${color}" is not a hex color`);
|
|
835
|
+
return .2126 * channelLuminance(channels.red) + .7152 * channelLuminance(channels.green) + .0722 * channelLuminance(channels.blue);
|
|
836
|
+
}
|
|
837
|
+
function contrastRatio(first, second) {
|
|
838
|
+
const firstLuminance = relativeLuminance(first);
|
|
839
|
+
const secondLuminance = relativeLuminance(second);
|
|
840
|
+
const lighter = Math.max(firstLuminance, secondLuminance);
|
|
841
|
+
const darker = Math.min(firstLuminance, secondLuminance);
|
|
842
|
+
return (lighter + .05) / (darker + .05);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
//#endregion
|
|
846
|
+
//#region src/projections/tui.ts
|
|
847
|
+
const TUI_COLOR_KEYS = [
|
|
848
|
+
"text",
|
|
849
|
+
"accent",
|
|
850
|
+
"muted",
|
|
851
|
+
"border",
|
|
852
|
+
"borderSuppressed",
|
|
853
|
+
"success",
|
|
854
|
+
"error",
|
|
855
|
+
"dangerSurface",
|
|
856
|
+
"warning",
|
|
857
|
+
"info",
|
|
858
|
+
"brand",
|
|
859
|
+
"brandHighlight",
|
|
860
|
+
"brandDim",
|
|
861
|
+
"selectedText",
|
|
862
|
+
"selectionText",
|
|
863
|
+
"focusIndicator",
|
|
864
|
+
"linkActive",
|
|
865
|
+
"syntaxBuiltin",
|
|
866
|
+
"overlayBackground",
|
|
867
|
+
"overlayText",
|
|
868
|
+
"track",
|
|
869
|
+
"thumb",
|
|
870
|
+
"buttonFilledText",
|
|
871
|
+
"tagBackground",
|
|
872
|
+
"syntaxTheme",
|
|
873
|
+
"diffAddedBackground",
|
|
874
|
+
"diffRemovedBackground",
|
|
875
|
+
"diffAddedSign",
|
|
876
|
+
"diffRemovedSign",
|
|
877
|
+
"diffContent"
|
|
878
|
+
];
|
|
879
|
+
const TUI_COLOR_BINDINGS = {
|
|
880
|
+
text: {
|
|
881
|
+
role: void 0,
|
|
882
|
+
frozen: null
|
|
883
|
+
},
|
|
884
|
+
accent: {
|
|
885
|
+
role: "brand.primary",
|
|
886
|
+
frozen: "#7c3aed"
|
|
887
|
+
},
|
|
888
|
+
muted: {
|
|
889
|
+
role: "text.muted",
|
|
890
|
+
frozen: "#475569"
|
|
891
|
+
},
|
|
892
|
+
border: {
|
|
893
|
+
role: "border.defaultColor",
|
|
894
|
+
frozen: "#cbd5e1"
|
|
895
|
+
},
|
|
896
|
+
borderSuppressed: {
|
|
897
|
+
role: "border.subtleColor",
|
|
898
|
+
frozen: "#e2e8f0"
|
|
899
|
+
},
|
|
900
|
+
success: {
|
|
901
|
+
role: "status.success",
|
|
902
|
+
frozen: "#15803d"
|
|
903
|
+
},
|
|
904
|
+
error: {
|
|
905
|
+
role: "status.danger",
|
|
906
|
+
frozen: "#b91c1c"
|
|
907
|
+
},
|
|
908
|
+
dangerSurface: {
|
|
909
|
+
role: "surface.danger",
|
|
910
|
+
frozen: "#fce8e8"
|
|
911
|
+
},
|
|
912
|
+
warning: {
|
|
913
|
+
role: "status.warning",
|
|
914
|
+
frozen: "#b45309"
|
|
915
|
+
},
|
|
916
|
+
info: {
|
|
917
|
+
role: "status.info",
|
|
918
|
+
frozen: "#0369a1"
|
|
919
|
+
},
|
|
920
|
+
brand: {
|
|
921
|
+
role: "brand.primary",
|
|
922
|
+
frozen: "#7c3aed"
|
|
923
|
+
},
|
|
924
|
+
brandHighlight: {
|
|
925
|
+
role: "brand.neon",
|
|
926
|
+
frozen: "#0891b2"
|
|
927
|
+
},
|
|
928
|
+
brandDim: {
|
|
929
|
+
role: "brand.dim",
|
|
930
|
+
frozen: "#94a3b8"
|
|
931
|
+
},
|
|
932
|
+
selectedText: {
|
|
933
|
+
role: "selection.text",
|
|
934
|
+
frozen: "#0891b2"
|
|
935
|
+
},
|
|
936
|
+
selectionText: {
|
|
937
|
+
role: "selection.text",
|
|
938
|
+
frozen: "#0891b2"
|
|
939
|
+
},
|
|
940
|
+
focusIndicator: {
|
|
941
|
+
role: "focus.ring",
|
|
942
|
+
frozen: "#0891b2"
|
|
943
|
+
},
|
|
944
|
+
linkActive: {
|
|
945
|
+
role: "link.active",
|
|
946
|
+
frozen: "#0891b2"
|
|
947
|
+
},
|
|
948
|
+
syntaxBuiltin: {
|
|
949
|
+
role: "syntax.builtin",
|
|
950
|
+
frozen: "#6d28d9"
|
|
951
|
+
},
|
|
952
|
+
overlayBackground: {
|
|
953
|
+
role: "overlay.background",
|
|
954
|
+
frozen: "#f1f5f9"
|
|
955
|
+
},
|
|
956
|
+
overlayText: {
|
|
957
|
+
role: "overlay.text",
|
|
958
|
+
frozen: "#0f172a"
|
|
959
|
+
},
|
|
960
|
+
track: {
|
|
961
|
+
role: "scrollbar.track",
|
|
962
|
+
frozen: "#e2e8f0"
|
|
963
|
+
},
|
|
964
|
+
thumb: {
|
|
965
|
+
role: "scrollbar.thumb",
|
|
966
|
+
frozen: "#cbd5e1"
|
|
967
|
+
},
|
|
968
|
+
buttonFilledText: {
|
|
969
|
+
role: "button.filledText",
|
|
970
|
+
frozen: "#ffffff"
|
|
971
|
+
},
|
|
972
|
+
tagBackground: {
|
|
973
|
+
role: "tag.background",
|
|
974
|
+
frozen: "#e2e8f0"
|
|
975
|
+
},
|
|
976
|
+
syntaxTheme: {
|
|
977
|
+
role: void 0,
|
|
978
|
+
literal: "catppuccin-latte"
|
|
979
|
+
},
|
|
980
|
+
diffAddedBackground: {
|
|
981
|
+
role: "diff.addedBackground",
|
|
982
|
+
frozen: "#dcfce7"
|
|
983
|
+
},
|
|
984
|
+
diffRemovedBackground: {
|
|
985
|
+
role: "diff.removedBackground",
|
|
986
|
+
frozen: "#fee2e2"
|
|
987
|
+
},
|
|
988
|
+
diffAddedSign: {
|
|
989
|
+
role: "diff.addedSign",
|
|
990
|
+
frozen: "#15803d"
|
|
991
|
+
},
|
|
992
|
+
diffRemovedSign: {
|
|
993
|
+
role: "diff.removedSign",
|
|
994
|
+
frozen: "#b91c1c"
|
|
995
|
+
},
|
|
996
|
+
diffContent: {
|
|
997
|
+
role: "diff.content",
|
|
998
|
+
frozen: "#0f172a"
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
const TUI_DARK_OVERRIDES = {
|
|
1002
|
+
accent: {
|
|
1003
|
+
role: "brand.primary",
|
|
1004
|
+
frozen: "#a78bfa"
|
|
1005
|
+
},
|
|
1006
|
+
muted: {
|
|
1007
|
+
role: "text.muted",
|
|
1008
|
+
frozen: "#94a3b8"
|
|
1009
|
+
},
|
|
1010
|
+
border: {
|
|
1011
|
+
role: "border.defaultColor",
|
|
1012
|
+
frozen: "#3f3f46"
|
|
1013
|
+
},
|
|
1014
|
+
borderSuppressed: {
|
|
1015
|
+
role: "border.subtleColor",
|
|
1016
|
+
frozen: "#2e2e2e"
|
|
1017
|
+
},
|
|
1018
|
+
success: {
|
|
1019
|
+
role: "status.success",
|
|
1020
|
+
frozen: "#4ade80"
|
|
1021
|
+
},
|
|
1022
|
+
error: {
|
|
1023
|
+
role: "status.danger",
|
|
1024
|
+
frozen: "#f87171"
|
|
1025
|
+
},
|
|
1026
|
+
dangerSurface: {
|
|
1027
|
+
role: "surface.danger",
|
|
1028
|
+
frozen: "#3c181a"
|
|
1029
|
+
},
|
|
1030
|
+
warning: {
|
|
1031
|
+
role: "status.warning",
|
|
1032
|
+
frozen: "#fbbf24"
|
|
1033
|
+
},
|
|
1034
|
+
info: {
|
|
1035
|
+
role: "status.info",
|
|
1036
|
+
frozen: "#38bdf8"
|
|
1037
|
+
},
|
|
1038
|
+
brand: {
|
|
1039
|
+
role: "brand.primary",
|
|
1040
|
+
frozen: "#a28ef9"
|
|
1041
|
+
},
|
|
1042
|
+
brandHighlight: {
|
|
1043
|
+
role: "brand.neon",
|
|
1044
|
+
frozen: "#22d3ee"
|
|
1045
|
+
},
|
|
1046
|
+
brandDim: {
|
|
1047
|
+
role: "brand.dim",
|
|
1048
|
+
frozen: "#8b90a6"
|
|
1049
|
+
},
|
|
1050
|
+
selectedText: {
|
|
1051
|
+
role: "selection.text",
|
|
1052
|
+
frozen: "#22d3ee"
|
|
1053
|
+
},
|
|
1054
|
+
selectionText: {
|
|
1055
|
+
role: "selection.text",
|
|
1056
|
+
frozen: "#22d3ee"
|
|
1057
|
+
},
|
|
1058
|
+
focusIndicator: {
|
|
1059
|
+
role: "focus.ring",
|
|
1060
|
+
frozen: "#22d3ee"
|
|
1061
|
+
},
|
|
1062
|
+
linkActive: {
|
|
1063
|
+
role: "link.active",
|
|
1064
|
+
frozen: "#22d3ee"
|
|
1065
|
+
},
|
|
1066
|
+
syntaxBuiltin: {
|
|
1067
|
+
role: "syntax.builtin",
|
|
1068
|
+
frozen: "#c4b5fd"
|
|
1069
|
+
},
|
|
1070
|
+
overlayBackground: {
|
|
1071
|
+
role: "overlay.background",
|
|
1072
|
+
frozen: "#1e1b2e"
|
|
1073
|
+
},
|
|
1074
|
+
overlayText: {
|
|
1075
|
+
role: "overlay.text",
|
|
1076
|
+
frozen: "#e2e8f0"
|
|
1077
|
+
},
|
|
1078
|
+
track: {
|
|
1079
|
+
role: "scrollbar.track",
|
|
1080
|
+
frozen: "#2f2f3a"
|
|
1081
|
+
},
|
|
1082
|
+
thumb: {
|
|
1083
|
+
role: "scrollbar.thumb",
|
|
1084
|
+
frozen: "#5b5b6a"
|
|
1085
|
+
},
|
|
1086
|
+
buttonFilledText: {
|
|
1087
|
+
role: "button.filledText",
|
|
1088
|
+
frozen: "#0f0f14"
|
|
1089
|
+
},
|
|
1090
|
+
tagBackground: {
|
|
1091
|
+
role: "tag.background",
|
|
1092
|
+
frozen: "#2a2a33"
|
|
1093
|
+
},
|
|
1094
|
+
syntaxTheme: {
|
|
1095
|
+
role: void 0,
|
|
1096
|
+
literal: "catppuccin-mocha"
|
|
1097
|
+
},
|
|
1098
|
+
diffAddedBackground: {
|
|
1099
|
+
role: "diff.addedBackground",
|
|
1100
|
+
frozen: "#1c2b25"
|
|
1101
|
+
},
|
|
1102
|
+
diffRemovedBackground: {
|
|
1103
|
+
role: "diff.removedBackground",
|
|
1104
|
+
frozen: "#2e1e22"
|
|
1105
|
+
},
|
|
1106
|
+
diffAddedSign: {
|
|
1107
|
+
role: "diff.addedSign",
|
|
1108
|
+
frozen: "#4ade80"
|
|
1109
|
+
},
|
|
1110
|
+
diffRemovedSign: {
|
|
1111
|
+
role: "diff.removedSign",
|
|
1112
|
+
frozen: "#f87171"
|
|
1113
|
+
},
|
|
1114
|
+
diffContent: {
|
|
1115
|
+
role: "diff.content",
|
|
1116
|
+
frozen: "#e2e8f0"
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
function bindingOf(key, mode) {
|
|
1120
|
+
if (mode === "dark") {
|
|
1121
|
+
const override = TUI_DARK_OVERRIDES[key];
|
|
1122
|
+
if (override !== void 0) return override;
|
|
1123
|
+
}
|
|
1124
|
+
return TUI_COLOR_BINDINGS[key];
|
|
1125
|
+
}
|
|
1126
|
+
function tuiColorValue(key, mode) {
|
|
1127
|
+
const binding = bindingOf(key, mode);
|
|
1128
|
+
if (binding.frozen !== void 0) return binding.frozen ?? void 0;
|
|
1129
|
+
if (binding.literal !== void 0) return binding.literal;
|
|
1130
|
+
if (binding.role !== void 0) return resolveRole(binding.role, mode);
|
|
1131
|
+
}
|
|
1132
|
+
function tuiThemeColors(mode) {
|
|
1133
|
+
const colors = {};
|
|
1134
|
+
for (const key of TUI_COLOR_KEYS) {
|
|
1135
|
+
if (key === "text") continue;
|
|
1136
|
+
const value = tuiColorValue(key, mode);
|
|
1137
|
+
if (value === void 0) throw new Error(`ui-token: TUI key "${key}" has no ${mode} value`);
|
|
1138
|
+
colors[key] = value;
|
|
1139
|
+
}
|
|
1140
|
+
return {
|
|
1141
|
+
...colors,
|
|
1142
|
+
text: void 0
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
//#endregion
|
|
1147
|
+
//#region src/projections/inline.ts
|
|
1148
|
+
const INLINE_BINDINGS = {
|
|
1149
|
+
pageBackground: {
|
|
1150
|
+
light: "surface.page",
|
|
1151
|
+
dark: "surface.page"
|
|
1152
|
+
},
|
|
1153
|
+
cardBackground: {
|
|
1154
|
+
light: "surface.card",
|
|
1155
|
+
dark: "surface.card"
|
|
1156
|
+
},
|
|
1157
|
+
ink: {
|
|
1158
|
+
light: "text.primary",
|
|
1159
|
+
dark: "text.primary"
|
|
1160
|
+
},
|
|
1161
|
+
inkMuted: {
|
|
1162
|
+
light: "text.secondary",
|
|
1163
|
+
dark: "text.secondary"
|
|
1164
|
+
},
|
|
1165
|
+
wordmarkBase: {
|
|
1166
|
+
light: "brand.mark",
|
|
1167
|
+
dark: "brand.mark"
|
|
1168
|
+
},
|
|
1169
|
+
wordmarkHighlight: {
|
|
1170
|
+
light: "brand.neon",
|
|
1171
|
+
dark: "brand.neon"
|
|
1172
|
+
},
|
|
1173
|
+
successBackground: {
|
|
1174
|
+
light: "status.successSurface",
|
|
1175
|
+
dark: { literal: "#2f6e40" }
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
const INLINE_SHADOWS = {
|
|
1179
|
+
light: "0 1px 2px rgba(18,21,43,.05), 0 2px 6px rgba(18,21,43,.05)",
|
|
1180
|
+
dark: "0 1px 2px rgba(0,0,0,.32), 0 2px 6px rgba(0,0,0,.3)"
|
|
1181
|
+
};
|
|
1182
|
+
function inlineValue(binding, mode) {
|
|
1183
|
+
return typeof binding === "string" ? resolveRole(binding, mode) : binding.literal;
|
|
1184
|
+
}
|
|
1185
|
+
function inlinePalette(mode) {
|
|
1186
|
+
return {
|
|
1187
|
+
pageBackground: inlineValue(INLINE_BINDINGS.pageBackground[mode], mode),
|
|
1188
|
+
cardBackground: inlineValue(INLINE_BINDINGS.cardBackground[mode], mode),
|
|
1189
|
+
ink: inlineValue(INLINE_BINDINGS.ink[mode], mode),
|
|
1190
|
+
inkMuted: inlineValue(INLINE_BINDINGS.inkMuted[mode], mode),
|
|
1191
|
+
wordmarkBase: inlineValue(INLINE_BINDINGS.wordmarkBase[mode], mode),
|
|
1192
|
+
wordmarkHighlight: inlineValue(INLINE_BINDINGS.wordmarkHighlight[mode], mode),
|
|
1193
|
+
rainbow: SPECTRUM[mode],
|
|
1194
|
+
success: resolveRole("status.success", mode),
|
|
1195
|
+
successBackground: inlineValue(INLINE_BINDINGS.successBackground[mode], mode),
|
|
1196
|
+
danger: resolveRole("status.danger", mode),
|
|
1197
|
+
dangerBackground: resolveRole("status.dangerSurface", mode),
|
|
1198
|
+
shadow: INLINE_SHADOWS[mode]
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
function inlineDeclarations(mode) {
|
|
1202
|
+
const palette = inlinePalette(mode);
|
|
1203
|
+
return [
|
|
1204
|
+
`--page-bg: ${palette.pageBackground};`,
|
|
1205
|
+
`--card-bg: ${palette.cardBackground};`,
|
|
1206
|
+
`--ink: ${palette.ink};`,
|
|
1207
|
+
`--ink-mute: ${palette.inkMuted};`,
|
|
1208
|
+
`--wordmark-base: ${palette.wordmarkBase};`,
|
|
1209
|
+
`--wordmark-highlight: ${palette.wordmarkHighlight};`,
|
|
1210
|
+
...palette.rainbow.map((color, index) => `--rainbow-${index + 1}: ${color};`),
|
|
1211
|
+
`--success: ${palette.success};`,
|
|
1212
|
+
`--success-bg: ${palette.successBackground};`,
|
|
1213
|
+
`--danger: ${palette.danger};`,
|
|
1214
|
+
`--danger-bg: ${palette.dangerBackground};`,
|
|
1215
|
+
`--shadow: ${palette.shadow};`
|
|
1216
|
+
].join("\n ");
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
//#endregion
|
|
1220
|
+
//#region src/scalars.ts
|
|
1221
|
+
const SCALAR_TOKENS = {
|
|
1222
|
+
"--otto-radius-xs": { light: "6px" },
|
|
1223
|
+
"--otto-radius-sm": { light: "8px" },
|
|
1224
|
+
"--otto-radius-md": { light: "12px" },
|
|
1225
|
+
"--otto-radius-md2": { light: "14px" },
|
|
1226
|
+
"--otto-radius-lg": { light: "20px" },
|
|
1227
|
+
"--otto-radius-xl": { light: "24px" },
|
|
1228
|
+
"--otto-radius-2xl": { light: "28px" },
|
|
1229
|
+
"--otto-radius-pill": { light: "999px" },
|
|
1230
|
+
"--otto-radius-icon-btn": { light: "var(--otto-radius-md2)" },
|
|
1231
|
+
"--otto-radius-card": { light: "var(--otto-radius-xl)" },
|
|
1232
|
+
"--otto-radius-card-lg": { light: "var(--otto-radius-2xl)" },
|
|
1233
|
+
"--otto-space-1": { light: "4px" },
|
|
1234
|
+
"--otto-space-2": { light: "8px" },
|
|
1235
|
+
"--otto-space-3": { light: "12px" },
|
|
1236
|
+
"--otto-space-4": { light: "16px" },
|
|
1237
|
+
"--otto-space-5": { light: "20px" },
|
|
1238
|
+
"--otto-space-6": { light: "24px" },
|
|
1239
|
+
"--otto-space-7": { light: "32px" },
|
|
1240
|
+
"--otto-space-8": { light: "40px" },
|
|
1241
|
+
"--otto-space-9": { light: "48px" },
|
|
1242
|
+
"--otto-space-10": { light: "64px" },
|
|
1243
|
+
"--otto-space-11": { light: "72px" },
|
|
1244
|
+
"--otto-icon-xs": { light: "12px" },
|
|
1245
|
+
"--otto-icon-sm": { light: "15px" },
|
|
1246
|
+
"--otto-icon-md": { light: "20px" },
|
|
1247
|
+
"--otto-icon-lg": { light: "24px" },
|
|
1248
|
+
"--otto-icon-xl": { light: "32px" },
|
|
1249
|
+
"--otto-font-2xs": { light: "10px" },
|
|
1250
|
+
"--otto-font-xs": { light: "12px" },
|
|
1251
|
+
"--otto-font-sm": { light: "13px" },
|
|
1252
|
+
"--otto-font-md": { light: "15px" },
|
|
1253
|
+
"--otto-font-subtitle": { light: "18px" },
|
|
1254
|
+
"--otto-mono": { light: "ui-monospace, \"SF Mono\", \"Cascadia Code\", \"Roboto Mono\", Consolas, monospace" },
|
|
1255
|
+
"--otto-sans": { light: "-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"PingFang SC\", \"Helvetica Neue\", Arial, sans-serif" },
|
|
1256
|
+
"--otto-hairline-w": { light: "0.75px" },
|
|
1257
|
+
"--otto-border-subtle": { light: "var(--otto-hairline-w) solid var(--otto-ramp-ink-2)" },
|
|
1258
|
+
"--otto-border-card": { light: "var(--otto-hairline-w) solid var(--otto-ramp-ink-3)" },
|
|
1259
|
+
"--otto-border-interactive": { light: "var(--otto-hairline-w) solid var(--otto-ramp-ink-8)" },
|
|
1260
|
+
"--otto-border-strong": { light: "var(--otto-hairline-w) solid var(--otto-ramp-ink-5)" },
|
|
1261
|
+
"--otto-border-elevated": {
|
|
1262
|
+
light: "1px solid var(--otto-ramp-ink-5)",
|
|
1263
|
+
dark: "1px solid rgba(255,255,255,.22)"
|
|
1264
|
+
},
|
|
1265
|
+
"--otto-border-elevated-strong": {
|
|
1266
|
+
light: "1px solid var(--otto-ramp-ink-6)",
|
|
1267
|
+
dark: "1px solid rgba(255,255,255,.32)"
|
|
1268
|
+
},
|
|
1269
|
+
"--otto-border-accent": {
|
|
1270
|
+
light: "1.25px solid var(--otto-ramp-navy-9)",
|
|
1271
|
+
dark: "1.25px solid var(--otto-ramp-navy-7)"
|
|
1272
|
+
},
|
|
1273
|
+
"--otto-menu-separator": {
|
|
1274
|
+
light: "1px solid var(--otto-ramp-ink-4)",
|
|
1275
|
+
dark: "1px solid var(--otto-ramp-ink-6)"
|
|
1276
|
+
},
|
|
1277
|
+
"--otto-shadow-card": {
|
|
1278
|
+
light: "0 1px 2px rgba(18,21,43,.04), 0 8px 24px rgba(18,21,43,.06)",
|
|
1279
|
+
dark: "0 1px 2px rgba(0,0,0,.32), 0 8px 24px rgba(0,0,0,.4)"
|
|
1280
|
+
},
|
|
1281
|
+
"--otto-shadow-panel": {
|
|
1282
|
+
light: "0 1px 1px rgba(18,21,43,.03), 0 4px 16px rgba(18,21,43,.05)",
|
|
1283
|
+
dark: "0 1px 1px rgba(0,0,0,.24), 0 4px 16px rgba(0,0,0,.32)"
|
|
1284
|
+
},
|
|
1285
|
+
"--otto-shadow-nav": {
|
|
1286
|
+
light: "0 12px 32px rgba(0,0,0,.28)",
|
|
1287
|
+
dark: "0 12px 32px rgba(0,0,0,.55)"
|
|
1288
|
+
},
|
|
1289
|
+
"--otto-shadow-card-hover": {
|
|
1290
|
+
light: "0 4px 16px rgba(18,21,43,.08)",
|
|
1291
|
+
dark: "0 4px 20px rgba(0,0,0,.4)"
|
|
1292
|
+
},
|
|
1293
|
+
"--otto-shadow-inset-subtle": {
|
|
1294
|
+
light: "inset 0 1px 2px rgba(0,0,0,.06)",
|
|
1295
|
+
dark: "inset 0 1px 3px rgba(0,0,0,.22)"
|
|
1296
|
+
},
|
|
1297
|
+
"--otto-shadow-thumb-active": { light: "0 1px 3px rgba(20,52,140,.25)" },
|
|
1298
|
+
"--otto-opacity-disabled": { light: "0.4" },
|
|
1299
|
+
"--otto-opacity-muted": { light: "0.5" },
|
|
1300
|
+
"--otto-size-xs": { light: "28px" },
|
|
1301
|
+
"--otto-shell-header-height": { light: "48px" },
|
|
1302
|
+
"--otto-shell-stage-padding": { light: "var(--otto-space-2)" },
|
|
1303
|
+
"--otto-shell-status-bar-height": { light: "32px" },
|
|
1304
|
+
"--otto-sidebar-width": { light: "260px" },
|
|
1305
|
+
"--otto-content-max-width-conversation": { light: "840px" },
|
|
1306
|
+
"--otto-ring-width": { light: "2px" },
|
|
1307
|
+
"--otto-ring-offset": { light: "2px" },
|
|
1308
|
+
"--otto-cursor-button": { light: "pointer" },
|
|
1309
|
+
"--otto-cursor-checkbox": { light: "pointer" },
|
|
1310
|
+
"--otto-cursor-disabled": { light: "not-allowed" },
|
|
1311
|
+
"--otto-cursor-link": { light: "pointer" },
|
|
1312
|
+
"--otto-cursor-menu-item": { light: "pointer" },
|
|
1313
|
+
"--otto-cursor-radio": { light: "pointer" },
|
|
1314
|
+
"--otto-cursor-slider-thumb": { light: "grab" },
|
|
1315
|
+
"--otto-cursor-slider-thumb-active": { light: "grabbing" },
|
|
1316
|
+
"--otto-cursor-switch": { light: "pointer" }
|
|
1317
|
+
};
|
|
1318
|
+
function scalarValue(name, mode) {
|
|
1319
|
+
const token = SCALAR_TOKENS[name];
|
|
1320
|
+
if (token === void 0) throw new Error(`ui-token: unknown scalar token "${name}"`);
|
|
1321
|
+
if (mode === "dark") return token.dark ?? token.light;
|
|
1322
|
+
return token.light;
|
|
1323
|
+
}
|
|
1324
|
+
function scalarDeclarations(mode) {
|
|
1325
|
+
return Object.keys(SCALAR_TOKENS).map((name) => `${name}: ${scalarValue(name, mode)};`);
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
//#endregion
|
|
1329
|
+
//#region src/projections/web.ts
|
|
1330
|
+
const LEGACY_RAMP_PREFIXES = {
|
|
1331
|
+
violet: "--otto-accent",
|
|
1332
|
+
navy: "--otto-brand",
|
|
1333
|
+
ink: "--otto-gray",
|
|
1334
|
+
grass: "--otto-grass",
|
|
1335
|
+
amber: "--otto-amber",
|
|
1336
|
+
red: "--otto-red"
|
|
1337
|
+
};
|
|
1338
|
+
const LEGACY_ALIASES = {
|
|
1339
|
+
"--otto-accent": "brand.decor",
|
|
1340
|
+
"--otto-accent-hover": "brand.primaryHover",
|
|
1341
|
+
"--otto-accent-soft": "brand.primarySoft",
|
|
1342
|
+
"--otto-accent-solid": "brand.primarySolid",
|
|
1343
|
+
"--otto-accent-solid-hover": "brand.primarySolidHover",
|
|
1344
|
+
"--otto-bg-page": "surface.page",
|
|
1345
|
+
"--otto-bg-card": "surface.card",
|
|
1346
|
+
"--otto-bg-dark": "surface.dark",
|
|
1347
|
+
"--otto-bg-subtle": "surface.subtle",
|
|
1348
|
+
"--otto-bg-pill-subtle": "surface.pillSubtle",
|
|
1349
|
+
"--otto-bg-nav-glass": "surface.navGlass",
|
|
1350
|
+
"--otto-overlay-bg": "surface.scrim",
|
|
1351
|
+
"--otto-text-on-dark": "text.onDark",
|
|
1352
|
+
"--otto-text-primary": "text.primary",
|
|
1353
|
+
"--otto-text-secondary": "text.secondary",
|
|
1354
|
+
"--otto-text-on-accent": "text.onAccent",
|
|
1355
|
+
"--otto-text-on-accent-secondary": "text.onAccentSecondary",
|
|
1356
|
+
"--otto-success": "status.success",
|
|
1357
|
+
"--otto-success-strong": "status.successStrong",
|
|
1358
|
+
"--otto-success-text": "status.successStrong",
|
|
1359
|
+
"--otto-grass-surface": "status.successSurface",
|
|
1360
|
+
"--otto-warning": "status.warning",
|
|
1361
|
+
"--otto-warning-strong": "status.warningStrong",
|
|
1362
|
+
"--otto-warning-text": "status.warningStrong",
|
|
1363
|
+
"--otto-amber-surface": "status.warningSurface",
|
|
1364
|
+
"--otto-danger": "status.danger",
|
|
1365
|
+
"--otto-danger-strong": "status.dangerStrong",
|
|
1366
|
+
"--otto-danger-surface": "status.dangerSurface",
|
|
1367
|
+
"--otto-danger-soft": "status.dangerSurface",
|
|
1368
|
+
"--otto-message-user-bg": "surface.userMessage",
|
|
1369
|
+
"--otto-border-timeline": "border.timeline",
|
|
1370
|
+
"--otto-icon-search": "icon.search",
|
|
1371
|
+
"--otto-icon-file": "icon.file",
|
|
1372
|
+
"--otto-icon-write": "icon.write",
|
|
1373
|
+
"--otto-icon-browse": "icon.browse",
|
|
1374
|
+
"--otto-icon-bash": "icon.bash",
|
|
1375
|
+
"--otto-icon-dot-tertiary": "icon.dotTertiary",
|
|
1376
|
+
"--otto-navy": "brand.navy",
|
|
1377
|
+
"--otto-navy-2": "brand.navyDeep",
|
|
1378
|
+
"--otto-peri": "brand.peri",
|
|
1379
|
+
"--otto-peri-soft": "brand.periSoft",
|
|
1380
|
+
"--otto-paper": "paper.base",
|
|
1381
|
+
"--otto-paper-raise": "paper.raise",
|
|
1382
|
+
"--otto-ink": "brand.ink",
|
|
1383
|
+
"--otto-ink-soft": "text.secondary",
|
|
1384
|
+
"--otto-line": "line.default",
|
|
1385
|
+
"--otto-cream": "brand.cream",
|
|
1386
|
+
"--otto-cover-grid": "brand.coverGrid",
|
|
1387
|
+
"--otto-ring-color": "focus.ring"
|
|
1388
|
+
};
|
|
1389
|
+
const WEB_LITERALS = {
|
|
1390
|
+
light: {
|
|
1391
|
+
"--otto-alpha-08": "rgba(0,0,0,.08)",
|
|
1392
|
+
"--otto-alpha-16": "rgba(0,0,0,.149)"
|
|
1393
|
+
},
|
|
1394
|
+
dark: {
|
|
1395
|
+
"--otto-alpha-08": "rgba(255,255,255,.12)",
|
|
1396
|
+
"--otto-alpha-16": "rgba(255,255,255,.1725)"
|
|
1397
|
+
}
|
|
1398
|
+
};
|
|
1399
|
+
function rampVariableName(rampName, step) {
|
|
1400
|
+
return `--otto-ramp-${rampName}-${step}`;
|
|
1401
|
+
}
|
|
1402
|
+
function declarationsOf(mode, includeLegacy) {
|
|
1403
|
+
const lines = [...scalarDeclarations(mode)];
|
|
1404
|
+
for (const rampName of RAMP_NAMES) for (const step of rampStepsOf(rampName, mode)) lines.push(`${rampVariableName(rampName, step)}: ${rampStepColor(rampName, step, mode)};`);
|
|
1405
|
+
SPECTRUM[mode].forEach((color, index) => {
|
|
1406
|
+
lines.push(`--otto-spectrum-${index + 1}: ${color};`);
|
|
1407
|
+
});
|
|
1408
|
+
for (const roleName of ROLE_NAMES) lines.push(`${roleVariableName(roleName)}: ${resolveRole(roleName, mode)};`);
|
|
1409
|
+
if (!includeLegacy) return lines;
|
|
1410
|
+
for (const [name, roleName] of Object.entries(LEGACY_ALIASES)) {
|
|
1411
|
+
const target = roleVariableName(roleName);
|
|
1412
|
+
if (name === target) continue;
|
|
1413
|
+
lines.push(`${name}: var(${target});`);
|
|
1414
|
+
}
|
|
1415
|
+
for (const [name, color] of Object.entries(WEB_LITERALS[mode])) lines.push(`${name}: ${color};`);
|
|
1416
|
+
for (const rampName of RAMP_NAMES) {
|
|
1417
|
+
const prefix = LEGACY_RAMP_PREFIXES[rampName];
|
|
1418
|
+
if (prefix === void 0) continue;
|
|
1419
|
+
for (const step of rampStepsOf(rampName, mode)) lines.push(`${prefix}-${step}: var(${rampVariableName(rampName, step)});`);
|
|
1420
|
+
}
|
|
1421
|
+
return lines;
|
|
1422
|
+
}
|
|
1423
|
+
function webTokenDeclarations(mode, options = {}) {
|
|
1424
|
+
return declarationsOf(mode, options.includeLegacyAliases ?? true);
|
|
1425
|
+
}
|
|
1426
|
+
function webTokensCss(options = {}) {
|
|
1427
|
+
const includeLegacy = options.includeLegacyAliases ?? true;
|
|
1428
|
+
const lightLines = declarationsOf("light", includeLegacy);
|
|
1429
|
+
const darkLines = declarationsOf("dark", includeLegacy);
|
|
1430
|
+
const indent = (lines) => lines.map((line) => ` ${line}`).join("\n");
|
|
1431
|
+
return [
|
|
1432
|
+
":root {",
|
|
1433
|
+
" color-scheme: light dark;",
|
|
1434
|
+
indent(lightLines),
|
|
1435
|
+
"}",
|
|
1436
|
+
"",
|
|
1437
|
+
"[data-theme=\"dark\"],",
|
|
1438
|
+
".dark,",
|
|
1439
|
+
".dark-theme {",
|
|
1440
|
+
indent(darkLines),
|
|
1441
|
+
"}",
|
|
1442
|
+
"",
|
|
1443
|
+
"@media (prefers-color-scheme: dark) {",
|
|
1444
|
+
" :root:not([data-theme=\"light\"]) {",
|
|
1445
|
+
indent(darkLines),
|
|
1446
|
+
" }",
|
|
1447
|
+
"}",
|
|
1448
|
+
""
|
|
1449
|
+
].join("\n");
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
//#endregion
|
|
1453
|
+
//#region src/theme-colors.ts
|
|
1454
|
+
function themeNamesOf(themes) {
|
|
1455
|
+
return Object.keys(themes);
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
//#endregion
|
|
1459
|
+
//#region src/themes/base.ts
|
|
1460
|
+
const BASE_TOKENS = {
|
|
1461
|
+
"--otto-space-0": "0",
|
|
1462
|
+
"--otto-space-05": "2px",
|
|
1463
|
+
"--otto-space-1": "4px",
|
|
1464
|
+
"--otto-space-15": "6px",
|
|
1465
|
+
"--otto-space-2": "8px",
|
|
1466
|
+
"--otto-space-25": "10px",
|
|
1467
|
+
"--otto-space-3": "12px",
|
|
1468
|
+
"--otto-space-35": "14px",
|
|
1469
|
+
"--otto-space-4": "16px",
|
|
1470
|
+
"--otto-space-5": "20px",
|
|
1471
|
+
"--otto-space-6": "24px",
|
|
1472
|
+
"--otto-space-8": "32px",
|
|
1473
|
+
"--otto-space-10": "40px",
|
|
1474
|
+
"--otto-control-2xs": "16px",
|
|
1475
|
+
"--otto-control-xs": "20px",
|
|
1476
|
+
"--otto-control-sm": "24px",
|
|
1477
|
+
"--otto-control-md": "28px",
|
|
1478
|
+
"--otto-control-lg": "32px",
|
|
1479
|
+
"--otto-header-sm": "36px",
|
|
1480
|
+
"--otto-header-md": "40px",
|
|
1481
|
+
"--otto-header-lg": "44px",
|
|
1482
|
+
"--otto-leading-tight": "1.2",
|
|
1483
|
+
"--otto-leading-relaxed": "1.7",
|
|
1484
|
+
"--otto-tracking-tight": "-0.01em",
|
|
1485
|
+
"--otto-tracking-wide": "0.03em",
|
|
1486
|
+
"--otto-motion-blink": "1s",
|
|
1487
|
+
"--otto-icon-xs": "12px",
|
|
1488
|
+
"--otto-icon-sm": "14px",
|
|
1489
|
+
"--otto-icon-md": "16px",
|
|
1490
|
+
"--otto-icon-lg": "20px",
|
|
1491
|
+
"--otto-icon-xl": "24px",
|
|
1492
|
+
"--otto-layout-activity": "52px",
|
|
1493
|
+
"--otto-layout-sidebar": "280px",
|
|
1494
|
+
"--otto-layout-chat": "400px",
|
|
1495
|
+
"--otto-layout-panel": "200px",
|
|
1496
|
+
"--otto-layout-drawer": "300px",
|
|
1497
|
+
"--otto-layout-palette": "620px",
|
|
1498
|
+
"--otto-layout-toast": "360px",
|
|
1499
|
+
"--otto-layout-menu": "210px",
|
|
1500
|
+
"--otto-layout-popover": "280px",
|
|
1501
|
+
"--otto-layout-inspector": "420px",
|
|
1502
|
+
"--otto-layout-tab-min": "80px",
|
|
1503
|
+
"--otto-layout-cell-max": "260px",
|
|
1504
|
+
"--otto-layout-label": "160px",
|
|
1505
|
+
"--otto-layout-thumb": "150px",
|
|
1506
|
+
"--otto-layout-value": "56px",
|
|
1507
|
+
"--otto-layout-pill-text": "84px",
|
|
1508
|
+
"--otto-layout-search": "260px",
|
|
1509
|
+
"--otto-layout-editor-min": "150px",
|
|
1510
|
+
"--otto-layout-editor-tall": "280px",
|
|
1511
|
+
"--otto-layout-chart": "220px",
|
|
1512
|
+
"--otto-layout-empty-lg": "300px",
|
|
1513
|
+
"--otto-z-raised": "5",
|
|
1514
|
+
"--otto-z-float": "10",
|
|
1515
|
+
"--otto-z-drawer": "30",
|
|
1516
|
+
"--otto-z-modal": "40",
|
|
1517
|
+
"--otto-z-menu": "45",
|
|
1518
|
+
"--otto-z-toast": "50",
|
|
1519
|
+
"--otto-opacity-disabled": "0.38",
|
|
1520
|
+
"--otto-opacity-faint": "0.45",
|
|
1521
|
+
"--otto-opacity-muted": "0.6",
|
|
1522
|
+
"--otto-on-solid": "#ffffff",
|
|
1523
|
+
"--otto-mask-solid": "#000000",
|
|
1524
|
+
"--otto-indicator-width": "2px"
|
|
1525
|
+
};
|
|
1526
|
+
const DERIVED_TOKENS = {
|
|
1527
|
+
"--otto-scrim": "color-mix(in srgb, var(--otto-window) 45%, transparent)",
|
|
1528
|
+
"--otto-accent-soft": "color-mix(in srgb, var(--otto-accent) 16%, transparent)",
|
|
1529
|
+
"--otto-selected": "color-mix(in srgb, var(--otto-accent) 20%, transparent)",
|
|
1530
|
+
"--otto-hover": "color-mix(in srgb, var(--otto-text-muted) 10%, transparent)",
|
|
1531
|
+
"--otto-chart-grid": "color-mix(in srgb, var(--otto-text-muted) 16%, transparent)",
|
|
1532
|
+
"--otto-ring-badge": "0 0 0 2px var(--otto-window)",
|
|
1533
|
+
"--otto-ring-focus": "0 0 0 var(--otto-focus-width) var(--otto-accent-soft)",
|
|
1534
|
+
"--otto-tab-flare-left": "4px 4px 0 4px var(--otto-surface-panel)",
|
|
1535
|
+
"--otto-tab-flare-right": "-4px 4px 0 4px var(--otto-surface-panel)",
|
|
1536
|
+
"--otto-diff-add": "color-mix(in srgb, var(--otto-ok) 16%, transparent)",
|
|
1537
|
+
"--otto-diff-del": "color-mix(in srgb, var(--otto-err) 16%, transparent)"
|
|
1538
|
+
};
|
|
1539
|
+
|
|
1540
|
+
//#endregion
|
|
1541
|
+
//#region src/themes/builtin.ts
|
|
1542
|
+
const BASE_THEME_VALUES = {
|
|
1543
|
+
"font.family.ui": "-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"PingFang SC\", system-ui, sans-serif",
|
|
1544
|
+
"font.family.mono": "\"SF Mono\", ui-monospace, Menlo, \"Cascadia Code\", monospace",
|
|
1545
|
+
"font.size.2xs": 10,
|
|
1546
|
+
"font.size.xs": 11,
|
|
1547
|
+
"font.size.sm": 12,
|
|
1548
|
+
"font.size.md": 13,
|
|
1549
|
+
"font.size.lg": 20,
|
|
1550
|
+
"font.size.kpi": 28,
|
|
1551
|
+
"font.lineHeight": 1.45,
|
|
1552
|
+
"font.weight.regular": 400,
|
|
1553
|
+
"font.weight.medium": 500,
|
|
1554
|
+
"font.weight.strong": 600,
|
|
1555
|
+
"font.weight.display": 650,
|
|
1556
|
+
"radius.xs": 4,
|
|
1557
|
+
"radius.control": 6,
|
|
1558
|
+
"radius.field": 8,
|
|
1559
|
+
"radius.panel": 10,
|
|
1560
|
+
"radius.card": 12,
|
|
1561
|
+
"radius.overlay": 14,
|
|
1562
|
+
"radius.pill": 999,
|
|
1563
|
+
"border.width": 1,
|
|
1564
|
+
"border.focusWidth": 2,
|
|
1565
|
+
"space.panelGap": 6,
|
|
1566
|
+
"space.cardGap": 10,
|
|
1567
|
+
"size.row": 26,
|
|
1568
|
+
"size.gridRow": 88,
|
|
1569
|
+
"size.titleBar": 40,
|
|
1570
|
+
"size.statusBar": 28,
|
|
1571
|
+
"elevation.level": "standard",
|
|
1572
|
+
"effect.glow": "off",
|
|
1573
|
+
"effect.grid": "off",
|
|
1574
|
+
"icon.weight": "light",
|
|
1575
|
+
"motion.fast": 120,
|
|
1576
|
+
"motion.normal": 180,
|
|
1577
|
+
"motion.easing": "cubic-bezier(.2,.8,.2,1)"
|
|
1578
|
+
};
|
|
1579
|
+
const BUILTIN_THEMES = [
|
|
1580
|
+
{
|
|
1581
|
+
id: "otto-dark",
|
|
1582
|
+
name: "Otto Dark",
|
|
1583
|
+
base: "dark",
|
|
1584
|
+
tokens: {
|
|
1585
|
+
...BASE_THEME_VALUES,
|
|
1586
|
+
"font.family.ui": "-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"PingFang SC\", system-ui, sans-serif",
|
|
1587
|
+
"font.family.mono": "\"SF Mono\", ui-monospace, Menlo, \"Cascadia Code\", monospace",
|
|
1588
|
+
"font.size.2xs": 10,
|
|
1589
|
+
"font.size.xs": 11,
|
|
1590
|
+
"font.size.sm": 12,
|
|
1591
|
+
"font.size.md": 13,
|
|
1592
|
+
"font.size.lg": 20,
|
|
1593
|
+
"font.size.kpi": 28,
|
|
1594
|
+
"font.lineHeight": 1.45,
|
|
1595
|
+
"font.weight.regular": 400,
|
|
1596
|
+
"font.weight.medium": 500,
|
|
1597
|
+
"font.weight.strong": 600,
|
|
1598
|
+
"font.weight.display": 650,
|
|
1599
|
+
"radius.xs": 4,
|
|
1600
|
+
"radius.control": 6,
|
|
1601
|
+
"radius.field": 8,
|
|
1602
|
+
"radius.panel": 10,
|
|
1603
|
+
"radius.card": 12,
|
|
1604
|
+
"radius.overlay": 14,
|
|
1605
|
+
"radius.pill": 999,
|
|
1606
|
+
"border.width": 1,
|
|
1607
|
+
"border.focusWidth": 2,
|
|
1608
|
+
"space.panelGap": 6,
|
|
1609
|
+
"space.cardGap": 10,
|
|
1610
|
+
"size.row": 26,
|
|
1611
|
+
"size.gridRow": 88,
|
|
1612
|
+
"size.titleBar": 40,
|
|
1613
|
+
"size.statusBar": 28,
|
|
1614
|
+
"elevation.level": "standard",
|
|
1615
|
+
"effect.glow": "off",
|
|
1616
|
+
"effect.grid": "off",
|
|
1617
|
+
"icon.weight": "light",
|
|
1618
|
+
"motion.fast": 120,
|
|
1619
|
+
"motion.normal": 180,
|
|
1620
|
+
"motion.easing": "cubic-bezier(.2,.8,.2,1)",
|
|
1621
|
+
"color.window": "#050505",
|
|
1622
|
+
"color.surface.panel": "#0e0e0f",
|
|
1623
|
+
"color.surface.raised": "#161618",
|
|
1624
|
+
"color.surface.sunken": "#0a0a0b",
|
|
1625
|
+
"color.surface.overlay": "#1c1c1f",
|
|
1626
|
+
"color.border": "#1f1f23",
|
|
1627
|
+
"color.border.strong": "#2e2e34",
|
|
1628
|
+
"color.text": "#ededf0",
|
|
1629
|
+
"color.text.muted": "#9b9ba6",
|
|
1630
|
+
"color.text.idle": "#5c5c66",
|
|
1631
|
+
"color.link": "#22d3ee",
|
|
1632
|
+
"color.accent": "#a28ef9",
|
|
1633
|
+
"color.accent.fg": "#140b2e",
|
|
1634
|
+
"color.statusbar.accent": "#6d4fd6",
|
|
1635
|
+
"color.badge.bg": "#26262a",
|
|
1636
|
+
"color.badge.fg": "#cacad6",
|
|
1637
|
+
"color.status.ok": "#60c33a",
|
|
1638
|
+
"color.status.warn": "#fbbf24",
|
|
1639
|
+
"color.status.err": "#ff4d5e",
|
|
1640
|
+
"color.status.info": "#22d3ee",
|
|
1641
|
+
"color.chart.1": "#a28ef9",
|
|
1642
|
+
"color.chart.2": "#60c33a",
|
|
1643
|
+
"color.chart.3": "#4dd9ef",
|
|
1644
|
+
"color.chart.4": "#fbbf24",
|
|
1645
|
+
"color.chart.5": "#f07bd0",
|
|
1646
|
+
"color.chart.6": "#ff4d5e",
|
|
1647
|
+
"color.shadow": "rgba(2, 6, 12, 0.42)",
|
|
1648
|
+
"color.accent2": "#22d3ee"
|
|
1649
|
+
}
|
|
1650
|
+
},
|
|
1651
|
+
{
|
|
1652
|
+
id: "otto-light",
|
|
1653
|
+
name: "Otto Light",
|
|
1654
|
+
base: "light",
|
|
1655
|
+
extends: "otto-dark",
|
|
1656
|
+
tokens: {
|
|
1657
|
+
"color.window": "#f4f4f5",
|
|
1658
|
+
"color.surface.panel": "#ffffff",
|
|
1659
|
+
"color.surface.raised": "#fafafa",
|
|
1660
|
+
"color.surface.sunken": "#f4f4f5",
|
|
1661
|
+
"color.surface.overlay": "#ffffff",
|
|
1662
|
+
"color.border": "#e7e7ea",
|
|
1663
|
+
"color.border.strong": "#d6d6db",
|
|
1664
|
+
"color.text": "#18181b",
|
|
1665
|
+
"color.text.muted": "#5f5f6b",
|
|
1666
|
+
"color.text.idle": "#a1a1aa",
|
|
1667
|
+
"color.link": "#155e75",
|
|
1668
|
+
"color.accent": "#6d4fd6",
|
|
1669
|
+
"color.accent.fg": "#ffffff",
|
|
1670
|
+
"color.statusbar.accent": "#6d4fd6",
|
|
1671
|
+
"color.badge.bg": "#ede3ff",
|
|
1672
|
+
"color.badge.fg": "#6d4fd6",
|
|
1673
|
+
"color.status.ok": "#15803d",
|
|
1674
|
+
"color.status.warn": "#b45309",
|
|
1675
|
+
"color.status.err": "#dc2626",
|
|
1676
|
+
"color.status.info": "#155e75",
|
|
1677
|
+
"color.chart.1": "#6d4fd6",
|
|
1678
|
+
"color.chart.2": "#16a34a",
|
|
1679
|
+
"color.chart.3": "#0891b2",
|
|
1680
|
+
"color.chart.4": "#d97706",
|
|
1681
|
+
"color.chart.5": "#db2777",
|
|
1682
|
+
"color.chart.6": "#dc2626",
|
|
1683
|
+
"color.shadow": "rgba(20, 40, 60, 0.07)",
|
|
1684
|
+
"elevation.level": "soft",
|
|
1685
|
+
"color.accent2": "#155e75"
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1688
|
+
{
|
|
1689
|
+
id: "otto-neon",
|
|
1690
|
+
name: "Otto Neon",
|
|
1691
|
+
base: "dark",
|
|
1692
|
+
extends: "otto-dark",
|
|
1693
|
+
tokens: {
|
|
1694
|
+
"color.window": "#05080d",
|
|
1695
|
+
"color.surface.panel": "#0b1118",
|
|
1696
|
+
"color.surface.raised": "#101923",
|
|
1697
|
+
"color.surface.sunken": "#070c12",
|
|
1698
|
+
"color.surface.overlay": "#121c27",
|
|
1699
|
+
"color.border": "#16232f",
|
|
1700
|
+
"color.border.strong": "#22384a",
|
|
1701
|
+
"color.text": "#d9f3f8",
|
|
1702
|
+
"color.text.muted": "#7ea3ad",
|
|
1703
|
+
"color.text.idle": "#4b6670",
|
|
1704
|
+
"color.link": "#4dd9ef",
|
|
1705
|
+
"color.accent": "#22d3ee",
|
|
1706
|
+
"color.accent.fg": "#03161b",
|
|
1707
|
+
"color.statusbar.accent": "#0e7490",
|
|
1708
|
+
"color.badge.bg": "#0f2a33",
|
|
1709
|
+
"color.badge.fg": "#95e7f4",
|
|
1710
|
+
"color.chart.1": "#22d3ee",
|
|
1711
|
+
"color.chart.2": "#34d399",
|
|
1712
|
+
"color.chart.3": "#a78bfa",
|
|
1713
|
+
"color.chart.4": "#fb923c",
|
|
1714
|
+
"color.chart.5": "#facc15",
|
|
1715
|
+
"color.chart.6": "#f87171",
|
|
1716
|
+
"radius.panel": 8,
|
|
1717
|
+
"radius.card": 10,
|
|
1718
|
+
"elevation.level": "flat",
|
|
1719
|
+
"color.accent2": "#a78bfa"
|
|
1720
|
+
}
|
|
1721
|
+
},
|
|
1722
|
+
{
|
|
1723
|
+
id: "otto-violet",
|
|
1724
|
+
name: "Otto Violet",
|
|
1725
|
+
base: "dark",
|
|
1726
|
+
extends: "otto-dark",
|
|
1727
|
+
tokens: {
|
|
1728
|
+
"color.window": "#100c1c",
|
|
1729
|
+
"color.surface.panel": "#19142b",
|
|
1730
|
+
"color.surface.raised": "#211a38",
|
|
1731
|
+
"color.surface.sunken": "#140f23",
|
|
1732
|
+
"color.surface.overlay": "#241d3d",
|
|
1733
|
+
"color.border": "#2d2548",
|
|
1734
|
+
"color.border.strong": "#3e3463",
|
|
1735
|
+
"color.text": "#ebe6fa",
|
|
1736
|
+
"color.text.muted": "#9d94bf",
|
|
1737
|
+
"color.link": "#b8a4ff",
|
|
1738
|
+
"color.accent": "#9d7cf4",
|
|
1739
|
+
"color.accent.fg": "#140b2e",
|
|
1740
|
+
"color.statusbar.accent": "#6d4fd6",
|
|
1741
|
+
"color.badge.bg": "#2f2552",
|
|
1742
|
+
"color.badge.fg": "#d6cbff",
|
|
1743
|
+
"color.chart.1": "#9d7cf4",
|
|
1744
|
+
"color.chart.3": "#f07bd0",
|
|
1745
|
+
"radius.panel": 14,
|
|
1746
|
+
"radius.card": 16,
|
|
1747
|
+
"radius.overlay": 18,
|
|
1748
|
+
"color.accent2": "#f07bd0"
|
|
1749
|
+
}
|
|
1750
|
+
},
|
|
1751
|
+
{
|
|
1752
|
+
id: "otto-paper",
|
|
1753
|
+
name: "Otto Paper",
|
|
1754
|
+
base: "light",
|
|
1755
|
+
extends: "otto-light",
|
|
1756
|
+
tokens: {
|
|
1757
|
+
"color.window": "#ece7dd",
|
|
1758
|
+
"color.surface.panel": "#fbf8f2",
|
|
1759
|
+
"color.surface.raised": "#f6f1e7",
|
|
1760
|
+
"color.surface.sunken": "#f1ebdf",
|
|
1761
|
+
"color.surface.overlay": "#fffdf8",
|
|
1762
|
+
"color.border": "#e3dccd",
|
|
1763
|
+
"color.border.strong": "#cdc3ae",
|
|
1764
|
+
"color.text": "#2a2419",
|
|
1765
|
+
"color.text.muted": "#6b6250",
|
|
1766
|
+
"color.text.idle": "#b3a991",
|
|
1767
|
+
"color.link": "#8a4b14",
|
|
1768
|
+
"color.accent": "#b4561b",
|
|
1769
|
+
"color.accent.fg": "#ffffff",
|
|
1770
|
+
"color.statusbar.accent": "#8a4b14",
|
|
1771
|
+
"color.badge.bg": "#efe2cf",
|
|
1772
|
+
"color.badge.fg": "#8a4b14",
|
|
1773
|
+
"color.chart.1": "#b4561b",
|
|
1774
|
+
"color.chart.2": "#4f7d3a",
|
|
1775
|
+
"color.chart.3": "#7b5ea7",
|
|
1776
|
+
"color.chart.4": "#c98a2b",
|
|
1777
|
+
"color.chart.5": "#a8862a",
|
|
1778
|
+
"color.chart.6": "#b23b3b",
|
|
1779
|
+
"color.shadow": "rgba(60, 45, 20, 0.12)",
|
|
1780
|
+
"font.family.ui": "Georgia, \"Songti SC\", serif",
|
|
1781
|
+
"font.size.md": 14,
|
|
1782
|
+
"font.size.sm": 13,
|
|
1783
|
+
"radius.panel": 4,
|
|
1784
|
+
"radius.card": 6,
|
|
1785
|
+
"radius.control": 4,
|
|
1786
|
+
"radius.field": 4,
|
|
1787
|
+
"radius.overlay": 8,
|
|
1788
|
+
"radius.pill": 4,
|
|
1789
|
+
"color.accent2": "#7b5ea7"
|
|
1790
|
+
}
|
|
1791
|
+
},
|
|
1792
|
+
{
|
|
1793
|
+
id: "otto-jdme",
|
|
1794
|
+
name: "Otto × JoyME",
|
|
1795
|
+
base: "light",
|
|
1796
|
+
extends: "otto-light",
|
|
1797
|
+
tokens: {
|
|
1798
|
+
"color.window": "#f0f1f2",
|
|
1799
|
+
"color.surface.panel": "#ffffff",
|
|
1800
|
+
"color.surface.raised": "#ffffff",
|
|
1801
|
+
"color.surface.sunken": "#f8f8f9",
|
|
1802
|
+
"color.surface.overlay": "#ffffff",
|
|
1803
|
+
"color.border": "#f0f1f2",
|
|
1804
|
+
"color.border.strong": "#dcdee0",
|
|
1805
|
+
"color.text": "#1b1b1b",
|
|
1806
|
+
"color.text.muted": "#6a6a6a",
|
|
1807
|
+
"color.text.idle": "#9d9d9d",
|
|
1808
|
+
"color.link": "#1869f5",
|
|
1809
|
+
"color.accent": "#e0301e",
|
|
1810
|
+
"color.accent.fg": "#ffffff",
|
|
1811
|
+
"color.statusbar.accent": "#e0301e",
|
|
1812
|
+
"color.badge.bg": "#ffede6",
|
|
1813
|
+
"color.badge.fg": "#cf1b0a",
|
|
1814
|
+
"color.status.ok": "#1f9d2c",
|
|
1815
|
+
"color.status.warn": "#c27c00",
|
|
1816
|
+
"color.status.err": "#cf1b0a",
|
|
1817
|
+
"color.status.info": "#1869f5",
|
|
1818
|
+
"color.chart.1": "#f63218",
|
|
1819
|
+
"color.chart.2": "#524efe",
|
|
1820
|
+
"color.chart.3": "#c15cff",
|
|
1821
|
+
"color.chart.4": "#1869f5",
|
|
1822
|
+
"color.chart.5": "#faad14",
|
|
1823
|
+
"color.chart.6": "#2ece39",
|
|
1824
|
+
"color.shadow": "rgba(0, 0, 0, 0.08)",
|
|
1825
|
+
"font.family.ui": "\"SF Pro SC\", \"SF Pro Display\", \"PingFang SC\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif",
|
|
1826
|
+
"font.size.2xs": 10,
|
|
1827
|
+
"font.size.xs": 12,
|
|
1828
|
+
"font.size.sm": 12,
|
|
1829
|
+
"font.size.md": 14,
|
|
1830
|
+
"font.size.lg": 18,
|
|
1831
|
+
"font.size.kpi": 24,
|
|
1832
|
+
"font.lineHeight": 1.5715,
|
|
1833
|
+
"font.weight.medium": 500,
|
|
1834
|
+
"font.weight.strong": 600,
|
|
1835
|
+
"font.weight.display": 600,
|
|
1836
|
+
"radius.xs": 2,
|
|
1837
|
+
"radius.control": 4,
|
|
1838
|
+
"radius.field": 8,
|
|
1839
|
+
"radius.panel": 8,
|
|
1840
|
+
"radius.card": 8,
|
|
1841
|
+
"radius.overlay": 12,
|
|
1842
|
+
"radius.pill": 100,
|
|
1843
|
+
"border.width": 1,
|
|
1844
|
+
"space.panelGap": 8,
|
|
1845
|
+
"space.cardGap": 12,
|
|
1846
|
+
"size.row": 32,
|
|
1847
|
+
"elevation.level": "soft",
|
|
1848
|
+
"motion.fast": 200,
|
|
1849
|
+
"motion.normal": 300,
|
|
1850
|
+
"motion.easing": "ease-in-out",
|
|
1851
|
+
"color.accent2": "#7a4dff"
|
|
1852
|
+
}
|
|
1853
|
+
},
|
|
1854
|
+
{
|
|
1855
|
+
id: "otto-wayfinder",
|
|
1856
|
+
name: "Otto × Wayfinder",
|
|
1857
|
+
base: "dark",
|
|
1858
|
+
extends: "otto-dark",
|
|
1859
|
+
tokens: {
|
|
1860
|
+
"color.window": "#050505",
|
|
1861
|
+
"color.surface.panel": "#0e0e0f",
|
|
1862
|
+
"color.surface.raised": "#1c1c1f",
|
|
1863
|
+
"color.surface.sunken": "#0e0e0f",
|
|
1864
|
+
"color.surface.overlay": "#2a2a2e",
|
|
1865
|
+
"color.border": "#2a2a2e",
|
|
1866
|
+
"color.border.strong": "#4a4a52",
|
|
1867
|
+
"color.text": "#ffffff",
|
|
1868
|
+
"color.text.muted": "#a3a3ad",
|
|
1869
|
+
"color.text.idle": "#7f7f87",
|
|
1870
|
+
"color.link": "#2dd3be",
|
|
1871
|
+
"color.accent": "#2dd3be",
|
|
1872
|
+
"color.accent.fg": "#050505",
|
|
1873
|
+
"color.statusbar.accent": "#0d9085",
|
|
1874
|
+
"color.badge.bg": "#2a2a2e",
|
|
1875
|
+
"color.badge.fg": "#cacad6",
|
|
1876
|
+
"color.status.ok": "#2dd3be",
|
|
1877
|
+
"color.status.warn": "#f7c3a1",
|
|
1878
|
+
"color.status.err": "#f23f5d",
|
|
1879
|
+
"color.status.info": "#6a82fc",
|
|
1880
|
+
"color.chart.1": "#2dd3be",
|
|
1881
|
+
"color.chart.2": "#6a82fc",
|
|
1882
|
+
"color.chart.3": "#df9be8",
|
|
1883
|
+
"color.chart.4": "#f7c3a1",
|
|
1884
|
+
"color.chart.5": "#0d9085",
|
|
1885
|
+
"color.chart.6": "#f23f5d",
|
|
1886
|
+
"color.shadow": "rgba(0, 0, 0, 0.5)",
|
|
1887
|
+
"font.family.ui": "\"Rubik\", \"Inter\", system-ui, -apple-system, \"PingFang SC\", sans-serif",
|
|
1888
|
+
"font.family.mono": "\"JetBrains Mono\", \"Fragment Mono\", ui-monospace, monospace",
|
|
1889
|
+
"font.size.md": 14,
|
|
1890
|
+
"font.size.sm": 12,
|
|
1891
|
+
"font.size.xs": 11,
|
|
1892
|
+
"font.size.lg": 17,
|
|
1893
|
+
"font.weight.strong": 700,
|
|
1894
|
+
"font.weight.display": 700,
|
|
1895
|
+
"font.lineHeight": 1.4,
|
|
1896
|
+
"radius.xs": 4,
|
|
1897
|
+
"radius.control": 8,
|
|
1898
|
+
"radius.field": 8,
|
|
1899
|
+
"radius.panel": 12,
|
|
1900
|
+
"radius.card": 12,
|
|
1901
|
+
"radius.overlay": 16,
|
|
1902
|
+
"elevation.level": "strong",
|
|
1903
|
+
"effect.glow": "soft",
|
|
1904
|
+
"motion.fast": 200,
|
|
1905
|
+
"motion.normal": 300,
|
|
1906
|
+
"motion.easing": "ease",
|
|
1907
|
+
"color.accent2": "#df9be8"
|
|
1908
|
+
}
|
|
1909
|
+
},
|
|
1910
|
+
{
|
|
1911
|
+
id: "otto-cyberleek",
|
|
1912
|
+
name: "Otto × Cyberleek",
|
|
1913
|
+
base: "dark",
|
|
1914
|
+
extends: "otto-dark",
|
|
1915
|
+
tokens: {
|
|
1916
|
+
"color.window": "#00050d",
|
|
1917
|
+
"color.surface.panel": "#00081a",
|
|
1918
|
+
"color.surface.raised": "#00102b",
|
|
1919
|
+
"color.surface.sunken": "#00050d",
|
|
1920
|
+
"color.surface.overlay": "#001664",
|
|
1921
|
+
"color.border": "#002266",
|
|
1922
|
+
"color.border.strong": "#003299",
|
|
1923
|
+
"color.text": "#d6efc1",
|
|
1924
|
+
"color.text.muted": "#a0b0c8",
|
|
1925
|
+
"color.text.idle": "#6a7a90",
|
|
1926
|
+
"color.link": "#3d8bff",
|
|
1927
|
+
"color.accent": "#3d8bff",
|
|
1928
|
+
"color.accent.fg": "#00050d",
|
|
1929
|
+
"color.statusbar.accent": "#0064ec",
|
|
1930
|
+
"color.badge.bg": "#001664",
|
|
1931
|
+
"color.badge.fg": "#a0b0c8",
|
|
1932
|
+
"color.status.ok": "#60c33a",
|
|
1933
|
+
"color.status.warn": "#fbbf24",
|
|
1934
|
+
"color.status.err": "#ff3355",
|
|
1935
|
+
"color.status.info": "#3d8bff",
|
|
1936
|
+
"color.chart.1": "#3d8bff",
|
|
1937
|
+
"color.chart.2": "#60c33a",
|
|
1938
|
+
"color.chart.3": "#fbbf24",
|
|
1939
|
+
"color.chart.4": "#ff3355",
|
|
1940
|
+
"color.chart.5": "#5ea0ff",
|
|
1941
|
+
"color.chart.6": "#4a9a2c",
|
|
1942
|
+
"color.shadow": "rgba(0, 100, 236, 0.25)",
|
|
1943
|
+
"font.family.ui": "\"JetBrains Mono\", \"Courier New\", \"Lucida Console\", Monaco, monospace",
|
|
1944
|
+
"font.family.mono": "\"Courier New\", \"Lucida Console\", Monaco, monospace",
|
|
1945
|
+
"font.size.md": 13,
|
|
1946
|
+
"font.size.sm": 12,
|
|
1947
|
+
"font.size.xs": 11,
|
|
1948
|
+
"font.weight.strong": 700,
|
|
1949
|
+
"font.weight.display": 700,
|
|
1950
|
+
"radius.xs": 0,
|
|
1951
|
+
"radius.control": 0,
|
|
1952
|
+
"radius.field": 0,
|
|
1953
|
+
"radius.panel": 0,
|
|
1954
|
+
"radius.card": 0,
|
|
1955
|
+
"radius.overlay": 0,
|
|
1956
|
+
"radius.pill": 0,
|
|
1957
|
+
"elevation.level": "soft",
|
|
1958
|
+
"effect.glow": "neon",
|
|
1959
|
+
"effect.grid": "on",
|
|
1960
|
+
"motion.fast": 150,
|
|
1961
|
+
"motion.normal": 250,
|
|
1962
|
+
"color.accent2": "#60c33a"
|
|
1963
|
+
}
|
|
1964
|
+
},
|
|
1965
|
+
{
|
|
1966
|
+
id: "otto-hc",
|
|
1967
|
+
name: "Otto High Contrast",
|
|
1968
|
+
base: "dark",
|
|
1969
|
+
extends: "otto-dark",
|
|
1970
|
+
tokens: {
|
|
1971
|
+
"color.window": "#000000",
|
|
1972
|
+
"color.surface.panel": "#000000",
|
|
1973
|
+
"color.surface.raised": "#0a0a0a",
|
|
1974
|
+
"color.surface.sunken": "#000000",
|
|
1975
|
+
"color.surface.overlay": "#000000",
|
|
1976
|
+
"color.border": "#6fc3df",
|
|
1977
|
+
"color.border.strong": "#f38518",
|
|
1978
|
+
"color.text": "#ffffff",
|
|
1979
|
+
"color.text.muted": "#d0d0d0",
|
|
1980
|
+
"color.text.idle": "#9a9a9a",
|
|
1981
|
+
"color.link": "#3794ff",
|
|
1982
|
+
"color.accent": "#f38518",
|
|
1983
|
+
"color.accent.fg": "#000000",
|
|
1984
|
+
"color.statusbar.accent": "#000000",
|
|
1985
|
+
"color.badge.bg": "#000000",
|
|
1986
|
+
"color.badge.fg": "#ffffff",
|
|
1987
|
+
"color.status.ok": "#89d185",
|
|
1988
|
+
"color.status.warn": "#ffd370",
|
|
1989
|
+
"color.status.err": "#f48771",
|
|
1990
|
+
"color.status.info": "#75beff",
|
|
1991
|
+
"border.width": 1.5,
|
|
1992
|
+
"border.focusWidth": 3,
|
|
1993
|
+
"elevation.level": "flat",
|
|
1994
|
+
"icon.weight": "regular",
|
|
1995
|
+
"radius.panel": 2,
|
|
1996
|
+
"radius.card": 2,
|
|
1997
|
+
"radius.control": 2,
|
|
1998
|
+
"radius.field": 2,
|
|
1999
|
+
"radius.overlay": 2,
|
|
2000
|
+
"color.accent2": "#ffd370"
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
];
|
|
2004
|
+
|
|
2005
|
+
//#endregion
|
|
2006
|
+
//#region src/themes/contrast-pairs.ts
|
|
2007
|
+
const THEME_CONTRAST_PAIRS = [
|
|
2008
|
+
{
|
|
2009
|
+
foreground: "color.text",
|
|
2010
|
+
background: "color.surface.panel",
|
|
2011
|
+
minimum: 4.5,
|
|
2012
|
+
label: "主文本 / 面板"
|
|
2013
|
+
},
|
|
2014
|
+
{
|
|
2015
|
+
foreground: "color.text",
|
|
2016
|
+
background: "color.surface.raised",
|
|
2017
|
+
minimum: 4.5,
|
|
2018
|
+
label: "主文本 / 卡片"
|
|
2019
|
+
},
|
|
2020
|
+
{
|
|
2021
|
+
foreground: "color.text.muted",
|
|
2022
|
+
background: "color.surface.panel",
|
|
2023
|
+
minimum: 4.5,
|
|
2024
|
+
label: "次要文本 / 面板"
|
|
2025
|
+
},
|
|
2026
|
+
{
|
|
2027
|
+
foreground: "color.text.muted",
|
|
2028
|
+
background: "color.surface.raised",
|
|
2029
|
+
minimum: 3,
|
|
2030
|
+
label: "次要文本 / 卡片(大字)"
|
|
2031
|
+
},
|
|
2032
|
+
{
|
|
2033
|
+
foreground: "color.accent.fg",
|
|
2034
|
+
background: "color.accent",
|
|
2035
|
+
minimum: 4.5,
|
|
2036
|
+
label: "强调字 / 强调色"
|
|
2037
|
+
},
|
|
2038
|
+
{
|
|
2039
|
+
foreground: "color.accent2",
|
|
2040
|
+
background: "color.surface.panel",
|
|
2041
|
+
minimum: 4.5,
|
|
2042
|
+
label: "辅助色 / 面板(AI 标记、创造模式等文字)"
|
|
2043
|
+
},
|
|
2044
|
+
{
|
|
2045
|
+
foreground: "color.accent",
|
|
2046
|
+
background: "color.surface.panel",
|
|
2047
|
+
minimum: 3,
|
|
2048
|
+
label: "强调色 / 面板(图形)"
|
|
2049
|
+
},
|
|
2050
|
+
{
|
|
2051
|
+
foreground: "color.link",
|
|
2052
|
+
background: "color.surface.panel",
|
|
2053
|
+
minimum: 4.5,
|
|
2054
|
+
label: "链接 · 强调文字 / 面板"
|
|
2055
|
+
},
|
|
2056
|
+
{
|
|
2057
|
+
foreground: "color.status.ok",
|
|
2058
|
+
background: "color.surface.raised",
|
|
2059
|
+
minimum: 3,
|
|
2060
|
+
label: "成功 / 卡片(图形)"
|
|
2061
|
+
},
|
|
2062
|
+
{
|
|
2063
|
+
foreground: "color.status.warn",
|
|
2064
|
+
background: "color.surface.raised",
|
|
2065
|
+
minimum: 3,
|
|
2066
|
+
label: "警告 / 卡片(图形)"
|
|
2067
|
+
},
|
|
2068
|
+
{
|
|
2069
|
+
foreground: "color.status.err",
|
|
2070
|
+
background: "color.surface.raised",
|
|
2071
|
+
minimum: 3,
|
|
2072
|
+
label: "错误 / 卡片(图形)"
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
foreground: "color.badge.fg",
|
|
2076
|
+
background: "color.badge.bg",
|
|
2077
|
+
minimum: 4.5,
|
|
2078
|
+
label: "徽标字 / 徽标底"
|
|
2079
|
+
}
|
|
2080
|
+
];
|
|
2081
|
+
|
|
2082
|
+
//#endregion
|
|
2083
|
+
//#region src/themes/density.ts
|
|
2084
|
+
const DENSITY = {
|
|
2085
|
+
comfortable: {},
|
|
2086
|
+
compact: {
|
|
2087
|
+
"space.panelGap": 0,
|
|
2088
|
+
"radius.panel": 0,
|
|
2089
|
+
"space.cardGap": 6,
|
|
2090
|
+
"size.row": 22,
|
|
2091
|
+
"size.gridRow": 76,
|
|
2092
|
+
"size.titleBar": 34,
|
|
2093
|
+
"size.statusBar": 24
|
|
2094
|
+
}
|
|
2095
|
+
};
|
|
2096
|
+
|
|
2097
|
+
//#endregion
|
|
2098
|
+
//#region src/themes/effects.ts
|
|
2099
|
+
const ELEVATION = {
|
|
2100
|
+
flat: [
|
|
2101
|
+
"none",
|
|
2102
|
+
"none",
|
|
2103
|
+
"none",
|
|
2104
|
+
"none"
|
|
2105
|
+
],
|
|
2106
|
+
soft: [
|
|
2107
|
+
"0 0 0 1px var(--otto-shadow-edge), 0 1px 2px -1px var(--otto-shadow)",
|
|
2108
|
+
"0 0 0 1px var(--otto-shadow-edge), 0 2px 6px -2px var(--otto-shadow), 0 8px 24px -8px var(--otto-shadow-tint)",
|
|
2109
|
+
"0 0 0 1px var(--otto-shadow-edge), 0 6px 16px -6px var(--otto-shadow), 0 18px 44px -12px var(--otto-shadow-tint)",
|
|
2110
|
+
"0 0 0 1px var(--otto-shadow-edge), 0 12px 28px -10px var(--otto-shadow), 0 32px 72px -16px var(--otto-shadow-tint)"
|
|
2111
|
+
],
|
|
2112
|
+
standard: [
|
|
2113
|
+
"0 1px 2px -1px var(--otto-shadow)",
|
|
2114
|
+
"0 2px 8px -2px var(--otto-shadow), 0 10px 28px -10px var(--otto-shadow-tint)",
|
|
2115
|
+
"0 8px 20px -8px var(--otto-shadow), 0 24px 56px -16px var(--otto-shadow-tint)",
|
|
2116
|
+
"0 16px 36px -12px var(--otto-shadow), 0 40px 96px -20px var(--otto-shadow-tint)"
|
|
2117
|
+
],
|
|
2118
|
+
strong: [
|
|
2119
|
+
"0 2px 4px -1px var(--otto-shadow)",
|
|
2120
|
+
"0 4px 12px -3px var(--otto-shadow), 0 14px 36px -10px var(--otto-shadow-tint)",
|
|
2121
|
+
"0 12px 28px -10px var(--otto-shadow), 0 32px 72px -16px var(--otto-shadow-tint)",
|
|
2122
|
+
"0 20px 44px -14px var(--otto-shadow), 0 52px 120px -24px var(--otto-shadow-tint)"
|
|
2123
|
+
]
|
|
2124
|
+
};
|
|
2125
|
+
const ICON_WEIGHT = {
|
|
2126
|
+
regular: "0px",
|
|
2127
|
+
light: "0.34px",
|
|
2128
|
+
thin: "0.5px"
|
|
2129
|
+
};
|
|
2130
|
+
const GLOW = {
|
|
2131
|
+
off: "0 0 0 0 transparent",
|
|
2132
|
+
soft: "0 0 0 1px color-mix(in srgb, var(--otto-accent) 35%, transparent), 0 0 12px color-mix(in srgb, var(--otto-accent) 22%, transparent)",
|
|
2133
|
+
neon: "0 0 0 1px var(--otto-accent), 0 0 14px color-mix(in srgb, var(--otto-accent) 45%, transparent)"
|
|
2134
|
+
};
|
|
2135
|
+
const GLOW_TEXT = {
|
|
2136
|
+
off: "none",
|
|
2137
|
+
soft: "0 0 8px color-mix(in srgb, var(--otto-accent) 30%, transparent)",
|
|
2138
|
+
neon: "0 0 10px color-mix(in srgb, var(--otto-accent) 55%, transparent)"
|
|
2139
|
+
};
|
|
2140
|
+
const GRID_PATTERN = "linear-gradient(color-mix(in srgb, var(--otto-accent) 4%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--otto-accent) 4%, transparent) 1px, transparent 1px)";
|
|
2141
|
+
|
|
2142
|
+
//#endregion
|
|
2143
|
+
//#region src/themes/tokens.ts
|
|
2144
|
+
const THEME_TOKENS = [
|
|
2145
|
+
{
|
|
2146
|
+
key: "color.window",
|
|
2147
|
+
css: "--otto-window",
|
|
2148
|
+
group: "color",
|
|
2149
|
+
section: "表面",
|
|
2150
|
+
label: "窗口底色",
|
|
2151
|
+
type: "color"
|
|
2152
|
+
},
|
|
2153
|
+
{
|
|
2154
|
+
key: "color.surface.panel",
|
|
2155
|
+
css: "--otto-surface-panel",
|
|
2156
|
+
group: "color",
|
|
2157
|
+
section: "表面",
|
|
2158
|
+
label: "面板",
|
|
2159
|
+
type: "color"
|
|
2160
|
+
},
|
|
2161
|
+
{
|
|
2162
|
+
key: "color.surface.raised",
|
|
2163
|
+
css: "--otto-surface-raised",
|
|
2164
|
+
group: "color",
|
|
2165
|
+
section: "表面",
|
|
2166
|
+
label: "卡片 / 抬升",
|
|
2167
|
+
type: "color"
|
|
2168
|
+
},
|
|
2169
|
+
{
|
|
2170
|
+
key: "color.surface.sunken",
|
|
2171
|
+
css: "--otto-surface-sunken",
|
|
2172
|
+
group: "color",
|
|
2173
|
+
section: "表面",
|
|
2174
|
+
label: "凹陷 / 输入框",
|
|
2175
|
+
type: "color"
|
|
2176
|
+
},
|
|
2177
|
+
{
|
|
2178
|
+
key: "color.surface.overlay",
|
|
2179
|
+
css: "--otto-surface-overlay",
|
|
2180
|
+
group: "color",
|
|
2181
|
+
section: "表面",
|
|
2182
|
+
label: "浮层(菜单 / 命令面板)",
|
|
2183
|
+
type: "color"
|
|
2184
|
+
},
|
|
2185
|
+
{
|
|
2186
|
+
key: "color.border",
|
|
2187
|
+
css: "--otto-border",
|
|
2188
|
+
group: "color",
|
|
2189
|
+
section: "边框",
|
|
2190
|
+
label: "默认边框",
|
|
2191
|
+
type: "color"
|
|
2192
|
+
},
|
|
2193
|
+
{
|
|
2194
|
+
key: "color.border.strong",
|
|
2195
|
+
css: "--otto-border-strong",
|
|
2196
|
+
group: "color",
|
|
2197
|
+
section: "边框",
|
|
2198
|
+
label: "强调边框",
|
|
2199
|
+
type: "color"
|
|
2200
|
+
},
|
|
2201
|
+
{
|
|
2202
|
+
key: "color.text",
|
|
2203
|
+
css: "--otto-text",
|
|
2204
|
+
group: "color",
|
|
2205
|
+
section: "文本",
|
|
2206
|
+
label: "主文本",
|
|
2207
|
+
type: "color"
|
|
2208
|
+
},
|
|
2209
|
+
{
|
|
2210
|
+
key: "color.text.muted",
|
|
2211
|
+
css: "--otto-text-muted",
|
|
2212
|
+
group: "color",
|
|
2213
|
+
section: "文本",
|
|
2214
|
+
label: "次要文本",
|
|
2215
|
+
type: "color"
|
|
2216
|
+
},
|
|
2217
|
+
{
|
|
2218
|
+
key: "color.text.idle",
|
|
2219
|
+
css: "--otto-idle",
|
|
2220
|
+
group: "color",
|
|
2221
|
+
section: "文本",
|
|
2222
|
+
label: "禁用 / 空闲",
|
|
2223
|
+
type: "color"
|
|
2224
|
+
},
|
|
2225
|
+
{
|
|
2226
|
+
key: "color.link",
|
|
2227
|
+
css: "--otto-link",
|
|
2228
|
+
group: "color",
|
|
2229
|
+
section: "文本",
|
|
2230
|
+
label: "链接 · 强调文字(荧光色文字版,保证 4.5:1)",
|
|
2231
|
+
type: "color"
|
|
2232
|
+
},
|
|
2233
|
+
{
|
|
2234
|
+
key: "color.accent",
|
|
2235
|
+
css: "--otto-accent",
|
|
2236
|
+
group: "color",
|
|
2237
|
+
section: "品牌",
|
|
2238
|
+
label: "强调色",
|
|
2239
|
+
type: "color"
|
|
2240
|
+
},
|
|
2241
|
+
{
|
|
2242
|
+
key: "color.accent2",
|
|
2243
|
+
css: "--otto-accent-2",
|
|
2244
|
+
group: "color",
|
|
2245
|
+
section: "品牌",
|
|
2246
|
+
label: "辅助色(荧光青,otto TUI brand.neon)",
|
|
2247
|
+
type: "color"
|
|
2248
|
+
},
|
|
2249
|
+
{
|
|
2250
|
+
key: "color.accent.fg",
|
|
2251
|
+
css: "--otto-accent-fg",
|
|
2252
|
+
group: "color",
|
|
2253
|
+
section: "品牌",
|
|
2254
|
+
label: "强调色上的文字",
|
|
2255
|
+
type: "color"
|
|
2256
|
+
},
|
|
2257
|
+
{
|
|
2258
|
+
key: "color.statusbar.accent",
|
|
2259
|
+
css: "--otto-status-accent",
|
|
2260
|
+
group: "color",
|
|
2261
|
+
section: "品牌",
|
|
2262
|
+
label: "状态栏工作区块",
|
|
2263
|
+
type: "color"
|
|
2264
|
+
},
|
|
2265
|
+
{
|
|
2266
|
+
key: "color.badge.bg",
|
|
2267
|
+
css: "--otto-badge-bg",
|
|
2268
|
+
group: "color",
|
|
2269
|
+
section: "品牌",
|
|
2270
|
+
label: "徽标底",
|
|
2271
|
+
type: "color"
|
|
2272
|
+
},
|
|
2273
|
+
{
|
|
2274
|
+
key: "color.badge.fg",
|
|
2275
|
+
css: "--otto-badge-fg",
|
|
2276
|
+
group: "color",
|
|
2277
|
+
section: "品牌",
|
|
2278
|
+
label: "徽标字",
|
|
2279
|
+
type: "color"
|
|
2280
|
+
},
|
|
2281
|
+
{
|
|
2282
|
+
key: "color.status.ok",
|
|
2283
|
+
css: "--otto-ok",
|
|
2284
|
+
group: "color",
|
|
2285
|
+
section: "状态",
|
|
2286
|
+
label: "正常 / 成功",
|
|
2287
|
+
type: "color"
|
|
2288
|
+
},
|
|
2289
|
+
{
|
|
2290
|
+
key: "color.status.warn",
|
|
2291
|
+
css: "--otto-warn",
|
|
2292
|
+
group: "color",
|
|
2293
|
+
section: "状态",
|
|
2294
|
+
label: "警告",
|
|
2295
|
+
type: "color"
|
|
2296
|
+
},
|
|
2297
|
+
{
|
|
2298
|
+
key: "color.status.err",
|
|
2299
|
+
css: "--otto-err",
|
|
2300
|
+
group: "color",
|
|
2301
|
+
section: "状态",
|
|
2302
|
+
label: "错误",
|
|
2303
|
+
type: "color"
|
|
2304
|
+
},
|
|
2305
|
+
{
|
|
2306
|
+
key: "color.status.info",
|
|
2307
|
+
css: "--otto-info",
|
|
2308
|
+
group: "color",
|
|
2309
|
+
section: "状态",
|
|
2310
|
+
label: "信息",
|
|
2311
|
+
type: "color"
|
|
2312
|
+
},
|
|
2313
|
+
{
|
|
2314
|
+
key: "color.chart.1",
|
|
2315
|
+
css: "--otto-chart-1",
|
|
2316
|
+
group: "color",
|
|
2317
|
+
section: "图表系列",
|
|
2318
|
+
label: "系列 1",
|
|
2319
|
+
type: "color"
|
|
2320
|
+
},
|
|
2321
|
+
{
|
|
2322
|
+
key: "color.chart.2",
|
|
2323
|
+
css: "--otto-chart-2",
|
|
2324
|
+
group: "color",
|
|
2325
|
+
section: "图表系列",
|
|
2326
|
+
label: "系列 2",
|
|
2327
|
+
type: "color"
|
|
2328
|
+
},
|
|
2329
|
+
{
|
|
2330
|
+
key: "color.chart.3",
|
|
2331
|
+
css: "--otto-chart-3",
|
|
2332
|
+
group: "color",
|
|
2333
|
+
section: "图表系列",
|
|
2334
|
+
label: "系列 3",
|
|
2335
|
+
type: "color"
|
|
2336
|
+
},
|
|
2337
|
+
{
|
|
2338
|
+
key: "color.chart.4",
|
|
2339
|
+
css: "--otto-chart-4",
|
|
2340
|
+
group: "color",
|
|
2341
|
+
section: "图表系列",
|
|
2342
|
+
label: "系列 4",
|
|
2343
|
+
type: "color"
|
|
2344
|
+
},
|
|
2345
|
+
{
|
|
2346
|
+
key: "color.chart.5",
|
|
2347
|
+
css: "--otto-chart-5",
|
|
2348
|
+
group: "color",
|
|
2349
|
+
section: "图表系列",
|
|
2350
|
+
label: "系列 5",
|
|
2351
|
+
type: "color"
|
|
2352
|
+
},
|
|
2353
|
+
{
|
|
2354
|
+
key: "color.chart.6",
|
|
2355
|
+
css: "--otto-chart-6",
|
|
2356
|
+
group: "color",
|
|
2357
|
+
section: "图表系列",
|
|
2358
|
+
label: "系列 6",
|
|
2359
|
+
type: "color"
|
|
2360
|
+
},
|
|
2361
|
+
{
|
|
2362
|
+
key: "color.shadow",
|
|
2363
|
+
css: "--otto-shadow",
|
|
2364
|
+
group: "color",
|
|
2365
|
+
section: "阴影",
|
|
2366
|
+
label: "阴影色(低透明冷调,外层自动混入强调色)",
|
|
2367
|
+
type: "rgba"
|
|
2368
|
+
},
|
|
2369
|
+
{
|
|
2370
|
+
key: "font.family.ui",
|
|
2371
|
+
css: "--otto-font-ui",
|
|
2372
|
+
group: "font",
|
|
2373
|
+
section: "字体族",
|
|
2374
|
+
label: "界面字体",
|
|
2375
|
+
type: "font",
|
|
2376
|
+
options: [
|
|
2377
|
+
["-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"PingFang SC\", system-ui, sans-serif", "系统(SF / Segoe / 苹方)"],
|
|
2378
|
+
["\"Inter\", -apple-system, \"PingFang SC\", system-ui, sans-serif", "Inter"],
|
|
2379
|
+
["\"IBM Plex Sans\", \"PingFang SC\", system-ui, sans-serif", "IBM Plex Sans"],
|
|
2380
|
+
["\"Helvetica Neue\", Arial, \"PingFang SC\", sans-serif", "Helvetica Neue"],
|
|
2381
|
+
["Georgia, \"Songti SC\", serif", "衬线(Georgia / 宋体)"]
|
|
2382
|
+
]
|
|
2383
|
+
},
|
|
2384
|
+
{
|
|
2385
|
+
key: "font.family.mono",
|
|
2386
|
+
css: "--otto-font-mono",
|
|
2387
|
+
group: "font",
|
|
2388
|
+
section: "字体族",
|
|
2389
|
+
label: "等宽字体",
|
|
2390
|
+
type: "font",
|
|
2391
|
+
options: [
|
|
2392
|
+
["\"SF Mono\", ui-monospace, Menlo, \"Cascadia Code\", monospace", "SF Mono"],
|
|
2393
|
+
["\"JetBrains Mono\", ui-monospace, monospace", "JetBrains Mono"],
|
|
2394
|
+
["\"Cascadia Code\", Consolas, monospace", "Cascadia Code"],
|
|
2395
|
+
["\"IBM Plex Mono\", ui-monospace, monospace", "IBM Plex Mono"],
|
|
2396
|
+
["Menlo, Monaco, monospace", "Menlo"]
|
|
2397
|
+
]
|
|
2398
|
+
},
|
|
2399
|
+
{
|
|
2400
|
+
key: "font.size.2xs",
|
|
2401
|
+
css: "--otto-text-2xs",
|
|
2402
|
+
group: "font",
|
|
2403
|
+
section: "字号阶梯",
|
|
2404
|
+
label: "2xs · 图表刻度",
|
|
2405
|
+
type: "size",
|
|
2406
|
+
min: 8,
|
|
2407
|
+
max: 12,
|
|
2408
|
+
step: .5,
|
|
2409
|
+
unit: "px"
|
|
2410
|
+
},
|
|
2411
|
+
{
|
|
2412
|
+
key: "font.size.xs",
|
|
2413
|
+
css: "--otto-text-xs",
|
|
2414
|
+
group: "font",
|
|
2415
|
+
section: "字号阶梯",
|
|
2416
|
+
label: "xs · 徽标 / 说明",
|
|
2417
|
+
type: "size",
|
|
2418
|
+
min: 9,
|
|
2419
|
+
max: 14,
|
|
2420
|
+
step: .5,
|
|
2421
|
+
unit: "px"
|
|
2422
|
+
},
|
|
2423
|
+
{
|
|
2424
|
+
key: "font.size.sm",
|
|
2425
|
+
css: "--otto-text-sm",
|
|
2426
|
+
group: "font",
|
|
2427
|
+
section: "字号阶梯",
|
|
2428
|
+
label: "sm · 表格 / 列表",
|
|
2429
|
+
type: "size",
|
|
2430
|
+
min: 10,
|
|
2431
|
+
max: 15,
|
|
2432
|
+
step: .5,
|
|
2433
|
+
unit: "px"
|
|
2434
|
+
},
|
|
2435
|
+
{
|
|
2436
|
+
key: "font.size.md",
|
|
2437
|
+
css: "--otto-text-md",
|
|
2438
|
+
group: "font",
|
|
2439
|
+
section: "字号阶梯",
|
|
2440
|
+
label: "md · 正文",
|
|
2441
|
+
type: "size",
|
|
2442
|
+
min: 11,
|
|
2443
|
+
max: 17,
|
|
2444
|
+
step: .5,
|
|
2445
|
+
unit: "px"
|
|
2446
|
+
},
|
|
2447
|
+
{
|
|
2448
|
+
key: "font.size.lg",
|
|
2449
|
+
css: "--otto-text-lg",
|
|
2450
|
+
group: "font",
|
|
2451
|
+
section: "字号阶梯",
|
|
2452
|
+
label: "lg · 次级数值",
|
|
2453
|
+
type: "size",
|
|
2454
|
+
min: 14,
|
|
2455
|
+
max: 26,
|
|
2456
|
+
step: 1,
|
|
2457
|
+
unit: "px"
|
|
2458
|
+
},
|
|
2459
|
+
{
|
|
2460
|
+
key: "font.size.kpi",
|
|
2461
|
+
css: "--otto-text-kpi",
|
|
2462
|
+
group: "font",
|
|
2463
|
+
section: "字号阶梯",
|
|
2464
|
+
label: "kpi · 大数字",
|
|
2465
|
+
type: "size",
|
|
2466
|
+
min: 18,
|
|
2467
|
+
max: 44,
|
|
2468
|
+
step: 1,
|
|
2469
|
+
unit: "px"
|
|
2470
|
+
},
|
|
2471
|
+
{
|
|
2472
|
+
key: "font.lineHeight",
|
|
2473
|
+
css: "--otto-line-height",
|
|
2474
|
+
group: "font",
|
|
2475
|
+
section: "排版",
|
|
2476
|
+
label: "行高",
|
|
2477
|
+
type: "number",
|
|
2478
|
+
min: 1.2,
|
|
2479
|
+
max: 1.8,
|
|
2480
|
+
step: .05,
|
|
2481
|
+
unit: ""
|
|
2482
|
+
},
|
|
2483
|
+
{
|
|
2484
|
+
key: "font.weight.regular",
|
|
2485
|
+
css: "--otto-weight-regular",
|
|
2486
|
+
group: "font",
|
|
2487
|
+
section: "排版",
|
|
2488
|
+
label: "字重 · 常规",
|
|
2489
|
+
type: "number",
|
|
2490
|
+
min: 300,
|
|
2491
|
+
max: 500,
|
|
2492
|
+
step: 50,
|
|
2493
|
+
unit: ""
|
|
2494
|
+
},
|
|
2495
|
+
{
|
|
2496
|
+
key: "font.weight.medium",
|
|
2497
|
+
css: "--otto-weight-medium",
|
|
2498
|
+
group: "font",
|
|
2499
|
+
section: "排版",
|
|
2500
|
+
label: "字重 · 中",
|
|
2501
|
+
type: "number",
|
|
2502
|
+
min: 400,
|
|
2503
|
+
max: 600,
|
|
2504
|
+
step: 50,
|
|
2505
|
+
unit: ""
|
|
2506
|
+
},
|
|
2507
|
+
{
|
|
2508
|
+
key: "font.weight.strong",
|
|
2509
|
+
css: "--otto-weight-strong",
|
|
2510
|
+
group: "font",
|
|
2511
|
+
section: "排版",
|
|
2512
|
+
label: "字重 · 强",
|
|
2513
|
+
type: "number",
|
|
2514
|
+
min: 500,
|
|
2515
|
+
max: 800,
|
|
2516
|
+
step: 50,
|
|
2517
|
+
unit: ""
|
|
2518
|
+
},
|
|
2519
|
+
{
|
|
2520
|
+
key: "font.weight.display",
|
|
2521
|
+
css: "--otto-weight-display",
|
|
2522
|
+
group: "font",
|
|
2523
|
+
section: "排版",
|
|
2524
|
+
label: "字重 · 展示",
|
|
2525
|
+
type: "number",
|
|
2526
|
+
min: 400,
|
|
2527
|
+
max: 800,
|
|
2528
|
+
step: 50,
|
|
2529
|
+
unit: ""
|
|
2530
|
+
},
|
|
2531
|
+
{
|
|
2532
|
+
key: "radius.xs",
|
|
2533
|
+
css: "--otto-radius-xs",
|
|
2534
|
+
group: "shape",
|
|
2535
|
+
section: "圆角",
|
|
2536
|
+
label: "xs · 代码 / 小标签",
|
|
2537
|
+
type: "size",
|
|
2538
|
+
min: 0,
|
|
2539
|
+
max: 8,
|
|
2540
|
+
step: 1,
|
|
2541
|
+
unit: "px"
|
|
2542
|
+
},
|
|
2543
|
+
{
|
|
2544
|
+
key: "radius.control",
|
|
2545
|
+
css: "--otto-radius-control",
|
|
2546
|
+
group: "shape",
|
|
2547
|
+
section: "圆角",
|
|
2548
|
+
label: "control · 按钮 / 列表行",
|
|
2549
|
+
type: "size",
|
|
2550
|
+
min: 0,
|
|
2551
|
+
max: 12,
|
|
2552
|
+
step: 1,
|
|
2553
|
+
unit: "px"
|
|
2554
|
+
},
|
|
2555
|
+
{
|
|
2556
|
+
key: "radius.field",
|
|
2557
|
+
css: "--otto-radius-field",
|
|
2558
|
+
group: "shape",
|
|
2559
|
+
section: "圆角",
|
|
2560
|
+
label: "field · 输入 / 代码块",
|
|
2561
|
+
type: "size",
|
|
2562
|
+
min: 0,
|
|
2563
|
+
max: 14,
|
|
2564
|
+
step: 1,
|
|
2565
|
+
unit: "px"
|
|
2566
|
+
},
|
|
2567
|
+
{
|
|
2568
|
+
key: "radius.panel",
|
|
2569
|
+
css: "--otto-radius-panel",
|
|
2570
|
+
group: "shape",
|
|
2571
|
+
section: "圆角",
|
|
2572
|
+
label: "panel · 工作台面板",
|
|
2573
|
+
type: "size",
|
|
2574
|
+
min: 0,
|
|
2575
|
+
max: 16,
|
|
2576
|
+
step: 1,
|
|
2577
|
+
unit: "px"
|
|
2578
|
+
},
|
|
2579
|
+
{
|
|
2580
|
+
key: "radius.card",
|
|
2581
|
+
css: "--otto-radius-card",
|
|
2582
|
+
group: "shape",
|
|
2583
|
+
section: "圆角",
|
|
2584
|
+
label: "card · 看板卡片",
|
|
2585
|
+
type: "size",
|
|
2586
|
+
min: 0,
|
|
2587
|
+
max: 20,
|
|
2588
|
+
step: 1,
|
|
2589
|
+
unit: "px"
|
|
2590
|
+
},
|
|
2591
|
+
{
|
|
2592
|
+
key: "radius.overlay",
|
|
2593
|
+
css: "--otto-radius-overlay",
|
|
2594
|
+
group: "shape",
|
|
2595
|
+
section: "圆角",
|
|
2596
|
+
label: "overlay · 命令面板 / 通知",
|
|
2597
|
+
type: "size",
|
|
2598
|
+
min: 0,
|
|
2599
|
+
max: 24,
|
|
2600
|
+
step: 1,
|
|
2601
|
+
unit: "px"
|
|
2602
|
+
},
|
|
2603
|
+
{
|
|
2604
|
+
key: "radius.pill",
|
|
2605
|
+
css: "--otto-radius-pill",
|
|
2606
|
+
group: "shape",
|
|
2607
|
+
section: "圆角",
|
|
2608
|
+
label: "pill · 胶囊(0 = 方角)",
|
|
2609
|
+
type: "size",
|
|
2610
|
+
min: 0,
|
|
2611
|
+
max: 999,
|
|
2612
|
+
step: 1,
|
|
2613
|
+
unit: "px"
|
|
2614
|
+
},
|
|
2615
|
+
{
|
|
2616
|
+
key: "border.width",
|
|
2617
|
+
css: "--otto-border-width",
|
|
2618
|
+
group: "shape",
|
|
2619
|
+
section: "边框",
|
|
2620
|
+
label: "边框宽度",
|
|
2621
|
+
type: "size",
|
|
2622
|
+
min: 0,
|
|
2623
|
+
max: 3,
|
|
2624
|
+
step: .25,
|
|
2625
|
+
unit: "px"
|
|
2626
|
+
},
|
|
2627
|
+
{
|
|
2628
|
+
key: "border.focusWidth",
|
|
2629
|
+
css: "--otto-focus-width",
|
|
2630
|
+
group: "shape",
|
|
2631
|
+
section: "边框",
|
|
2632
|
+
label: "焦点环宽度",
|
|
2633
|
+
type: "size",
|
|
2634
|
+
min: 1,
|
|
2635
|
+
max: 4,
|
|
2636
|
+
step: .5,
|
|
2637
|
+
unit: "px"
|
|
2638
|
+
},
|
|
2639
|
+
{
|
|
2640
|
+
key: "space.panelGap",
|
|
2641
|
+
css: "--otto-gap",
|
|
2642
|
+
group: "shape",
|
|
2643
|
+
section: "间距与尺寸",
|
|
2644
|
+
label: "面板间距",
|
|
2645
|
+
type: "size",
|
|
2646
|
+
min: 0,
|
|
2647
|
+
max: 16,
|
|
2648
|
+
step: 1,
|
|
2649
|
+
unit: "px"
|
|
2650
|
+
},
|
|
2651
|
+
{
|
|
2652
|
+
key: "size.titleBar",
|
|
2653
|
+
css: "--otto-titlebar-h",
|
|
2654
|
+
group: "shape",
|
|
2655
|
+
section: "间距与尺寸",
|
|
2656
|
+
label: "标题栏高度",
|
|
2657
|
+
type: "size",
|
|
2658
|
+
min: 28,
|
|
2659
|
+
max: 48,
|
|
2660
|
+
step: 1,
|
|
2661
|
+
unit: "px"
|
|
2662
|
+
},
|
|
2663
|
+
{
|
|
2664
|
+
key: "size.statusBar",
|
|
2665
|
+
css: "--otto-statusbar-h",
|
|
2666
|
+
group: "shape",
|
|
2667
|
+
section: "间距与尺寸",
|
|
2668
|
+
label: "状态栏高度",
|
|
2669
|
+
type: "size",
|
|
2670
|
+
min: 18,
|
|
2671
|
+
max: 32,
|
|
2672
|
+
step: 1,
|
|
2673
|
+
unit: "px"
|
|
2674
|
+
},
|
|
2675
|
+
{
|
|
2676
|
+
key: "space.cardGap",
|
|
2677
|
+
css: "--otto-card-gap",
|
|
2678
|
+
group: "shape",
|
|
2679
|
+
section: "间距与尺寸",
|
|
2680
|
+
label: "卡片间距",
|
|
2681
|
+
type: "size",
|
|
2682
|
+
min: 4,
|
|
2683
|
+
max: 24,
|
|
2684
|
+
step: 1,
|
|
2685
|
+
unit: "px"
|
|
2686
|
+
},
|
|
2687
|
+
{
|
|
2688
|
+
key: "size.row",
|
|
2689
|
+
css: "--otto-row",
|
|
2690
|
+
group: "shape",
|
|
2691
|
+
section: "间距与尺寸",
|
|
2692
|
+
label: "列表行高",
|
|
2693
|
+
type: "size",
|
|
2694
|
+
min: 20,
|
|
2695
|
+
max: 34,
|
|
2696
|
+
step: 1,
|
|
2697
|
+
unit: "px"
|
|
2698
|
+
},
|
|
2699
|
+
{
|
|
2700
|
+
key: "size.gridRow",
|
|
2701
|
+
css: "--otto-grid-row",
|
|
2702
|
+
group: "shape",
|
|
2703
|
+
section: "间距与尺寸",
|
|
2704
|
+
label: "看板栅格行高",
|
|
2705
|
+
type: "size",
|
|
2706
|
+
min: 64,
|
|
2707
|
+
max: 120,
|
|
2708
|
+
step: 2,
|
|
2709
|
+
unit: "px"
|
|
2710
|
+
},
|
|
2711
|
+
{
|
|
2712
|
+
key: "elevation.level",
|
|
2713
|
+
css: null,
|
|
2714
|
+
group: "effect",
|
|
2715
|
+
section: "阴影层级",
|
|
2716
|
+
label: "阴影强度",
|
|
2717
|
+
type: "select",
|
|
2718
|
+
options: [
|
|
2719
|
+
["flat", "扁平(无阴影)"],
|
|
2720
|
+
["soft", "柔和"],
|
|
2721
|
+
["standard", "标准"],
|
|
2722
|
+
["strong", "强"]
|
|
2723
|
+
]
|
|
2724
|
+
},
|
|
2725
|
+
{
|
|
2726
|
+
key: "effect.glow",
|
|
2727
|
+
css: null,
|
|
2728
|
+
group: "effect",
|
|
2729
|
+
section: "阴影层级",
|
|
2730
|
+
label: "霓虹辉光(选中 / 强调 / 焦点)",
|
|
2731
|
+
type: "select",
|
|
2732
|
+
options: [
|
|
2733
|
+
["off", "关闭"],
|
|
2734
|
+
["soft", "柔和"],
|
|
2735
|
+
["neon", "霓虹"]
|
|
2736
|
+
]
|
|
2737
|
+
},
|
|
2738
|
+
{
|
|
2739
|
+
key: "icon.weight",
|
|
2740
|
+
css: null,
|
|
2741
|
+
group: "effect",
|
|
2742
|
+
section: "图标",
|
|
2743
|
+
label: "图标粗细",
|
|
2744
|
+
type: "select",
|
|
2745
|
+
options: [
|
|
2746
|
+
["regular", "常规(codicon 原始)"],
|
|
2747
|
+
["light", "纤细(默认)"],
|
|
2748
|
+
["thin", "更细"]
|
|
2749
|
+
]
|
|
2750
|
+
},
|
|
2751
|
+
{
|
|
2752
|
+
key: "effect.grid",
|
|
2753
|
+
css: null,
|
|
2754
|
+
group: "effect",
|
|
2755
|
+
section: "阴影层级",
|
|
2756
|
+
label: "背景网格",
|
|
2757
|
+
type: "select",
|
|
2758
|
+
options: [["off", "关闭"], ["on", "开启"]]
|
|
2759
|
+
},
|
|
2760
|
+
{
|
|
2761
|
+
key: "motion.fast",
|
|
2762
|
+
css: "--otto-motion-fast",
|
|
2763
|
+
group: "effect",
|
|
2764
|
+
section: "动效",
|
|
2765
|
+
label: "快速过渡",
|
|
2766
|
+
type: "size",
|
|
2767
|
+
min: 0,
|
|
2768
|
+
max: 400,
|
|
2769
|
+
step: 10,
|
|
2770
|
+
unit: "ms"
|
|
2771
|
+
},
|
|
2772
|
+
{
|
|
2773
|
+
key: "motion.normal",
|
|
2774
|
+
css: "--otto-motion-normal",
|
|
2775
|
+
group: "effect",
|
|
2776
|
+
section: "动效",
|
|
2777
|
+
label: "标准过渡",
|
|
2778
|
+
type: "size",
|
|
2779
|
+
min: 0,
|
|
2780
|
+
max: 600,
|
|
2781
|
+
step: 10,
|
|
2782
|
+
unit: "ms"
|
|
2783
|
+
},
|
|
2784
|
+
{
|
|
2785
|
+
key: "motion.easing",
|
|
2786
|
+
css: "--otto-motion-easing",
|
|
2787
|
+
group: "effect",
|
|
2788
|
+
section: "动效",
|
|
2789
|
+
label: "缓动曲线",
|
|
2790
|
+
type: "select",
|
|
2791
|
+
options: [
|
|
2792
|
+
["cubic-bezier(.2,.8,.2,1)", "标准(出)"],
|
|
2793
|
+
["ease-out", "ease-out"],
|
|
2794
|
+
["linear", "线性"],
|
|
2795
|
+
["cubic-bezier(.34,1.56,.64,1)", "回弹"]
|
|
2796
|
+
]
|
|
2797
|
+
}
|
|
2798
|
+
];
|
|
2799
|
+
|
|
2800
|
+
//#endregion
|
|
2801
|
+
//#region src/themes/resolve.ts
|
|
2802
|
+
const DEFAULT_THEME_ID = "otto-dark";
|
|
2803
|
+
const DEFAULT_DENSITY = "comfortable";
|
|
2804
|
+
const DEFAULT_ELEVATION = "standard";
|
|
2805
|
+
function builtinThemeLookup(id) {
|
|
2806
|
+
return BUILTIN_THEMES.find((theme) => theme.id === id);
|
|
2807
|
+
}
|
|
2808
|
+
function resolveTheme(theme, lookup = builtinThemeLookup, visited = /* @__PURE__ */ new Set()) {
|
|
2809
|
+
if (theme.extends === void 0 || visited.has(theme.id)) return { ...theme.tokens };
|
|
2810
|
+
const parent = lookup(theme.extends) ?? BUILTIN_THEMES[0];
|
|
2811
|
+
if (parent === void 0) return { ...theme.tokens };
|
|
2812
|
+
return {
|
|
2813
|
+
...resolveTheme(parent, lookup, new Set(visited).add(theme.id)),
|
|
2814
|
+
...theme.tokens
|
|
2815
|
+
};
|
|
2816
|
+
}
|
|
2817
|
+
function themeValueText(token, value) {
|
|
2818
|
+
if (token.type === "size") return `${value}${token.unit ?? ""}`;
|
|
2819
|
+
return String(value);
|
|
2820
|
+
}
|
|
2821
|
+
function selectedOf(table, key, fallback) {
|
|
2822
|
+
return table[key] ?? table[fallback] ?? "";
|
|
2823
|
+
}
|
|
2824
|
+
function themeDeclarations(theme, values) {
|
|
2825
|
+
const declarations = {};
|
|
2826
|
+
for (const token of THEME_TOKENS) {
|
|
2827
|
+
const value = values[token.key];
|
|
2828
|
+
if (token.css === null || value === void 0) continue;
|
|
2829
|
+
declarations[token.css] = themeValueText(token, value);
|
|
2830
|
+
}
|
|
2831
|
+
(ELEVATION[String(values["elevation.level"] ?? DEFAULT_ELEVATION)] ?? ELEVATION[DEFAULT_ELEVATION] ?? []).forEach((shadow, index) => {
|
|
2832
|
+
declarations[`--otto-elevation-${index + 1}`] = shadow;
|
|
2833
|
+
});
|
|
2834
|
+
const isLight = theme.base === "light";
|
|
2835
|
+
const tintPercent = isLight ? 7 : 5;
|
|
2836
|
+
const accent = String(values["color.accent"]);
|
|
2837
|
+
const glowLevel = String(values["effect.glow"] ?? "off");
|
|
2838
|
+
declarations["--otto-shadow-tint"] = `color-mix(in srgb, ${accent} ${tintPercent}%, var(--otto-shadow))`;
|
|
2839
|
+
declarations["--otto-shadow-edge"] = isLight ? "rgba(20, 40, 60, 0.05)" : "rgba(255, 255, 255, 0.04)";
|
|
2840
|
+
declarations["--otto-icon-stroke"] = selectedOf(ICON_WEIGHT, String(values["icon.weight"] ?? "regular"), "regular");
|
|
2841
|
+
declarations["--otto-glow"] = selectedOf(GLOW, glowLevel, "off");
|
|
2842
|
+
declarations["--otto-glow-text"] = selectedOf(GLOW_TEXT, glowLevel, "off");
|
|
2843
|
+
declarations["--otto-grid-pattern"] = values["effect.grid"] === "on" ? GRID_PATTERN : "none";
|
|
2844
|
+
declarations["--otto-color-scheme"] = theme.base;
|
|
2845
|
+
return declarations;
|
|
2846
|
+
}
|
|
2847
|
+
function resolveThemeDeclarations(theme, density = DEFAULT_DENSITY, lookup = builtinThemeLookup) {
|
|
2848
|
+
return themeDeclarations(theme, {
|
|
2849
|
+
...resolveTheme(theme, lookup),
|
|
2850
|
+
...DENSITY[density]
|
|
2851
|
+
});
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
//#endregion
|
|
2855
|
+
//#region src/themes/workbench-css.ts
|
|
2856
|
+
function block(selector, declarations) {
|
|
2857
|
+
return `${selector} {\n${Object.entries(declarations).map(([name, value]) => ` ${name}: ${value};`).join("\n")}\n}`;
|
|
2858
|
+
}
|
|
2859
|
+
function densityDeclarations(density) {
|
|
2860
|
+
const declarations = {};
|
|
2861
|
+
for (const [key, value] of Object.entries(DENSITY[density] ?? {})) {
|
|
2862
|
+
const token = THEME_TOKENS.find((candidate) => candidate.key === key);
|
|
2863
|
+
if (token === void 0 || token.css === null) continue;
|
|
2864
|
+
declarations[token.css] = themeValueText(token, value);
|
|
2865
|
+
}
|
|
2866
|
+
return declarations;
|
|
2867
|
+
}
|
|
2868
|
+
function workbenchTokensCss(themes = BUILTIN_THEMES) {
|
|
2869
|
+
const defaultTheme = themes.find((theme) => theme.id === "otto-dark") ?? themes[0];
|
|
2870
|
+
const blocks = [];
|
|
2871
|
+
blocks.push(block(":root, [data-theme]", {
|
|
2872
|
+
...BASE_TOKENS,
|
|
2873
|
+
...DERIVED_TOKENS
|
|
2874
|
+
}));
|
|
2875
|
+
if (defaultTheme !== void 0) blocks.push(block(":root", resolveThemeDeclarations(defaultTheme)));
|
|
2876
|
+
for (const theme of themes) blocks.push(block(`[data-theme="${theme.id}"]`, resolveThemeDeclarations(theme)));
|
|
2877
|
+
for (const density of Object.keys(DENSITY)) {
|
|
2878
|
+
const declarations = densityDeclarations(density);
|
|
2879
|
+
if (Object.keys(declarations).length === 0) continue;
|
|
2880
|
+
blocks.push(block(`[data-density="${density}"]`, declarations));
|
|
2881
|
+
}
|
|
2882
|
+
return `${blocks.join("\n\n")}\n`;
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
//#endregion
|
|
2886
|
+
export { BASE_THEME_VALUES, BASE_TOKENS, BUILTIN_THEMES, CONTRAST_THRESHOLDS, DEFAULT_DENSITY, DEFAULT_THEME_ID, DENSITY, DERIVED_TOKENS, ELEVATION, GLOW, GLOW_TEXT, GRID_PATTERN, ICON_WEIGHT, LEGACY_ALIASES, LEGACY_RAMP_PREFIXES, RAMPS, RAMP_NAMES, ROLE_CONTRAST, ROLE_NAMES, ROLE_TABLE, SCALAR_TOKENS, SEMANTIC_SURFACES, SPECTRUM, THEME_CONTRAST_PAIRS, THEME_TOKENS, TOOL_ROLE_NAMES, TOOL_ROLE_TABLE, TUI_COLOR_BINDINGS, TUI_COLOR_KEYS, TUI_DARK_OVERRIDES, WEB_LITERALS, builtinThemeLookup, contrastRatio, inlineDeclarations, inlinePalette, isToolRole, parseHexColor, rampStepColor, rampStepsOf, rampVariableName, relativeLuminance, resolveRole, resolveTheme, resolveThemeDeclarations, roleVariableName, scalarDeclarations, scalarValue, themeDeclarations, themeNamesOf, themeValueText, toolRoleOf, tuiColorValue, tuiThemeColors, webTokenDeclarations, webTokensCss, workbenchTokensCss };
|