@jjlmoya/utils-tabletop 1.27.0 → 1.28.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/package.json +1 -1
- package/src/category/index.ts +2 -0
- package/src/entries.ts +2 -0
- package/src/tests/locale_completeness.test.ts +1 -1
- package/src/tests/tool_validation.test.ts +1 -1
- package/src/tool/mus-scoreboard/bibliography.astro +16 -0
- package/src/tool/mus-scoreboard/bibliography.ts +12 -0
- package/src/tool/mus-scoreboard/component.astro +169 -0
- package/src/tool/mus-scoreboard/controller.ts +178 -0
- package/src/tool/mus-scoreboard/dom-views.ts +87 -0
- package/src/tool/mus-scoreboard/entry.ts +27 -0
- package/src/tool/mus-scoreboard/evaluator.ts +27 -0
- package/src/tool/mus-scoreboard/i18n/de.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/en.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/es.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/fr.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/id.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/it.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/ja.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/ko.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/nl.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/pl.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/pt.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/ru.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/sv.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/tr.ts +187 -0
- package/src/tool/mus-scoreboard/i18n/zh.ts +187 -0
- package/src/tool/mus-scoreboard/index.ts +11 -0
- package/src/tool/mus-scoreboard/logic.test.ts +82 -0
- package/src/tool/mus-scoreboard/logic.ts +122 -0
- package/src/tool/mus-scoreboard/online-mus-scoreboard.css +740 -0
- package/src/tool/mus-scoreboard/seo.astro +16 -0
- package/src/tool/mus-scoreboard/storage.ts +29 -0
- package/src/tool/mus-scoreboard/ui.ts +63 -0
- package/src/tools.ts +2 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { SEORenderer } from '@jjlmoya/utils-shared';
|
|
3
|
+
import { musScoreboard } from './index';
|
|
4
|
+
import type { KnownLocale } from '../../types';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
locale?: KnownLocale;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { locale = 'en' } = Astro.props as Props;
|
|
11
|
+
const loader = musScoreboard.i18n[locale] || musScoreboard.i18n.en;
|
|
12
|
+
const content = await loader?.();
|
|
13
|
+
if (!content) return null;
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
{content.seo?.length > 0 && <SEORenderer content={{ locale, sections: content.seo }} />}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MusState } from './logic';
|
|
2
|
+
|
|
3
|
+
const STORAGE_KEY = 'jjlmoya-mus-scoreboard-state';
|
|
4
|
+
|
|
5
|
+
export const loadMusState = (): MusState | null => {
|
|
6
|
+
try {
|
|
7
|
+
const raw = window.localStorage.getItem(STORAGE_KEY);
|
|
8
|
+
if (!raw) return null;
|
|
9
|
+
const state = JSON.parse(raw) as MusState;
|
|
10
|
+
if (!state.config.deck) state.config.deck = 'spanish';
|
|
11
|
+
if (state.hand !== 0 && state.hand !== 1) state.hand = 0;
|
|
12
|
+
state.history = state.history.map((entry) => ({ ...entry, hand: entry.hand === 1 ? 1 : 0 }));
|
|
13
|
+
return state;
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const saveMusState = (state: MusState): void => {
|
|
20
|
+
try {
|
|
21
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
|
|
22
|
+
} catch {}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const clearMusState = (): void => {
|
|
26
|
+
try {
|
|
27
|
+
window.localStorage.removeItem(STORAGE_KEY);
|
|
28
|
+
} catch {}
|
|
29
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export interface MusScoreboardUI {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
onboarding: string;
|
|
4
|
+
pairOneLabel: string;
|
|
5
|
+
pairTwoLabel: string;
|
|
6
|
+
pairOneDefault: string;
|
|
7
|
+
pairTwoDefault: string;
|
|
8
|
+
targetPointsLabel: string;
|
|
9
|
+
targetPointsHint: string;
|
|
10
|
+
gamesToWinLabel: string;
|
|
11
|
+
gamesToWinHint: string;
|
|
12
|
+
deckLabel: string;
|
|
13
|
+
deckHint: string;
|
|
14
|
+
spanishDeck: string;
|
|
15
|
+
frenchDeck: string;
|
|
16
|
+
frenchDeckNotice: string;
|
|
17
|
+
pointsOption30: string;
|
|
18
|
+
pointsOption40: string;
|
|
19
|
+
pointsOption50: string;
|
|
20
|
+
gamesOption1: string;
|
|
21
|
+
gamesOption2: string;
|
|
22
|
+
gamesOption3: string;
|
|
23
|
+
startMatch: string;
|
|
24
|
+
matchSettings: string;
|
|
25
|
+
liveMatch: string;
|
|
26
|
+
targetLabel: string;
|
|
27
|
+
gameLabel: string;
|
|
28
|
+
gamePlural: string;
|
|
29
|
+
vacaLabel: string;
|
|
30
|
+
scoreLabel: string;
|
|
31
|
+
handLabel: string;
|
|
32
|
+
handSelected: string;
|
|
33
|
+
stonesLabel: string;
|
|
34
|
+
stoneSingular: string;
|
|
35
|
+
stonePlural: string;
|
|
36
|
+
amarracoSingular: string;
|
|
37
|
+
amarracoPlural: string;
|
|
38
|
+
pointsToGo: string;
|
|
39
|
+
addStone: string;
|
|
40
|
+
addAmarraco: string;
|
|
41
|
+
closeGame: string;
|
|
42
|
+
closeGamePrompt: string;
|
|
43
|
+
confirmationTitle: string;
|
|
44
|
+
confirmAction: string;
|
|
45
|
+
cancelAction: string;
|
|
46
|
+
undo: string;
|
|
47
|
+
resetMatch: string;
|
|
48
|
+
resetMatchPrompt: string;
|
|
49
|
+
historyTitle: string;
|
|
50
|
+
noHistory: string;
|
|
51
|
+
matchReady: string;
|
|
52
|
+
closeGameHint: string;
|
|
53
|
+
waitingForScore: string;
|
|
54
|
+
gameWon: string;
|
|
55
|
+
vacaWon: string;
|
|
56
|
+
gameClosed: string;
|
|
57
|
+
pointsAdded: string;
|
|
58
|
+
matchSaved: string;
|
|
59
|
+
lastAction: string;
|
|
60
|
+
settingsApplied: string;
|
|
61
|
+
pairNameRequired: string;
|
|
62
|
+
visualScoreLabel: string;
|
|
63
|
+
}
|
package/src/tools.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { SCATTER_DIRECTION_SELECTOR_TOOL } from './tool/scatter-direction-select
|
|
|
14
14
|
import { DUNGEON_MAP_GENERATOR_TOOL } from './tool/dungeon-map-generator';
|
|
15
15
|
import { ENCOUNTER_DIFFICULTY_CALCULATOR_TOOL } from './tool/encounter-difficulty-calculator';
|
|
16
16
|
import { TOKEN_STAMP_STUDIO_TOOL } from './tool/token-stamp-studio';
|
|
17
|
+
import { MUS_SCOREBOARD_TOOL } from './tool/mus-scoreboard';
|
|
17
18
|
|
|
18
19
|
export const ALL_TOOLS: ToolDefinition[] = [
|
|
19
20
|
DICE_ROLLER_SIMULATOR_TOOL,
|
|
@@ -30,5 +31,6 @@ export const ALL_TOOLS: ToolDefinition[] = [
|
|
|
30
31
|
DUNGEON_MAP_GENERATOR_TOOL,
|
|
31
32
|
ENCOUNTER_DIFFICULTY_CALCULATOR_TOOL,
|
|
32
33
|
TOKEN_STAMP_STUDIO_TOOL,
|
|
34
|
+
MUS_SCOREBOARD_TOOL,
|
|
33
35
|
];
|
|
34
36
|
|