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.
Files changed (45) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +50 -32
  3. package/assets/animations/NOTICE.md +15 -0
  4. package/assets/animations/alpha-probe.webm +0 -0
  5. package/assets/animations/ornate-drink.webm +0 -0
  6. package/assets/animations/ornate-greet.webm +0 -0
  7. package/assets/animations/ornate-idle.webm +0 -0
  8. package/assets/animations/whale-drink.webm +0 -0
  9. package/assets/animations/whale-greet.webm +0 -0
  10. package/assets/characters/NOTICE.md +4 -0
  11. package/assets/characters/whale-actions.webp +0 -0
  12. package/assets/characters/whale-ornate-actions.webp +0 -0
  13. package/client.js +2970 -770
  14. package/client.source.js +1668 -444
  15. package/companion.js +6 -9
  16. package/countdown.js +83 -0
  17. package/hydration-store.js +55 -16
  18. package/hydration.js +231 -250
  19. package/index.js +2 -0
  20. package/locale/en.json +1 -1
  21. package/locale/zh.json +1 -1
  22. package/media-manifest.js +29 -0
  23. package/media-server.js +123 -0
  24. package/package.json +9 -2
  25. package/pet-interactions.js +78 -7
  26. package/pet-motion.js +111 -0
  27. package/pet-reminder.js +20 -0
  28. package/pet-surfaces.js +130 -6
  29. package/pet-video.js +380 -0
  30. package/pet-view.js +129 -13
  31. package/tests/classic-overview.test.mjs +77 -0
  32. package/tests/companion.test.mjs +12 -12
  33. package/tests/countdown.test.mjs +115 -0
  34. package/tests/host.test.mjs +6 -0
  35. package/tests/hydration-extras.test.mjs +168 -204
  36. package/tests/hydration-store.test.mjs +199 -213
  37. package/tests/hydration.test.mjs +116 -186
  38. package/tests/media-server.test.mjs +179 -0
  39. package/tests/pet-character.test.mjs +8 -2
  40. package/tests/pet-motion.test.mjs +139 -0
  41. package/tests/pet-reminder.test.mjs +71 -0
  42. package/tests/pet-video.test.mjs +503 -0
  43. package/tools/build.mjs +62 -13
  44. package/tools/check-package.mjs +19 -0
  45. 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: ['whale-dress', 'whale-ornate', 'xiaoxie-original'].includes(value?.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)),