@linxin666/dsh-pet 0.3.5 → 0.3.9
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.i18n.yaml +2 -2
- package/README.md +4 -0
- package/README.zh.md +4 -0
- package/contracts/voice-pack-v1.schema.json +30 -0
- package/cordis.patch.yml +1 -1
- package/lib/client.js +330 -103
- package/lib/client.js.map +1 -1
- package/lib/index.js +145 -28
- package/lib/invariant.js +1 -1
- package/lib/live2d-vendor.js +106 -95
- package/lib/live2d-vendor.js.map +1 -1
- package/lib/{state-DrMX22GL.js → state-NvDEoCln.js} +5 -2
- package/lib/types/access.d.ts +5 -4
- package/lib/types/access.d.ts.map +1 -1
- package/lib/types/access.js +2 -12
- package/lib/types/affinity.d.ts +2 -0
- package/lib/types/affinity.d.ts.map +1 -1
- package/lib/types/affinity.js +12 -0
- package/lib/types/announce.d.ts +53 -0
- package/lib/types/announce.d.ts.map +1 -0
- package/lib/types/announce.js +80 -0
- package/lib/types/client/PetDockEntry.d.ts +14 -5
- package/lib/types/client/PetDockEntry.d.ts.map +1 -1
- package/lib/types/client/PetDockEntry.js +6 -5
- package/lib/types/client/PetSettingsCard.d.ts +2 -1
- package/lib/types/client/PetSettingsCard.d.ts.map +1 -1
- package/lib/types/client/PetSprite.d.ts +8 -0
- package/lib/types/client/PetSprite.d.ts.map +1 -1
- package/lib/types/client/PetSprite.js +36 -5
- package/lib/types/client/index.d.ts +8 -5
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +11 -5
- package/lib/types/client/locales.d.ts +20 -2
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/locales.js +20 -2
- package/lib/types/client/pet-store.d.ts +1 -1
- package/lib/types/client/pet-store.d.ts.map +1 -1
- package/lib/types/client/pet-store.js +1 -1
- package/lib/types/client/renderers/frames2d.d.ts +12 -0
- package/lib/types/client/renderers/frames2d.d.ts.map +1 -1
- package/lib/types/client/renderers/frames2d.js +143 -18
- package/lib/types/client/settings-form.d.ts +35 -43
- package/lib/types/client/settings-form.d.ts.map +1 -1
- package/lib/types/client/settings-form.js +60 -53
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +10 -9
- package/lib/types/ledger.d.ts +4 -2
- package/lib/types/ledger.d.ts.map +1 -1
- package/lib/types/ledger.js +4 -4
- package/lib/types/pair-access.d.ts +35 -0
- package/lib/types/pair-access.d.ts.map +1 -0
- package/lib/types/pair-access.js +19 -0
- package/lib/types/remarks.d.ts +1 -1
- package/lib/types/remarks.d.ts.map +1 -1
- package/lib/types/remarks.js +11 -2
- package/lib/types/service.d.ts +18 -0
- package/lib/types/service.d.ts.map +1 -1
- package/lib/types/service.js +26 -1
- package/lib/types/voice-pack.d.ts +5 -0
- package/lib/types/voice-pack.d.ts.map +1 -1
- package/lib/types/voice-pack.js +36 -2
- package/package.json +17 -13
- package/src/access.ts +7 -27
- package/src/affinity.ts +13 -0
- package/src/announce.ts +103 -0
- package/src/client/PetDockEntry.test.tsx +1 -1
- package/src/client/PetDockEntry.tsx +15 -4
- package/src/client/PetSettingsCard.tsx +2 -1
- package/src/client/PetSprite.test.tsx +36 -0
- package/src/client/PetSprite.tsx +75 -4
- package/src/client/gameplay-hud.test.tsx +1 -1
- package/src/client/index.test.tsx +2 -2
- package/src/client/index.ts +17 -6
- package/src/client/locales.ts +20 -2
- package/src/client/pet-store.ts +2 -2
- package/src/client/pet.module.css +104 -0
- package/src/client/renderers/frames2d.test.ts +101 -0
- package/src/client/renderers/frames2d.ts +138 -18
- package/src/client/settings-form.ts +78 -92
- package/src/dsh-home.ts +1 -1
- package/src/index.ts +17 -15
- package/src/ledger.ts +6 -4
- package/src/pair-access.ts +49 -0
- package/src/remarks.test.ts +10 -0
- package/src/remarks.ts +9 -2
- package/src/service.ts +32 -2
- package/src/voice-pack.test.ts +39 -0
- package/src/voice-pack.ts +37 -2
package/src/voice-pack.ts
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
type WhisperCategory,
|
|
38
38
|
type WhisperResult,
|
|
39
39
|
} from './chatter.ts'
|
|
40
|
+
import { normalizePetRemarks, type PetRemarks } from './remarks.ts'
|
|
40
41
|
|
|
41
42
|
/** Schema version this module normalizes (optional field; missing = 1). */
|
|
42
43
|
export const VOICE_PACK_V1 = 1 as const
|
|
@@ -69,6 +70,10 @@ export interface VoicePack {
|
|
|
69
70
|
overrides: VoicePackOverrides
|
|
70
71
|
/** Hover-panel chrome, when the pack declares any. */
|
|
71
72
|
panel?: PetPanelView
|
|
73
|
+
/** Pat/feed interaction remark pools (issue #1226). */
|
|
74
|
+
remarks?: PetRemarks
|
|
75
|
+
/** Affinity rank name overrides (issue #1226). */
|
|
76
|
+
ranks?: Record<string, string>
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
/** Hard caps shared by every pool slot (mirrors the remarks discipline). */
|
|
@@ -265,7 +270,7 @@ export function normalizePanel(
|
|
|
265
270
|
}
|
|
266
271
|
|
|
267
272
|
/** Voice-pack top-level fields ('$schema' mirrors the schema twin; drift-locked in tests). */
|
|
268
|
-
export const VOICE_PACK_KEYS = new Set(['$schema', 'voicePackVersion', 'status', 'tools', 'toolRemaining', 'whispers', 'panel'])
|
|
273
|
+
export const VOICE_PACK_KEYS = new Set(['$schema', 'voicePackVersion', 'status', 'tools', 'toolRemaining', 'whispers', 'panel', 'remarks', 'ranks'])
|
|
269
274
|
|
|
270
275
|
/** Allowed whisper-section fields (drift-locked in tests). */
|
|
271
276
|
export const WHISPER_KEYS = new Set(['categories', 'results'])
|
|
@@ -356,16 +361,36 @@ export function normalizeVoicePack(
|
|
|
356
361
|
}
|
|
357
362
|
}
|
|
358
363
|
const panel = raw.panel === undefined ? undefined : normalizePanel(raw.panel, onWarning)
|
|
364
|
+
const remarks = raw.remarks === undefined ? undefined : normalizePetRemarks(raw.remarks, onWarning)
|
|
365
|
+
const ranksRaw = raw.ranks
|
|
366
|
+
let ranks: Record<string, string> | undefined
|
|
367
|
+
if (ranksRaw !== undefined) {
|
|
368
|
+
if (!isRecord(ranksRaw)) {
|
|
369
|
+
onWarning('ranks must be an object')
|
|
370
|
+
} else {
|
|
371
|
+
const out: Record<string, string> = {}
|
|
372
|
+
for (const [key, value] of Object.entries(ranksRaw)) {
|
|
373
|
+
if (typeof value === 'string' && value.trim() !== '') {
|
|
374
|
+
out[key] = value.trim().slice(0, VOICE_STAT_MAX)
|
|
375
|
+
} else {
|
|
376
|
+
onWarning('invalid rank name for ' + key)
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
if (Object.keys(out).length > 0) ranks = out
|
|
380
|
+
}
|
|
381
|
+
}
|
|
359
382
|
if (
|
|
360
383
|
overrides.status === undefined && overrides.tools === undefined
|
|
361
384
|
&& overrides.toolRemaining === undefined && overrides.whispers === undefined
|
|
362
|
-
&& panel === undefined
|
|
385
|
+
&& panel === undefined && remarks === undefined && ranks === undefined
|
|
363
386
|
) {
|
|
364
387
|
return undefined
|
|
365
388
|
}
|
|
366
389
|
return {
|
|
367
390
|
overrides,
|
|
368
391
|
...(panel === undefined ? {} : { panel }),
|
|
392
|
+
...(remarks === undefined ? {} : { remarks }),
|
|
393
|
+
...(ranks === undefined ? {} : { ranks }),
|
|
369
394
|
}
|
|
370
395
|
}
|
|
371
396
|
|
|
@@ -379,6 +404,8 @@ export function mergeVoicePacks(...layers: (VoicePack | undefined)[]): VoicePack
|
|
|
379
404
|
const overrides: VoicePackOverrides = {}
|
|
380
405
|
const labels: NonNullable<PetPanelView['labels']> = {}
|
|
381
406
|
const stats: NonNullable<PetPanelView['stats']> = {}
|
|
407
|
+
let remarks: PetRemarks | undefined
|
|
408
|
+
let ranks: Record<string, string> | undefined
|
|
382
409
|
let actions: PanelAction[] | undefined
|
|
383
410
|
let panelSeen = false
|
|
384
411
|
let any = false
|
|
@@ -401,6 +428,12 @@ export function mergeVoicePacks(...layers: (VoicePack | undefined)[]): VoicePack
|
|
|
401
428
|
if (layer.panel.stats !== undefined) Object.assign(stats, layer.panel.stats)
|
|
402
429
|
if (layer.panel.actions !== undefined) actions = layer.panel.actions
|
|
403
430
|
}
|
|
431
|
+
if (layer.remarks !== undefined) {
|
|
432
|
+
remarks = { ...(remarks ?? {}), ...layer.remarks }
|
|
433
|
+
}
|
|
434
|
+
if (layer.ranks !== undefined) {
|
|
435
|
+
ranks = { ...(ranks ?? {}), ...layer.ranks }
|
|
436
|
+
}
|
|
404
437
|
}
|
|
405
438
|
if (!any) return undefined
|
|
406
439
|
const panel: PetPanelView = {
|
|
@@ -412,5 +445,7 @@ export function mergeVoicePacks(...layers: (VoicePack | undefined)[]): VoicePack
|
|
|
412
445
|
return {
|
|
413
446
|
overrides,
|
|
414
447
|
...(panelSeen && !panelEmpty ? { panel } : {}),
|
|
448
|
+
...(remarks !== undefined ? { remarks } : {}),
|
|
449
|
+
...(ranks !== undefined ? { ranks } : {}),
|
|
415
450
|
}
|
|
416
451
|
}
|