@adatechnology/game-test-room 0.5.0 → 0.6.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/index.d.ts +8 -0
- package/dist/index.global.js +23 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -3158,6 +3158,10 @@ var CSS = `
|
|
|
3158
3158
|
.tr-search{width:100%;margin:0 0 6px;padding:5px 8px;border-radius:5px;border:1px solid #3a404c;background:#0f1116;color:#e8eaee;font:inherit}
|
|
3159
3159
|
.tr-search::placeholder{color:#7d8594}
|
|
3160
3160
|
.tr-item small{color:#7d8594;margin-left:4px}
|
|
3161
|
+
.tr-thumb{display:block;width:100%;height:26px;background:currentColor;-webkit-mask:var(--tr-thumb) center/contain no-repeat;mask:var(--tr-thumb) center/contain no-repeat}
|
|
3162
|
+
.tr-item{min-width:0}
|
|
3163
|
+
.tr-item .tr-btn.has-thumb{display:flex;flex-direction:column;gap:3px;min-width:0}.tr-item .tr-btn.has-thumb .tr-name{overflow:hidden;text-overflow:ellipsis}
|
|
3164
|
+
.tr-insp .tr-thumb{width:140px;height:28px;margin-bottom:3px}
|
|
3161
3165
|
.tr-empty{color:#9aa3b2;padding:4px 2px;grid-column:1/-1}
|
|
3162
3166
|
.tr-cross{position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-9px 0 0 -9px}
|
|
3163
3167
|
.tr-cross:before,.tr-cross:after{content:"";position:absolute;background:#fff;opacity:.85;box-shadow:0 0 2px #000}
|
|
@@ -3223,6 +3227,17 @@ var mk2 = (tag, cls, text) => {
|
|
|
3223
3227
|
if (text !== void 0) e.textContent = text;
|
|
3224
3228
|
return e;
|
|
3225
3229
|
};
|
|
3230
|
+
var thumbSource = (thumbnail) => {
|
|
3231
|
+
const source = thumbnail.trim().startsWith("<") ? `data:image/svg+xml,${encodeURIComponent(thumbnail.trim())}` : thumbnail.trim();
|
|
3232
|
+
return source.replace(/["\\\n\r]/g, (char) => encodeURIComponent(char));
|
|
3233
|
+
};
|
|
3234
|
+
var thumb = (thumbnail, credit) => {
|
|
3235
|
+
const e = mk2("span", "tr-thumb");
|
|
3236
|
+
if (credit) e.title = credit;
|
|
3237
|
+
else e.setAttribute("aria-hidden", "true");
|
|
3238
|
+
e.style.setProperty("--tr-thumb", `url("${thumbSource(thumbnail)}")`);
|
|
3239
|
+
return e;
|
|
3240
|
+
};
|
|
3226
3241
|
function createUi(o) {
|
|
3227
3242
|
const { t } = o;
|
|
3228
3243
|
const style = mk2("style");
|
|
@@ -3376,7 +3391,8 @@ function createUi(o) {
|
|
|
3376
3391
|
if (!found.length) items.appendChild(mk2("div", "tr-empty", t("ui.no_results")));
|
|
3377
3392
|
for (const { item: it, group } of found) {
|
|
3378
3393
|
const wrap = mk2("div", "tr-item");
|
|
3379
|
-
const b = mk2("button", "tr-btn", it.name);
|
|
3394
|
+
const b = mk2("button", it.thumbnail ? "tr-btn has-thumb" : "tr-btn", it.thumbnail ? void 0 : it.name);
|
|
3395
|
+
if (it.thumbnail) b.append(thumb(it.thumbnail), mk2("span", "tr-name", it.name));
|
|
3380
3396
|
if (searching) b.appendChild(mk2("small", void 0, group));
|
|
3381
3397
|
b.type = "button";
|
|
3382
3398
|
b.title = it.note ?? it.name;
|
|
@@ -3535,6 +3551,7 @@ function createUi(o) {
|
|
|
3535
3551
|
insp.appendChild(mk2("div", void 0, t("ui.aim_at_something")));
|
|
3536
3552
|
return;
|
|
3537
3553
|
}
|
|
3554
|
+
if (i.thumbnail) insp.appendChild(thumb(i.thumbnail, i.thumbnailCredit));
|
|
3538
3555
|
insp.appendChild(mk2("div", "t", `${i.object} \u203A ${i.part}`));
|
|
3539
3556
|
insp.appendChild(row(t("ins.material"), i.material));
|
|
3540
3557
|
insp.appendChild(row(t("ins.status"), i.status + (i.burning ? ` \xB7 ${t("ins.burning")}` : "")));
|
|
@@ -4906,6 +4923,8 @@ function createTestRoom(options) {
|
|
|
4906
4923
|
stress: ext.stress,
|
|
4907
4924
|
joints,
|
|
4908
4925
|
note: e?.item?.note,
|
|
4926
|
+
thumbnail: e?.item?.thumbnail,
|
|
4927
|
+
thumbnailCredit: e?.item?.thumbnailCredit,
|
|
4909
4928
|
distance: r.distance
|
|
4910
4929
|
};
|
|
4911
4930
|
};
|
|
@@ -5305,7 +5324,9 @@ function createTestRoom(options) {
|
|
|
5305
5324
|
fluid: ti.fluid,
|
|
5306
5325
|
weapon: ti.weapon,
|
|
5307
5326
|
impl: ti.impl,
|
|
5308
|
-
animations: ti.animations
|
|
5327
|
+
animations: ti.animations,
|
|
5328
|
+
thumbnail: ti.thumbnail,
|
|
5329
|
+
thumbnailCredit: ti.thumbnailCredit
|
|
5309
5330
|
};
|
|
5310
5331
|
catalogMap.set(item.id, item);
|
|
5311
5332
|
const at = catalog.findIndex((c) => c.id === item.id);
|