@moonwitness/ui 7.3.1 → 9.0.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/CHANGELOG.md +16 -0
- package/package.json +2 -3
- package/scripts/consumer-smoke.mjs +0 -45
- package/scripts/generate-icons.mjs +0 -110
- package/scripts/generate-token-artifacts.mjs +0 -90
- package/scripts/icon-svg-to-jsx.mjs +0 -249
- package/scripts/verification-diagnostics.mjs +0 -40
- package/scripts/verify-package.mjs +0 -412
- package/src/cartoon/anime-avatar.tsx +0 -628
- package/src/cartoon/anime-stage.tsx +0 -458
- package/src/cartoon/index.tsx +0 -542
- package/src/cartoon.tsx +0 -645
- package/src/characters.ts +0 -625
- package/src/components/accordion.tsx +0 -77
- package/src/components/alert.tsx +0 -139
- package/src/components/appearance-menu.tsx +0 -181
- package/src/components/artwork-frame.tsx +0 -49
- package/src/components/audio.tsx +0 -97
- package/src/components/avatar.tsx +0 -75
- package/src/components/badge.tsx +0 -94
- package/src/components/brand-mark.tsx +0 -73
- package/src/components/breadcrumbs.tsx +0 -98
- package/src/components/button.tsx +0 -340
- package/src/components/card.tsx +0 -171
- package/src/components/character-badge.tsx +0 -58
- package/src/components/character-preview.tsx +0 -104
- package/src/components/character-stage.tsx +0 -225
- package/src/components/chart.tsx +0 -481
- package/src/components/checkbox.tsx +0 -64
- package/src/components/comic-panel.tsx +0 -301
- package/src/components/comic-theater.tsx +0 -170
- package/src/components/command.tsx +0 -189
- package/src/components/confirm-dialog.tsx +0 -129
- package/src/components/copy-button.tsx +0 -62
- package/src/components/date-picker.tsx +0 -126
- package/src/components/dialog.tsx +0 -164
- package/src/components/dna-icon.tsx +0 -77
- package/src/components/dropdown-menu.tsx +0 -87
- package/src/components/effects.tsx +0 -1021
- package/src/components/empty-state.tsx +0 -93
- package/src/components/epistemic-branch-panel.tsx +0 -101
- package/src/components/error-state.tsx +0 -137
- package/src/components/field.tsx +0 -96
- package/src/components/filter-facet-bar.tsx +0 -91
- package/src/components/inbox-popover.tsx +0 -146
- package/src/components/input.tsx +0 -25
- package/src/components/kanban-board.tsx +0 -190
- package/src/components/label.tsx +0 -19
- package/src/components/layered-scene.tsx +0 -555
- package/src/components/log-console.tsx +0 -261
- package/src/components/metric-tile.tsx +0 -99
- package/src/components/mode-picker.tsx +0 -149
- package/src/components/motion-timeline.tsx +0 -848
- package/src/components/number-input.tsx +0 -104
- package/src/components/page-header.tsx +0 -123
- package/src/components/pagination.tsx +0 -83
- package/src/components/panel.tsx +0 -121
- package/src/components/paper-note.tsx +0 -77
- package/src/components/popover.tsx +0 -72
- package/src/components/progress.tsx +0 -127
- package/src/components/quest-card.tsx +0 -319
- package/src/components/radio-group.tsx +0 -50
- package/src/components/riot-sticker.tsx +0 -151
- package/src/components/scene-particles.tsx +0 -196
- package/src/components/scene-transitions.tsx +0 -130
- package/src/components/section-ribbon.tsx +0 -94
- package/src/components/select-field.tsx +0 -27
- package/src/components/select.tsx +0 -81
- package/src/components/separator.tsx +0 -58
- package/src/components/sheet.tsx +0 -96
- package/src/components/skeleton.tsx +0 -35
- package/src/components/sketch-annotation.tsx +0 -87
- package/src/components/smart-button-box.tsx +0 -114
- package/src/components/speech-bubble.tsx +0 -116
- package/src/components/spinner.tsx +0 -69
- package/src/components/sprite-player.tsx +0 -412
- package/src/components/status-bar.tsx +0 -63
- package/src/components/status-pill.tsx +0 -68
- package/src/components/switch.tsx +0 -76
- package/src/components/table.tsx +0 -163
- package/src/components/tabs.tsx +0 -101
- package/src/components/tag-input.tsx +0 -170
- package/src/components/textarea.tsx +0 -25
- package/src/components/toast.tsx +0 -14
- package/src/components/toolbar.tsx +0 -39
- package/src/components/tooltip.tsx +0 -49
- package/src/components/update-banner.tsx +0 -220
- package/src/components/xv-primitives.tsx +0 -256
- package/src/css-exports.ts +0 -142
- package/src/dna.tsx +0 -137
- package/src/game/boss-hud.tsx +0 -384
- package/src/game/index.tsx +0 -886
- package/src/game/tactical.tsx +0 -245
- package/src/game.tsx +0 -770
- package/src/icons/activity.tsx +0 -38
- package/src/icons/add.tsx +0 -38
- package/src/icons/addon.tsx +0 -37
- package/src/icons/anime-anger.tsx +0 -37
- package/src/icons/anime-shock.tsx +0 -37
- package/src/icons/anime-sparkle.tsx +0 -38
- package/src/icons/anime-sweatdrop.tsx +0 -38
- package/src/icons/archive.tsx +0 -37
- package/src/icons/arrow-left.tsx +0 -37
- package/src/icons/arrow-right.tsx +0 -37
- package/src/icons/attachment.tsx +0 -38
- package/src/icons/bank.tsx +0 -37
- package/src/icons/bolt.tsx +0 -37
- package/src/icons/book-open.tsx +0 -37
- package/src/icons/bookmark.tsx +0 -37
- package/src/icons/boss-skull.tsx +0 -40
- package/src/icons/calendar-clock.tsx +0 -40
- package/src/icons/calendar.tsx +0 -38
- package/src/icons/check-circle.tsx +0 -38
- package/src/icons/check-square.tsx +0 -38
- package/src/icons/check.tsx +0 -37
- package/src/icons/chevron-right.tsx +0 -37
- package/src/icons/chevrons-left.tsx +0 -37
- package/src/icons/chevrons-right.tsx +0 -37
- package/src/icons/clapperboard.tsx +0 -38
- package/src/icons/clock.tsx +0 -38
- package/src/icons/close.tsx +0 -37
- package/src/icons/code.tsx +0 -37
- package/src/icons/columns.tsx +0 -38
- package/src/icons/combo-flame.tsx +0 -38
- package/src/icons/company.tsx +0 -38
- package/src/icons/credit-card.tsx +0 -38
- package/src/icons/critical-star.tsx +0 -37
- package/src/icons/currency.tsx +0 -38
- package/src/icons/delete.tsx +0 -37
- package/src/icons/document.tsx +0 -38
- package/src/icons/download.tsx +0 -37
- package/src/icons/dpad.tsx +0 -38
- package/src/icons/edit.tsx +0 -38
- package/src/icons/element-fire.tsx +0 -37
- package/src/icons/element-ice.tsx +0 -38
- package/src/icons/element-solar.tsx +0 -38
- package/src/icons/element-void.tsx +0 -38
- package/src/icons/element-volt.tsx +0 -38
- package/src/icons/element-wind.tsx +0 -37
- package/src/icons/error.tsx +0 -38
- package/src/icons/external-link.tsx +0 -38
- package/src/icons/field.tsx +0 -38
- package/src/icons/file-spreadsheet.tsx +0 -38
- package/src/icons/filter.tsx +0 -37
- package/src/icons/gacha-ticket.tsx +0 -38
- package/src/icons/gamepad.tsx +0 -40
- package/src/icons/globe.tsx +0 -38
- package/src/icons/grid.tsx +0 -40
- package/src/icons/hash.tsx +0 -37
- package/src/icons/heart-hp.tsx +0 -38
- package/src/icons/history.tsx +0 -37
- package/src/icons/home.tsx +0 -37
- package/src/icons/image.tsx +0 -39
- package/src/icons/impact-slash.tsx +0 -38
- package/src/icons/inbox.tsx +0 -38
- package/src/icons/index.ts +0 -120
- package/src/icons/info.tsx +0 -38
- package/src/icons/jobs.tsx +0 -38
- package/src/icons/katana.tsx +0 -38
- package/src/icons/key.tsx +0 -38
- package/src/icons/keyboard.tsx +0 -38
- package/src/icons/keyframe-diamond.tsx +0 -38
- package/src/icons/knowledge.tsx +0 -38
- package/src/icons/language.tsx +0 -39
- package/src/icons/lock.tsx +0 -38
- package/src/icons/logout.tsx +0 -37
- package/src/icons/loot-chest.tsx +0 -39
- package/src/icons/mail.tsx +0 -38
- package/src/icons/mana-crystal.tsx +0 -38
- package/src/icons/map-pin.tsx +0 -38
- package/src/icons/mecha-helm.tsx +0 -38
- package/src/icons/menu.tsx +0 -37
- package/src/icons/message.tsx +0 -38
- package/src/icons/model.tsx +0 -38
- package/src/icons/moon.tsx +0 -37
- package/src/icons/notification.tsx +0 -38
- package/src/icons/partner.tsx +0 -41
- package/src/icons/pause.tsx +0 -37
- package/src/icons/phone.tsx +0 -37
- package/src/icons/play.tsx +0 -37
- package/src/icons/potion-flask.tsx +0 -40
- package/src/icons/quest-scroll.tsx +0 -39
- package/src/icons/radar-ping.tsx +0 -40
- package/src/icons/refresh.tsx +0 -38
- package/src/icons/relation.tsx +0 -40
- package/src/icons/save.tsx +0 -38
- package/src/icons/search.tsx +0 -38
- package/src/icons/security.tsx +0 -38
- package/src/icons/send.tsx +0 -38
- package/src/icons/settings.tsx +0 -39
- package/src/icons/shield-crest.tsx +0 -38
- package/src/icons/shuriken.tsx +0 -38
- package/src/icons/signal-off.tsx +0 -37
- package/src/icons/signal.tsx +0 -37
- package/src/icons/skill-node.tsx +0 -40
- package/src/icons/smartphone.tsx +0 -38
- package/src/icons/sort-ascending.tsx +0 -37
- package/src/icons/sort-descending.tsx +0 -37
- package/src/icons/sort.tsx +0 -37
- package/src/icons/sparkle.tsx +0 -38
- package/src/icons/speech-burst.tsx +0 -37
- package/src/icons/story.tsx +0 -37
- package/src/icons/sun.tsx +0 -38
- package/src/icons/tag.tsx +0 -38
- package/src/icons/team.tsx +0 -40
- package/src/icons/trophy-crown.tsx +0 -39
- package/src/icons/upload.tsx +0 -37
- package/src/icons/user.tsx +0 -38
- package/src/icons/users.tsx +0 -39
- package/src/icons/visibility-off.tsx +0 -38
- package/src/icons/visibility.tsx +0 -38
- package/src/icons/volume-off.tsx +0 -37
- package/src/icons/volume.tsx +0 -37
- package/src/icons/warning.tsx +0 -38
- package/src/icons/workflow.tsx +0 -40
- package/src/icons.tsx +0 -965
- package/src/index.ts +0 -89
- package/src/lib/asset-registry.ts +0 -534
- package/src/lib/audio-runtime.ts +0 -314
- package/src/lib/character-adapter.ts +0 -370
- package/src/lib/character-registry.ts +0 -2368
- package/src/lib/cn.ts +0 -6
- package/src/lib/compose-refs.ts +0 -16
- package/src/lib/sanitize-url.ts +0 -51
- package/src/lib/scene-camera.ts +0 -483
- package/src/lib/scene-playback.ts +0 -622
- package/src/lib/scene-soundscape.ts +0 -151
- package/src/lib/scene-test-harness.ts +0 -200
- package/src/lib/scene-timeline.ts +0 -398
- package/src/lib/use-animation-visibility.ts +0 -45
- package/src/lib/use-modal-focus.ts +0 -270
- package/src/lib/use-reduced-motion.ts +0 -37
- package/src/motion/easing-presets.ts +0 -262
- package/src/motion/index.tsx +0 -894
- package/src/motion/physics.ts +0 -259
- package/src/motion/timeline-math.ts +0 -358
- package/src/motion.tsx +0 -639
- package/src/pixelfx-boundary.ts +0 -188
- package/src/pixelfx-registry.ts +0 -1190
- package/src/pixelfx-types.d.ts +0 -73
- package/src/pixelfx.tsx +0 -1022
- package/src/provider.tsx +0 -63
- package/src/skin-catalog.ts +0 -306
- package/src/skin-tokens.ts +0 -425
- package/src/ssr/init-script.ts +0 -281
- package/src/ssr/resolve-skin.ts +0 -217
- package/src/ssr/theme-mismatch-dev.ts +0 -181
- package/src/templates/battle-arena.tsx +0 -688
- package/src/templates/index.tsx +0 -314
- package/src/templates.tsx +0 -225
- package/src/themes/dna-presets.ts +0 -119
- package/src/themes/index.ts +0 -56
- package/src/themes/provider.tsx +0 -183
- package/src/themes/types.ts +0 -111
- package/src/themes.ts +0 -9
- package/src/token-exporter.ts +0 -12
- package/src/token-exporters.ts +0 -343
- package/src/token-seeds.ts +0 -335
- package/src/token-snapshot.ts +0 -179
- package/src/utils.ts +0 -58
package/src/dna.tsx
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import type { SkinDensity, SkinId } from "./themes.js";
|
|
3
|
-
import type { MotionProfile } from "./motion.js";
|
|
4
|
-
|
|
5
|
-
export type GenreDnaPresetId =
|
|
6
|
-
| "shonen-anime"
|
|
7
|
-
| "tactical-hud"
|
|
8
|
-
| "zine-riot"
|
|
9
|
-
| "cozy-story";
|
|
10
|
-
|
|
11
|
-
export interface GenreDnaPreset {
|
|
12
|
-
readonly id: GenreDnaPresetId;
|
|
13
|
-
readonly label: string;
|
|
14
|
-
readonly description: string;
|
|
15
|
-
readonly skin: SkinId;
|
|
16
|
-
readonly mode: "light" | "dark" | "high-contrast";
|
|
17
|
-
readonly density: SkinDensity;
|
|
18
|
-
readonly motionProfile: MotionProfile;
|
|
19
|
-
readonly dnaAttribute: GenreDnaPresetId;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const GENRE_DNA_PRESETS: readonly GenreDnaPreset[] = [
|
|
23
|
-
{
|
|
24
|
-
id: "zine-riot",
|
|
25
|
-
label: "Zine Riot",
|
|
26
|
-
description: "Neo-Manga paper cream, bold ink frames, and punchy magenta stamps.",
|
|
27
|
-
skin: "moonwitness-ink",
|
|
28
|
-
mode: "light",
|
|
29
|
-
density: "comfortable",
|
|
30
|
-
motionProfile: "expressive",
|
|
31
|
-
dnaAttribute: "zine-riot",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: "shonen-anime",
|
|
35
|
-
label: "Shonen Anime",
|
|
36
|
-
description: "Heavy cel borders, 12fps cartoon cadence, and diagonal speedlines.",
|
|
37
|
-
skin: "cartoon-pop",
|
|
38
|
-
mode: "dark",
|
|
39
|
-
density: "comfortable",
|
|
40
|
-
motionProfile: "cartoon",
|
|
41
|
-
dnaAttribute: "shonen-anime",
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: "tactical-hud",
|
|
45
|
-
label: "Tactical HUD",
|
|
46
|
-
description: "Compact arcade-neon dark cockpit with razor focus accents.",
|
|
47
|
-
skin: "arcade-neon",
|
|
48
|
-
mode: "dark",
|
|
49
|
-
density: "compact",
|
|
50
|
-
motionProfile: "subtle",
|
|
51
|
-
dnaAttribute: "tactical-hud",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
id: "cozy-story",
|
|
55
|
-
label: "Cozy RPG",
|
|
56
|
-
description: "Warm story-book surfaces with gentle responsive spring motion.",
|
|
57
|
-
skin: "cozy-rpg",
|
|
58
|
-
mode: "light",
|
|
59
|
-
density: "comfortable",
|
|
60
|
-
motionProfile: "subtle",
|
|
61
|
-
dnaAttribute: "cozy-story",
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
export function applyGenreDnaAttribute(dna: GenreDnaPresetId | null): void {
|
|
66
|
-
if (typeof document === "undefined") return;
|
|
67
|
-
if (!dna) {
|
|
68
|
-
delete document.documentElement.dataset.dna;
|
|
69
|
-
} else {
|
|
70
|
-
document.documentElement.dataset.dna = dna;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export type DnaIconTreatment = "wireframe" | "cel-ink" | "duotone" | "sticker";
|
|
75
|
-
export type DnaIconTone =
|
|
76
|
-
| "primary"
|
|
77
|
-
| "magenta"
|
|
78
|
-
| "cyan"
|
|
79
|
-
| "violet"
|
|
80
|
-
| "success"
|
|
81
|
-
| "warning"
|
|
82
|
-
| "error"
|
|
83
|
-
| "neutral";
|
|
84
|
-
|
|
85
|
-
const TONE_MAP: Record<DnaIconTone, { bg: string; fg: string }> = {
|
|
86
|
-
primary: { bg: "var(--mw-primary)", fg: "var(--mw-primary-foreground)" },
|
|
87
|
-
magenta: { bg: "var(--mw-magenta)", fg: "var(--mw-on-magenta)" },
|
|
88
|
-
cyan: { bg: "var(--mw-cyan)", fg: "var(--mw-on-accent)" },
|
|
89
|
-
violet: { bg: "var(--mw-violet)", fg: "var(--mw-on-magenta)" },
|
|
90
|
-
success: { bg: "var(--mw-success)", fg: "var(--mw-on-success)" },
|
|
91
|
-
warning: { bg: "var(--mw-warning)", fg: "var(--mw-on-warning)" },
|
|
92
|
-
error: { bg: "var(--mw-destructive)", fg: "var(--mw-destructive-foreground)" },
|
|
93
|
-
neutral: { bg: "var(--mw-muted)", fg: "var(--mw-foreground)" },
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const SIZE_MAP = {
|
|
97
|
-
sm: 30,
|
|
98
|
-
md: 38,
|
|
99
|
-
lg: 46,
|
|
100
|
-
} as const;
|
|
101
|
-
|
|
102
|
-
export function DnaIcon({
|
|
103
|
-
treatment = "cel-ink",
|
|
104
|
-
tone = "magenta",
|
|
105
|
-
size = "md",
|
|
106
|
-
label,
|
|
107
|
-
className,
|
|
108
|
-
children,
|
|
109
|
-
}: {
|
|
110
|
-
treatment?: DnaIconTreatment;
|
|
111
|
-
tone?: DnaIconTone;
|
|
112
|
-
size?: "sm" | "md" | "lg";
|
|
113
|
-
label?: string;
|
|
114
|
-
className?: string;
|
|
115
|
-
children: ReactNode;
|
|
116
|
-
}) {
|
|
117
|
-
const palette = TONE_MAP[tone];
|
|
118
|
-
const px = SIZE_MAP[size];
|
|
119
|
-
const isFilled = treatment === "cel-ink" || treatment === "sticker";
|
|
120
|
-
return (
|
|
121
|
-
<span
|
|
122
|
-
className={className ? `mw-ui-dna-icon ${className}` : "mw-ui-dna-icon"}
|
|
123
|
-
data-treatment={treatment}
|
|
124
|
-
data-tone={tone}
|
|
125
|
-
role={label ? "img" : undefined}
|
|
126
|
-
aria-label={label}
|
|
127
|
-
style={{
|
|
128
|
-
width: px,
|
|
129
|
-
height: px,
|
|
130
|
-
backgroundColor: isFilled ? palette.bg : undefined,
|
|
131
|
-
color: isFilled ? palette.fg : palette.bg,
|
|
132
|
-
}}
|
|
133
|
-
>
|
|
134
|
-
{children}
|
|
135
|
-
</span>
|
|
136
|
-
);
|
|
137
|
-
}
|
package/src/game/boss-hud.tsx
DELETED
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
forwardRef,
|
|
5
|
-
useEffect,
|
|
6
|
-
useRef,
|
|
7
|
-
useState,
|
|
8
|
-
type ComponentPropsWithoutRef,
|
|
9
|
-
} from "react";
|
|
10
|
-
import { cn } from "../lib/cn.js";
|
|
11
|
-
import { getCharacterById } from "../lib/character-registry.js";
|
|
12
|
-
import { BossSkullIcon } from "../icons/boss-skull.js";
|
|
13
|
-
import { TrophyCrownIcon } from "../icons/trophy-crown.js";
|
|
14
|
-
import { AnimeCharacterSvg } from "../cartoon/anime-avatar.js";
|
|
15
|
-
import { clampUnit, useMotion } from "../motion/index.js";
|
|
16
|
-
|
|
17
|
-
export type BossHealthBarProps = ComponentPropsWithoutRef<"section"> & {
|
|
18
|
-
characterId?: string;
|
|
19
|
-
name?: string;
|
|
20
|
-
title?: string;
|
|
21
|
-
hp: number;
|
|
22
|
-
maxHp: number;
|
|
23
|
-
phases?: number;
|
|
24
|
-
stagger?: number; // 0..100
|
|
25
|
-
broken?: boolean;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const BossHealthBar = forwardRef<HTMLElement, BossHealthBarProps>(
|
|
29
|
-
function BossHealthBar(
|
|
30
|
-
{
|
|
31
|
-
characterId = "lord-null",
|
|
32
|
-
name,
|
|
33
|
-
title,
|
|
34
|
-
hp,
|
|
35
|
-
maxHp,
|
|
36
|
-
phases = 3,
|
|
37
|
-
stagger = 0,
|
|
38
|
-
broken = false,
|
|
39
|
-
className,
|
|
40
|
-
...props
|
|
41
|
-
},
|
|
42
|
-
ref,
|
|
43
|
-
) {
|
|
44
|
-
const { reducedMotion, triggerSfx } = useMotion();
|
|
45
|
-
const profile = getCharacterById(characterId);
|
|
46
|
-
const safeMax = Math.max(1, maxHp);
|
|
47
|
-
const clampedHp = Math.min(safeMax, Math.max(0, hp));
|
|
48
|
-
const safePhases = Math.max(1, Math.min(5, Math.round(phases)));
|
|
49
|
-
const phaseSize = safeMax / safePhases;
|
|
50
|
-
const remainingPhases =
|
|
51
|
-
clampedHp <= 0 ? 0 : Math.ceil(clampedHp / phaseSize);
|
|
52
|
-
const currentPhaseHp =
|
|
53
|
-
clampedHp <= 0 ? 0 : clampedHp - (remainingPhases - 1) * phaseSize;
|
|
54
|
-
const currentPhaseRatio = clampUnit(currentPhaseHp / phaseSize);
|
|
55
|
-
const staggerPct = Math.round(clampUnit(stagger / 100) * 100);
|
|
56
|
-
|
|
57
|
-
const [phaseBreakFlash, setPhaseBreakFlash] = useState(false);
|
|
58
|
-
const prevPhaseRef = useRef(remainingPhases);
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
const prev = prevPhaseRef.current;
|
|
62
|
-
prevPhaseRef.current = remainingPhases;
|
|
63
|
-
if (remainingPhases < prev && !reducedMotion) {
|
|
64
|
-
setPhaseBreakFlash(true);
|
|
65
|
-
triggerSfx("boss-break");
|
|
66
|
-
const timer = window.setTimeout(() => setPhaseBreakFlash(false), 360);
|
|
67
|
-
return () => window.clearTimeout(timer);
|
|
68
|
-
}
|
|
69
|
-
return undefined;
|
|
70
|
-
}, [remainingPhases, reducedMotion, triggerSfx]);
|
|
71
|
-
|
|
72
|
-
const resolvedName = name ?? profile?.name ?? "ECLIPSE OVERLORD";
|
|
73
|
-
const resolvedTitle = title ?? profile?.title ?? "Multi-Phase Raid Boss";
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<section
|
|
77
|
-
ref={ref}
|
|
78
|
-
aria-label={`${resolvedName} boss status`}
|
|
79
|
-
data-slot="boss-health-bar"
|
|
80
|
-
data-phase={remainingPhases}
|
|
81
|
-
data-broken={broken ? "true" : "false"}
|
|
82
|
-
data-phase-flash={phaseBreakFlash ? "true" : "false"}
|
|
83
|
-
className={cn("mw-ui-boss-hud", className)}
|
|
84
|
-
{...props}
|
|
85
|
-
>
|
|
86
|
-
<div className="mw-ui-boss-hud-portrait">
|
|
87
|
-
<AnimeCharacterSvg
|
|
88
|
-
characterId={characterId}
|
|
89
|
-
mood={clampedHp <= 0 ? "ko" : broken ? "surprised" : "angry"}
|
|
90
|
-
phoneme={phaseBreakFlash ? "wide" : "closed"}
|
|
91
|
-
/>
|
|
92
|
-
</div>
|
|
93
|
-
<div className="mw-ui-boss-hud-main">
|
|
94
|
-
<div className="mw-ui-boss-hud-head">
|
|
95
|
-
<div className="mw-ui-boss-hud-ident">
|
|
96
|
-
<BossSkullIcon size={16} aria-hidden="true" />
|
|
97
|
-
<strong className="mw-ui-boss-hud-name">{resolvedName}</strong>
|
|
98
|
-
<span className="mw-ui-boss-hud-title">{resolvedTitle}</span>
|
|
99
|
-
</div>
|
|
100
|
-
<div
|
|
101
|
-
className="mw-ui-boss-hud-phases"
|
|
102
|
-
aria-label={`Phase ${remainingPhases} of ${safePhases}`}
|
|
103
|
-
>
|
|
104
|
-
{Array.from({ length: safePhases }).map((_, idx) => (
|
|
105
|
-
<span
|
|
106
|
-
key={idx}
|
|
107
|
-
className="mw-ui-boss-phase-pip"
|
|
108
|
-
data-filled={idx < remainingPhases ? "true" : "false"}
|
|
109
|
-
/>
|
|
110
|
-
))}
|
|
111
|
-
<span className="mw-ui-boss-hp-readout">
|
|
112
|
-
{Math.round(clampedHp)} / {Math.round(safeMax)}
|
|
113
|
-
</span>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
|
|
117
|
-
<div
|
|
118
|
-
role="progressbar"
|
|
119
|
-
aria-label={`${resolvedName} HP`}
|
|
120
|
-
aria-valuemin={0}
|
|
121
|
-
aria-valuemax={safeMax}
|
|
122
|
-
aria-valuenow={Math.round(clampedHp)}
|
|
123
|
-
className="mw-ui-boss-hp-track"
|
|
124
|
-
>
|
|
125
|
-
{remainingPhases > 1 ? (
|
|
126
|
-
<div className="mw-ui-boss-hp-underlay" aria-hidden="true" />
|
|
127
|
-
) : null}
|
|
128
|
-
<div
|
|
129
|
-
className="mw-ui-boss-hp-fill"
|
|
130
|
-
style={{ width: `${Math.round(currentPhaseRatio * 1000) / 10}%` }}
|
|
131
|
-
/>
|
|
132
|
-
</div>
|
|
133
|
-
|
|
134
|
-
<div className="mw-ui-boss-stagger-row">
|
|
135
|
-
<span className="mw-ui-boss-stagger-label">
|
|
136
|
-
{broken ? "STAGGER BREAK!" : "STAGGER"}
|
|
137
|
-
</span>
|
|
138
|
-
<div className="mw-ui-boss-stagger-track" aria-hidden="true">
|
|
139
|
-
<div
|
|
140
|
-
className="mw-ui-boss-stagger-fill"
|
|
141
|
-
style={{ width: `${staggerPct}%` }}
|
|
142
|
-
/>
|
|
143
|
-
</div>
|
|
144
|
-
<span className="mw-ui-boss-stagger-pct">{staggerPct}%</span>
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
147
|
-
</section>
|
|
148
|
-
);
|
|
149
|
-
},
|
|
150
|
-
);
|
|
151
|
-
BossHealthBar.displayName = "BossHealthBar";
|
|
152
|
-
|
|
153
|
-
export interface TurnOrderEntry {
|
|
154
|
-
readonly id: string;
|
|
155
|
-
readonly characterId: string;
|
|
156
|
-
readonly team: "ally" | "enemy";
|
|
157
|
-
readonly actionValue: number;
|
|
158
|
-
readonly label?: string;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export type TurnOrderStripProps = ComponentPropsWithoutRef<"div"> & {
|
|
162
|
-
entries: readonly TurnOrderEntry[];
|
|
163
|
-
activeId?: string;
|
|
164
|
-
onSelectEntry?: (entry: TurnOrderEntry) => void;
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
export const TurnOrderStrip = forwardRef<HTMLDivElement, TurnOrderStripProps>(
|
|
168
|
-
function TurnOrderStrip(
|
|
169
|
-
{ entries, activeId, onSelectEntry, className, ...props },
|
|
170
|
-
ref,
|
|
171
|
-
) {
|
|
172
|
-
return (
|
|
173
|
-
<div
|
|
174
|
-
ref={ref}
|
|
175
|
-
role="list"
|
|
176
|
-
aria-label="Turn order queue"
|
|
177
|
-
data-slot="turn-order-strip"
|
|
178
|
-
className={cn("mw-ui-turn-strip", className)}
|
|
179
|
-
{...props}
|
|
180
|
-
>
|
|
181
|
-
<span className="mw-ui-turn-strip-tag">ATB ORDER</span>
|
|
182
|
-
<div className="mw-ui-turn-strip-list">
|
|
183
|
-
{entries.map((entry, idx) => {
|
|
184
|
-
const profile = getCharacterById(entry.characterId);
|
|
185
|
-
const isActive = activeId ? entry.id === activeId : idx === 0;
|
|
186
|
-
return (
|
|
187
|
-
<button
|
|
188
|
-
key={entry.id}
|
|
189
|
-
type="button"
|
|
190
|
-
role="listitem"
|
|
191
|
-
data-team={entry.team}
|
|
192
|
-
data-active={isActive ? "true" : "false"}
|
|
193
|
-
className="mw-ui-turn-node"
|
|
194
|
-
onClick={() => onSelectEntry?.(entry)}
|
|
195
|
-
>
|
|
196
|
-
<span className="mw-ui-turn-avatar">
|
|
197
|
-
<AnimeCharacterSvg
|
|
198
|
-
characterId={entry.characterId}
|
|
199
|
-
mood={isActive ? "determined" : "neutral"}
|
|
200
|
-
phoneme="closed"
|
|
201
|
-
/>
|
|
202
|
-
</span>
|
|
203
|
-
<span className="mw-ui-turn-meta">
|
|
204
|
-
<strong>
|
|
205
|
-
{entry.label ?? profile?.name ?? entry.characterId}
|
|
206
|
-
</strong>
|
|
207
|
-
<small>AV {entry.actionValue}</small>
|
|
208
|
-
</span>
|
|
209
|
-
</button>
|
|
210
|
-
);
|
|
211
|
-
})}
|
|
212
|
-
</div>
|
|
213
|
-
</div>
|
|
214
|
-
);
|
|
215
|
-
},
|
|
216
|
-
);
|
|
217
|
-
TurnOrderStrip.displayName = "TurnOrderStrip";
|
|
218
|
-
|
|
219
|
-
export type LootRarity = "common" | "rare" | "epic" | "legendary" | "mythic";
|
|
220
|
-
|
|
221
|
-
export type LootRevealCardProps = ComponentPropsWithoutRef<"div"> & {
|
|
222
|
-
characterId?: string;
|
|
223
|
-
title?: string;
|
|
224
|
-
subtitle?: string;
|
|
225
|
-
rarity?: LootRarity;
|
|
226
|
-
revealed?: boolean;
|
|
227
|
-
defaultRevealed?: boolean;
|
|
228
|
-
onRevealChange?: (revealed: boolean) => void;
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
export const LootRevealCard = forwardRef<HTMLDivElement, LootRevealCardProps>(
|
|
232
|
-
function LootRevealCard(
|
|
233
|
-
{
|
|
234
|
-
characterId = "kuro-signal",
|
|
235
|
-
title,
|
|
236
|
-
subtitle,
|
|
237
|
-
rarity,
|
|
238
|
-
revealed: controlledRevealed,
|
|
239
|
-
defaultRevealed = false,
|
|
240
|
-
onRevealChange,
|
|
241
|
-
className,
|
|
242
|
-
...props
|
|
243
|
-
},
|
|
244
|
-
ref,
|
|
245
|
-
) {
|
|
246
|
-
const { triggerSfx } = useMotion();
|
|
247
|
-
const [uncontrolledRevealed, setUncontrolledRevealed] =
|
|
248
|
-
useState(defaultRevealed);
|
|
249
|
-
const revealed = controlledRevealed ?? uncontrolledRevealed;
|
|
250
|
-
const profile = getCharacterById(characterId);
|
|
251
|
-
const resolvedRarity: LootRarity = rarity ?? profile?.rarity ?? "legendary";
|
|
252
|
-
const resolvedTitle = title ?? profile?.name ?? "MYTHIC RELIC";
|
|
253
|
-
const resolvedSub =
|
|
254
|
-
subtitle ??
|
|
255
|
-
(profile
|
|
256
|
-
? `${profile.title} · ${profile.element.toUpperCase()}`
|
|
257
|
-
: "RARE DROP");
|
|
258
|
-
|
|
259
|
-
const handleToggle = () => {
|
|
260
|
-
const next = !revealed;
|
|
261
|
-
setUncontrolledRevealed(next);
|
|
262
|
-
onRevealChange?.(next);
|
|
263
|
-
if (next) triggerSfx("gacha-fanfare");
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
return (
|
|
267
|
-
<div
|
|
268
|
-
ref={ref}
|
|
269
|
-
data-slot="loot-reveal-card"
|
|
270
|
-
data-rarity={resolvedRarity}
|
|
271
|
-
data-revealed={revealed ? "true" : "false"}
|
|
272
|
-
className={cn("mw-ui-loot-card", className)}
|
|
273
|
-
{...props}
|
|
274
|
-
>
|
|
275
|
-
<button
|
|
276
|
-
type="button"
|
|
277
|
-
className="mw-ui-loot-card-trigger"
|
|
278
|
-
aria-pressed={revealed}
|
|
279
|
-
onClick={handleToggle}
|
|
280
|
-
>
|
|
281
|
-
{!revealed ? (
|
|
282
|
-
<span className="mw-ui-loot-card-back">
|
|
283
|
-
<span className="mw-ui-loot-card-rarity">
|
|
284
|
-
{resolvedRarity.toUpperCase()}
|
|
285
|
-
</span>
|
|
286
|
-
<strong className="mw-ui-loot-card-seal">SUMMON CAPSULE</strong>
|
|
287
|
-
<small>Click to reveal drop</small>
|
|
288
|
-
</span>
|
|
289
|
-
) : (
|
|
290
|
-
<span className="mw-ui-loot-card-front">
|
|
291
|
-
<span className="mw-ui-loot-card-foil" aria-hidden="true" />
|
|
292
|
-
<span className="mw-ui-loot-card-rarity">
|
|
293
|
-
{resolvedRarity.toUpperCase()}
|
|
294
|
-
</span>
|
|
295
|
-
<span className="mw-ui-loot-card-art">
|
|
296
|
-
<AnimeCharacterSvg
|
|
297
|
-
characterId={characterId}
|
|
298
|
-
mood="happy"
|
|
299
|
-
phoneme="closed"
|
|
300
|
-
/>
|
|
301
|
-
</span>
|
|
302
|
-
<strong className="mw-ui-loot-card-name">{resolvedTitle}</strong>
|
|
303
|
-
<small className="mw-ui-loot-card-sub">{resolvedSub}</small>
|
|
304
|
-
{profile ? (
|
|
305
|
-
<span className="mw-ui-loot-card-stats">
|
|
306
|
-
<span>ATK {profile.stats.atk}</span>
|
|
307
|
-
<span>SPD {profile.stats.spd}</span>
|
|
308
|
-
</span>
|
|
309
|
-
) : null}
|
|
310
|
-
</span>
|
|
311
|
-
)}
|
|
312
|
-
</button>
|
|
313
|
-
</div>
|
|
314
|
-
);
|
|
315
|
-
},
|
|
316
|
-
);
|
|
317
|
-
LootRevealCard.displayName = "LootRevealCard";
|
|
318
|
-
|
|
319
|
-
export type AchievementToastProps = ComponentPropsWithoutRef<"div"> & {
|
|
320
|
-
open: boolean;
|
|
321
|
-
title: string;
|
|
322
|
-
description: string;
|
|
323
|
-
points?: number;
|
|
324
|
-
rarity?: LootRarity;
|
|
325
|
-
onDismiss?: () => void;
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
export const AchievementToast = forwardRef<
|
|
329
|
-
HTMLDivElement,
|
|
330
|
-
AchievementToastProps
|
|
331
|
-
>(function AchievementToast(
|
|
332
|
-
{
|
|
333
|
-
open,
|
|
334
|
-
title,
|
|
335
|
-
description,
|
|
336
|
-
points = 150,
|
|
337
|
-
rarity = "legendary",
|
|
338
|
-
onDismiss,
|
|
339
|
-
className,
|
|
340
|
-
...props
|
|
341
|
-
},
|
|
342
|
-
ref,
|
|
343
|
-
) {
|
|
344
|
-
const { triggerSfx } = useMotion();
|
|
345
|
-
|
|
346
|
-
useEffect(() => {
|
|
347
|
-
if (open) triggerSfx("trophy-unlock");
|
|
348
|
-
}, [open, triggerSfx]);
|
|
349
|
-
|
|
350
|
-
if (!open) return null;
|
|
351
|
-
|
|
352
|
-
return (
|
|
353
|
-
<div
|
|
354
|
-
ref={ref}
|
|
355
|
-
role="status"
|
|
356
|
-
aria-live="polite"
|
|
357
|
-
data-slot="achievement-toast"
|
|
358
|
-
data-rarity={rarity}
|
|
359
|
-
className={cn("mw-ui-trophy-toast", className)}
|
|
360
|
-
{...props}
|
|
361
|
-
>
|
|
362
|
-
<span className="mw-ui-trophy-toast-icon" aria-hidden="true">
|
|
363
|
-
<TrophyCrownIcon size={20} aria-hidden="true" />
|
|
364
|
-
</span>
|
|
365
|
-
<div className="mw-ui-trophy-toast-copy">
|
|
366
|
-
<span className="mw-ui-trophy-toast-eyebrow">
|
|
367
|
-
ACHIEVEMENT UNLOCKED · +{points} XP
|
|
368
|
-
</span>
|
|
369
|
-
<strong>{title}</strong>
|
|
370
|
-
<small>{description}</small>
|
|
371
|
-
</div>
|
|
372
|
-
{onDismiss ? (
|
|
373
|
-
<button
|
|
374
|
-
type="button"
|
|
375
|
-
className="mw-ui-game-mini-btn"
|
|
376
|
-
onClick={onDismiss}
|
|
377
|
-
>
|
|
378
|
-
Dismiss
|
|
379
|
-
</button>
|
|
380
|
-
) : null}
|
|
381
|
-
</div>
|
|
382
|
-
);
|
|
383
|
-
});
|
|
384
|
-
AchievementToast.displayName = "AchievementToast";
|