dsh-offwork 1.1.0 → 1.1.2
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/CHANGELOG.md +21 -0
- package/README.md +50 -32
- package/assets/animations/NOTICE.md +15 -0
- package/assets/animations/alpha-probe.webm +0 -0
- package/assets/animations/ornate-drink.webm +0 -0
- package/assets/animations/ornate-greet.webm +0 -0
- package/assets/animations/ornate-idle.webm +0 -0
- package/assets/animations/whale-drink.webm +0 -0
- package/assets/animations/whale-greet.webm +0 -0
- package/assets/characters/NOTICE.md +4 -0
- package/assets/characters/whale-actions.webp +0 -0
- package/assets/characters/whale-ornate-actions.webp +0 -0
- package/client.js +2970 -770
- package/client.source.js +1668 -444
- package/companion.js +6 -9
- package/countdown.js +83 -0
- package/hydration-store.js +55 -16
- package/hydration.js +231 -250
- package/index.js +2 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/media-manifest.js +29 -0
- package/media-server.js +123 -0
- package/package.json +9 -2
- package/pet-interactions.js +78 -7
- package/pet-motion.js +111 -0
- package/pet-reminder.js +20 -0
- package/pet-surfaces.js +130 -6
- package/pet-video.js +380 -0
- package/pet-view.js +129 -13
- package/tests/classic-overview.test.mjs +77 -0
- package/tests/companion.test.mjs +12 -12
- package/tests/countdown.test.mjs +115 -0
- package/tests/host.test.mjs +6 -0
- package/tests/hydration-extras.test.mjs +168 -204
- package/tests/hydration-store.test.mjs +199 -213
- package/tests/hydration.test.mjs +116 -186
- package/tests/media-server.test.mjs +179 -0
- package/tests/pet-character.test.mjs +8 -2
- package/tests/pet-motion.test.mjs +139 -0
- package/tests/pet-reminder.test.mjs +71 -0
- package/tests/pet-video.test.mjs +503 -0
- package/tools/build.mjs +62 -13
- package/tools/check-package.mjs +19 -0
- package/ui-utils.js +51 -1
package/ui-utils.js
CHANGED
|
@@ -7,6 +7,50 @@ export function formatDuration(seconds) {
|
|
|
7
7
|
.join(':');
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export function classicClockPresentation({ hasSession, loaded, configured, failed, state, now }) {
|
|
11
|
+
if (!hasSession)
|
|
12
|
+
return { phase: 'waiting', title: 'classicNoSession', hint: 'noSession', seconds: null };
|
|
13
|
+
if (failed)
|
|
14
|
+
return { phase: 'error', title: 'classicUnavailable', hint: 'classicRetryHint', seconds: null };
|
|
15
|
+
if (!loaded)
|
|
16
|
+
return { phase: 'loading', title: 'classicLoading', hint: 'classicLoadingHint', seconds: null };
|
|
17
|
+
if (!configured) return { phase: 'setup', title: 'setup', hint: 'setupHint', seconds: null };
|
|
18
|
+
switch (state?.status) {
|
|
19
|
+
case 'before':
|
|
20
|
+
return {
|
|
21
|
+
phase: 'before',
|
|
22
|
+
title: 'before',
|
|
23
|
+
hint: 'classicBeforeHint',
|
|
24
|
+
seconds: state.startRemaining,
|
|
25
|
+
};
|
|
26
|
+
case 'working':
|
|
27
|
+
return {
|
|
28
|
+
phase: 'working',
|
|
29
|
+
title: 'working',
|
|
30
|
+
hint: 'classicWorkingHint',
|
|
31
|
+
seconds: state.remaining,
|
|
32
|
+
};
|
|
33
|
+
case 'lunch':
|
|
34
|
+
return {
|
|
35
|
+
phase: 'lunch',
|
|
36
|
+
title: 'classicLunchRemaining',
|
|
37
|
+
hint: 'classicLunchHint',
|
|
38
|
+
seconds: Math.max(0, Math.ceil((state.breakEnd - now) / 1000)),
|
|
39
|
+
};
|
|
40
|
+
case 'done':
|
|
41
|
+
return { phase: 'done', title: 'done', hint: 'classicDoneHint', seconds: null };
|
|
42
|
+
case 'rest':
|
|
43
|
+
return { phase: 'rest', title: 'rest', hint: 'classicRestHint', seconds: null };
|
|
44
|
+
default:
|
|
45
|
+
return {
|
|
46
|
+
phase: 'error',
|
|
47
|
+
title: 'classicUnavailable',
|
|
48
|
+
hint: 'classicRetryHint',
|
|
49
|
+
seconds: null,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
10
54
|
export function clampPosition(position, viewport, size) {
|
|
11
55
|
const width = Math.max(0, viewport.width),
|
|
12
56
|
height = Math.max(0, viewport.height);
|
|
@@ -33,7 +77,13 @@ export function normalizeView(value) {
|
|
|
33
77
|
masked: value?.masked !== false,
|
|
34
78
|
companion: value?.companion !== false,
|
|
35
79
|
companionMotion: value?.companionMotion !== false,
|
|
36
|
-
petModel: [
|
|
80
|
+
petModel: [
|
|
81
|
+
'whale-dress',
|
|
82
|
+
'whale-ornate',
|
|
83
|
+
'whale-actions',
|
|
84
|
+
'whale-ornate-actions',
|
|
85
|
+
'xiaoxie-original',
|
|
86
|
+
].includes(value?.petModel)
|
|
37
87
|
? value.petModel
|
|
38
88
|
: 'whale-dress',
|
|
39
89
|
petSize: Math.min(180, Math.max(80, Number.isFinite(value?.petSize) ? value.petSize : 132)),
|