@fish-under-sea/magpie-dragonapi 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/index.mjs +10 -2
- package/lib/service.mjs +39 -10
- package/package.json +1 -1
- package/page/boot.js +5 -1
- package/ui/app.js +193 -75
- package/ui/index.html +257 -259
- package/ui/style.css +311 -5
package/ui/style.css
CHANGED
|
@@ -47,6 +47,11 @@ html[data-theme="light"] {
|
|
|
47
47
|
--bad: #b22f2c;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/* 按钮与可点击卡片统一去掉移动端 300ms 点击延迟 */
|
|
51
|
+
button,
|
|
52
|
+
.mc,
|
|
53
|
+
.market-chip { touch-action: manipulation; }
|
|
54
|
+
|
|
50
55
|
* { box-sizing: border-box; }
|
|
51
56
|
|
|
52
57
|
html, body {
|
|
@@ -62,6 +67,10 @@ html, body {
|
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
body { min-height: 100vh; }
|
|
70
|
+
/* dvh 让移动端地址栏收起时不跳;不认 dvh 的浏览器保留上面那行 100vh */
|
|
71
|
+
@supports (min-height: 100dvh) {
|
|
72
|
+
body { min-height: 100dvh; }
|
|
73
|
+
}
|
|
65
74
|
|
|
66
75
|
/* 焦点必须始终可见:键盘用户全靠它定位 */
|
|
67
76
|
:focus-visible {
|
|
@@ -253,15 +262,19 @@ input[type="search"],
|
|
|
253
262
|
input[type="password"],
|
|
254
263
|
input[type="number"],
|
|
255
264
|
select {
|
|
256
|
-
|
|
265
|
+
/* 用 padding 撑高度而不是写死高度:字号或字体变了也能撑住,
|
|
266
|
+
34px 在桌面上点得准、读得清(触屏 44px 的基准见窄屏媒体查询)。 */
|
|
267
|
+
min-height: 34px;
|
|
257
268
|
width: 100%;
|
|
258
|
-
padding:
|
|
269
|
+
padding: 6px 10px;
|
|
259
270
|
border: 1px solid var(--line-strong);
|
|
260
271
|
border-radius: var(--radius-sm);
|
|
261
272
|
background: var(--sunken);
|
|
262
273
|
color: var(--fg);
|
|
263
274
|
font: inherit;
|
|
264
275
|
font-size: 12.5px;
|
|
276
|
+
/* 去掉移动端点击的 300ms 延迟 */
|
|
277
|
+
touch-action: manipulation;
|
|
265
278
|
}
|
|
266
279
|
input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
|
|
267
280
|
input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
|
|
@@ -419,9 +432,13 @@ input[type="search"] { -webkit-appearance: none; appearance: none; }
|
|
|
419
432
|
display: grid;
|
|
420
433
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
421
434
|
gap: var(--gap);
|
|
422
|
-
align-items: start
|
|
435
|
+
/* 不要写 align-items: start —— 那会让同一行的两张卡各自按内容高度撑开,
|
|
436
|
+
看上去参差不齐。默认的 stretch 才是并排卡片该有的样子;卡内用 flex
|
|
437
|
+
纵向布局把次要内容推到底。 */
|
|
438
|
+
align-items: stretch;
|
|
423
439
|
}
|
|
424
|
-
.grid-2 > .card { margin: 0; }
|
|
440
|
+
.grid-2 > .card { margin: 0; display: flex; flex-direction: column; }
|
|
441
|
+
.grid-2 > .card > :last-child { margin-bottom: 0; }
|
|
425
442
|
|
|
426
443
|
.toolbar-card { display: flex; flex-direction: column; gap: 11px; }
|
|
427
444
|
|
|
@@ -722,6 +739,19 @@ input[type="search"] { -webkit-appearance: none; appearance: none; }
|
|
|
722
739
|
color: var(--muted);
|
|
723
740
|
font-size: 12.5px;
|
|
724
741
|
}
|
|
742
|
+
/* 引导式空态:不是「没数据」,而是「下一步做什么」,所以左对齐并给按钮留位 */
|
|
743
|
+
.empty.guide {
|
|
744
|
+
padding: 20px 18px;
|
|
745
|
+
text-align: left;
|
|
746
|
+
display: flex;
|
|
747
|
+
flex-direction: column;
|
|
748
|
+
align-items: flex-start;
|
|
749
|
+
gap: 8px;
|
|
750
|
+
border: 1px dashed var(--line-strong);
|
|
751
|
+
border-radius: var(--radius);
|
|
752
|
+
}
|
|
753
|
+
.empty.guide p { margin: 0; max-width: 62ch; line-height: 1.6; }
|
|
754
|
+
.empty.guide .btn { margin-top: 2px; }
|
|
725
755
|
.loading {
|
|
726
756
|
margin: 0;
|
|
727
757
|
padding: 22px 14px;
|
|
@@ -855,7 +885,9 @@ input[type="search"] { -webkit-appearance: none; appearance: none; }
|
|
|
855
885
|
}
|
|
856
886
|
.bind-steps li::marker { color: var(--accent); font-family: var(--code); }
|
|
857
887
|
|
|
858
|
-
|
|
888
|
+
/* 密钥页同样是两张并排卡:stretch 让它们等高,卡内 flex 把按钮按到底。 */
|
|
889
|
+
.keys-grid > .card { display: flex; flex-direction: column; }
|
|
890
|
+
.keys-grid > .card > :last-child { margin-bottom: 0; }
|
|
859
891
|
|
|
860
892
|
.row-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
|
|
861
893
|
|
|
@@ -868,6 +900,9 @@ input[type="search"] { -webkit-appearance: none; appearance: none; }
|
|
|
868
900
|
position: absolute;
|
|
869
901
|
inset: 0;
|
|
870
902
|
background: rgba(0, 0, 0, .5);
|
|
903
|
+
/* 这里的模糊是有理由的:抽屉压在列表之上,模糊把背后的内容明确推远,
|
|
904
|
+
让人一眼看出「现在在另一层」。不是给卡片糊一层装饰。
|
|
905
|
+
只有 2px,够分辨层级但不会让底下的文字变成光斑。 */
|
|
871
906
|
backdrop-filter: blur(2px);
|
|
872
907
|
}
|
|
873
908
|
|
|
@@ -875,6 +910,8 @@ input[type="search"] { -webkit-appearance: none; appearance: none; }
|
|
|
875
910
|
position: relative;
|
|
876
911
|
width: min(760px, calc(100vw - 32px));
|
|
877
912
|
max-height: calc(100vh - 64px);
|
|
913
|
+
/* 抽屉内部滚到底不应把滚动传给背后的页面 */
|
|
914
|
+
overscroll-behavior: contain;
|
|
878
915
|
display: flex;
|
|
879
916
|
flex-direction: column;
|
|
880
917
|
border: 1px solid var(--line-strong);
|
|
@@ -945,6 +982,15 @@ input[type="search"] { -webkit-appearance: none; appearance: none; }
|
|
|
945
982
|
|
|
946
983
|
@media (max-width: 720px) {
|
|
947
984
|
.app { padding: 14px 12px 32px; }
|
|
985
|
+
/* iOS 在输入框字号 < 16px 时会自动放大整页,焦点一落就跳。窄屏统一放大到 16px。 */
|
|
986
|
+
input[type="text"],
|
|
987
|
+
input[type="search"],
|
|
988
|
+
input[type="password"],
|
|
989
|
+
input[type="number"],
|
|
990
|
+
select { font-size: 16px; }
|
|
991
|
+
/* 触屏命中区:24px 是 Web 底线,44px 是手指舒服的尺寸 */
|
|
992
|
+
.link,
|
|
993
|
+
.banner-close { min-height: 32px; min-width: 32px; }
|
|
948
994
|
.topbar { gap: 10px; }
|
|
949
995
|
.topbar-meta { margin-left: 0; width: 100%; }
|
|
950
996
|
.summary-row { grid-template-columns: 1fr; }
|
|
@@ -966,3 +1012,263 @@ input[type="search"] { -webkit-appearance: none; appearance: none; }
|
|
|
966
1012
|
/* 动效关掉后状态点必须仍然可见 */
|
|
967
1013
|
.dot[data-state="busy"] { opacity: 1; }
|
|
968
1014
|
}
|
|
1015
|
+
|
|
1016
|
+
/* ── 模型广场:筛选栏 + 卡片网格 ────────────────────────────
|
|
1017
|
+
*
|
|
1018
|
+
* 结构参照 NearToken 的模型广场(左侧筛选、右侧双列卡片),因为它服务的
|
|
1019
|
+
* 是同一件事:在一两百个模型里比价格。等高靠三处配合,缺一不可:
|
|
1020
|
+
* .model-grid 的 align-items: stretch
|
|
1021
|
+
* .mc 的 display:flex; flex-direction:column
|
|
1022
|
+
* .mc-foot 的 margin-top:auto
|
|
1023
|
+
*/
|
|
1024
|
+
|
|
1025
|
+
.market-body {
|
|
1026
|
+
display: grid;
|
|
1027
|
+
grid-template-columns: 208px minmax(0, 1fr);
|
|
1028
|
+
gap: var(--gap);
|
|
1029
|
+
/* 这一层可以 start:侧栏本来就该比主区短,不该被拉到与列表等高 */
|
|
1030
|
+
align-items: start;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
.market-aside {
|
|
1034
|
+
position: sticky;
|
|
1035
|
+
top: 12px;
|
|
1036
|
+
max-height: calc(100vh - 24px);
|
|
1037
|
+
overflow: auto;
|
|
1038
|
+
padding: 12px;
|
|
1039
|
+
border: 1px solid var(--line);
|
|
1040
|
+
border-radius: var(--radius);
|
|
1041
|
+
background: var(--sunken);
|
|
1042
|
+
}
|
|
1043
|
+
.ma-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
|
|
1044
|
+
.ma-head h2 { margin: 0; font-size: 13px; }
|
|
1045
|
+
.ma-note { margin: 4px 0 10px; font-size: 11px; line-height: 1.5; color: var(--muted); }
|
|
1046
|
+
.market-aside h3 {
|
|
1047
|
+
margin: 12px 0 7px;
|
|
1048
|
+
font-size: 11px;
|
|
1049
|
+
font-weight: 600;
|
|
1050
|
+
color: var(--muted);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
.market-chips { display: flex; flex-direction: column; gap: 5px; }
|
|
1054
|
+
.market-chips.chips-row { flex-direction: row; flex-wrap: wrap; }
|
|
1055
|
+
|
|
1056
|
+
.market-chip {
|
|
1057
|
+
display: flex;
|
|
1058
|
+
align-items: center;
|
|
1059
|
+
gap: 6px;
|
|
1060
|
+
min-width: 0;
|
|
1061
|
+
padding: 4px 8px;
|
|
1062
|
+
font: inherit;
|
|
1063
|
+
font-size: 11.5px;
|
|
1064
|
+
color: var(--muted);
|
|
1065
|
+
background: transparent;
|
|
1066
|
+
border: 1px solid var(--line);
|
|
1067
|
+
border-radius: var(--radius-sm);
|
|
1068
|
+
cursor: pointer;
|
|
1069
|
+
text-align: left;
|
|
1070
|
+
transition: color .12s ease, border-color .12s ease, background .12s ease;
|
|
1071
|
+
}
|
|
1072
|
+
.market-chip:hover { color: var(--fg); border-color: var(--line-strong); }
|
|
1073
|
+
.market-chip[aria-pressed="true"] {
|
|
1074
|
+
color: var(--fg);
|
|
1075
|
+
border-color: var(--accent-line);
|
|
1076
|
+
background: var(--accent-soft);
|
|
1077
|
+
}
|
|
1078
|
+
.market-chip .chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1079
|
+
.market-chip .ratio { font-family: var(--code); font-size: 10px; color: var(--muted); }
|
|
1080
|
+
.market-chip .chip-count { margin-left: auto; font-family: var(--code); font-size: 10px; color: var(--muted); }
|
|
1081
|
+
.market-chips.chips-row .market-chip .chip-count { margin-left: 2px; }
|
|
1082
|
+
|
|
1083
|
+
.market-main { min-width: 0; }
|
|
1084
|
+
.market-top {
|
|
1085
|
+
display: flex;
|
|
1086
|
+
align-items: center;
|
|
1087
|
+
gap: 10px;
|
|
1088
|
+
flex-wrap: wrap;
|
|
1089
|
+
margin-bottom: 10px;
|
|
1090
|
+
}
|
|
1091
|
+
.market-top .field { margin: 0; }
|
|
1092
|
+
.market-top .field.grow { flex: 1 1 240px; min-width: 0; }
|
|
1093
|
+
.market-top .market-chips { flex: none; }
|
|
1094
|
+
|
|
1095
|
+
.market-count {
|
|
1096
|
+
display: flex;
|
|
1097
|
+
align-items: baseline;
|
|
1098
|
+
flex-wrap: wrap;
|
|
1099
|
+
gap: 4px;
|
|
1100
|
+
margin: 0 0 10px;
|
|
1101
|
+
font-size: 12px;
|
|
1102
|
+
color: var(--muted);
|
|
1103
|
+
}
|
|
1104
|
+
.market-count b { font-size: 15px; color: var(--fg); font-variant-numeric: tabular-nums; }
|
|
1105
|
+
.market-count .spacer { flex: 1 1 12px; }
|
|
1106
|
+
|
|
1107
|
+
.model-grid {
|
|
1108
|
+
display: grid;
|
|
1109
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1110
|
+
gap: 10px;
|
|
1111
|
+
align-items: stretch;
|
|
1112
|
+
}
|
|
1113
|
+
/* 空态与加载态要占满整行,否则会缩成半宽的一格 */
|
|
1114
|
+
.model-grid > .empty,
|
|
1115
|
+
.model-grid > .loading { grid-column: 1 / -1; margin: 0; }
|
|
1116
|
+
|
|
1117
|
+
.mc {
|
|
1118
|
+
display: flex;
|
|
1119
|
+
flex-direction: column;
|
|
1120
|
+
min-width: 0;
|
|
1121
|
+
padding: 12px;
|
|
1122
|
+
background: var(--card);
|
|
1123
|
+
border: 1px solid var(--line);
|
|
1124
|
+
border-radius: var(--radius);
|
|
1125
|
+
transition: border-color .12s ease, background .12s ease;
|
|
1126
|
+
}
|
|
1127
|
+
.mc:hover { border-color: var(--line-strong); background: var(--card-hover); }
|
|
1128
|
+
|
|
1129
|
+
.mc-head { display: flex; align-items: flex-start; gap: 8px; }
|
|
1130
|
+
.mc-head > .grow { flex: 1; min-width: 0; }
|
|
1131
|
+
.mc-name {
|
|
1132
|
+
display: block;
|
|
1133
|
+
max-width: 100%;
|
|
1134
|
+
padding: 0;
|
|
1135
|
+
font: inherit;
|
|
1136
|
+
font-size: 13px;
|
|
1137
|
+
font-weight: 600;
|
|
1138
|
+
color: var(--fg);
|
|
1139
|
+
text-align: left;
|
|
1140
|
+
background: transparent;
|
|
1141
|
+
border: 0;
|
|
1142
|
+
cursor: pointer;
|
|
1143
|
+
overflow: hidden;
|
|
1144
|
+
text-overflow: ellipsis;
|
|
1145
|
+
white-space: nowrap;
|
|
1146
|
+
}
|
|
1147
|
+
.mc-name:hover { color: var(--accent); text-decoration: underline; }
|
|
1148
|
+
.mc-vendor {
|
|
1149
|
+
font-size: 10.5px;
|
|
1150
|
+
color: var(--muted);
|
|
1151
|
+
overflow: hidden;
|
|
1152
|
+
text-overflow: ellipsis;
|
|
1153
|
+
white-space: nowrap;
|
|
1154
|
+
}
|
|
1155
|
+
.mc-kind {
|
|
1156
|
+
flex: none;
|
|
1157
|
+
padding: 1px 7px;
|
|
1158
|
+
font-size: 10px;
|
|
1159
|
+
color: var(--muted);
|
|
1160
|
+
border: 1px solid var(--line);
|
|
1161
|
+
border-radius: 999px;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
.mc-desc {
|
|
1165
|
+
margin: 7px 0 0;
|
|
1166
|
+
font-size: 11.5px;
|
|
1167
|
+
line-height: 1.55;
|
|
1168
|
+
color: var(--muted);
|
|
1169
|
+
/* 固定占两行:描述一行还是两行不该改变卡片内容高度。不然同一排里
|
|
1170
|
+
短描述那张会在「端点」和「详情」之间留一大片空白,看着像没做完。 */
|
|
1171
|
+
min-height: calc(1.55em * 2);
|
|
1172
|
+
display: -webkit-box;
|
|
1173
|
+
-webkit-line-clamp: 2;
|
|
1174
|
+
-webkit-box-orient: vertical;
|
|
1175
|
+
overflow: hidden;
|
|
1176
|
+
}
|
|
1177
|
+
.mc-desc.is-empty { opacity: .5; }
|
|
1178
|
+
|
|
1179
|
+
.mc-billing { margin: 9px 0 6px; font-size: 10.5px; font-weight: 600; }
|
|
1180
|
+
.mc-billing.flat { color: var(--accent); }
|
|
1181
|
+
.mc-billing.dyn { color: var(--warn); }
|
|
1182
|
+
.mc-billing.call { color: var(--ok); }
|
|
1183
|
+
.mc-billing.auto,
|
|
1184
|
+
.mc-billing.unknown { color: var(--muted); font-weight: 500; }
|
|
1185
|
+
|
|
1186
|
+
/* 价格是这张卡的主角:三列等宽、等宽数字、细线分隔 */
|
|
1187
|
+
.mc-prices {
|
|
1188
|
+
display: grid;
|
|
1189
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
1190
|
+
gap: 8px;
|
|
1191
|
+
margin-bottom: 8px;
|
|
1192
|
+
}
|
|
1193
|
+
.mc-prices.one { grid-template-columns: minmax(0, 1fr); }
|
|
1194
|
+
.mc-prices > div {
|
|
1195
|
+
display: flex;
|
|
1196
|
+
flex-direction: column;
|
|
1197
|
+
gap: 1px;
|
|
1198
|
+
min-width: 0;
|
|
1199
|
+
padding-left: 9px;
|
|
1200
|
+
border-left: 1px solid var(--line);
|
|
1201
|
+
}
|
|
1202
|
+
.mc-prices > div:first-child { padding-left: 0; border-left: 0; }
|
|
1203
|
+
.mc-prices span { font-size: 10px; color: var(--muted); }
|
|
1204
|
+
.mc-prices b {
|
|
1205
|
+
font-family: var(--code);
|
|
1206
|
+
font-size: 12px;
|
|
1207
|
+
font-weight: 600;
|
|
1208
|
+
color: var(--fg);
|
|
1209
|
+
font-variant-numeric: tabular-nums;
|
|
1210
|
+
overflow: hidden;
|
|
1211
|
+
text-overflow: ellipsis;
|
|
1212
|
+
white-space: nowrap;
|
|
1213
|
+
}
|
|
1214
|
+
.mc-prices b.unknown { font-family: inherit; font-size: 11.5px; color: var(--warn); }
|
|
1215
|
+
.mc-prices b.muted { color: var(--muted); }
|
|
1216
|
+
|
|
1217
|
+
.mc-line {
|
|
1218
|
+
display: flex;
|
|
1219
|
+
align-items: flex-start;
|
|
1220
|
+
gap: 6px;
|
|
1221
|
+
min-width: 0;
|
|
1222
|
+
margin-top: 4px;
|
|
1223
|
+
font-size: 10.5px;
|
|
1224
|
+
}
|
|
1225
|
+
.mc-line .k { flex: none; width: 26px; line-height: 18px; color: var(--muted); }
|
|
1226
|
+
.mc-group { font-family: var(--code); color: var(--fg); overflow-wrap: anywhere; }
|
|
1227
|
+
.mc-ratio { font-family: var(--code); color: var(--muted); }
|
|
1228
|
+
.mc-ends { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
|
|
1229
|
+
.mc-end {
|
|
1230
|
+
padding: 1px 5px;
|
|
1231
|
+
font-family: var(--code);
|
|
1232
|
+
font-size: 9.5px;
|
|
1233
|
+
color: var(--muted);
|
|
1234
|
+
border: 1px solid var(--line);
|
|
1235
|
+
border-radius: 4px;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
/* 把页脚按到卡底:这一行是同排卡片底部对齐的关键 */
|
|
1239
|
+
.mc-foot { margin-top: auto; padding-top: 9px; display: flex; justify-content: flex-end; }
|
|
1240
|
+
|
|
1241
|
+
/* 文字按钮:卡片里的「详情」、侧栏的「重置」 */
|
|
1242
|
+
.link {
|
|
1243
|
+
/* 命中区补到 24×24(WCAG 2.2 AA):11px 的文字按钮本身只有 17px 高,
|
|
1244
|
+
手指点起来太窄。用负外边距把补出来的空间吃掉,视觉位置不变。 */
|
|
1245
|
+
min-height: 24px;
|
|
1246
|
+
padding: 3px 4px;
|
|
1247
|
+
margin: -3px -4px;
|
|
1248
|
+
font: inherit;
|
|
1249
|
+
font-size: 11px;
|
|
1250
|
+
color: var(--accent);
|
|
1251
|
+
background: transparent;
|
|
1252
|
+
border: 0;
|
|
1253
|
+
cursor: pointer;
|
|
1254
|
+
touch-action: manipulation;
|
|
1255
|
+
}
|
|
1256
|
+
.link:hover { text-decoration: underline; }
|
|
1257
|
+
|
|
1258
|
+
@media (max-width: 900px) {
|
|
1259
|
+
.market-body { grid-template-columns: minmax(0, 1fr); }
|
|
1260
|
+
.market-aside { position: static; max-height: none; }
|
|
1261
|
+
/* 窄屏下 14 个分组纵向排开会把模型全挤到第二屏以后。改成横向滚动条:
|
|
1262
|
+
侧栏只占一两行,模型立刻可见。 */
|
|
1263
|
+
.market-aside .market-chips {
|
|
1264
|
+
flex-direction: row;
|
|
1265
|
+
flex-wrap: nowrap;
|
|
1266
|
+
overflow-x: auto;
|
|
1267
|
+
padding-bottom: 4px;
|
|
1268
|
+
scrollbar-width: thin;
|
|
1269
|
+
}
|
|
1270
|
+
.market-aside .market-chip { flex: none; }
|
|
1271
|
+
.market-aside .market-chip .chip-count { margin-left: 2px; }
|
|
1272
|
+
.model-grid { grid-template-columns: minmax(0, 1fr); }
|
|
1273
|
+
}
|
|
1274
|
+
|