@moonwitness/ui 7.3.1 → 8.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.
Files changed (260) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +2 -3
  3. package/scripts/consumer-smoke.mjs +0 -45
  4. package/scripts/generate-icons.mjs +0 -110
  5. package/scripts/generate-token-artifacts.mjs +0 -90
  6. package/scripts/icon-svg-to-jsx.mjs +0 -249
  7. package/scripts/verification-diagnostics.mjs +0 -40
  8. package/scripts/verify-package.mjs +0 -412
  9. package/src/cartoon/anime-avatar.tsx +0 -628
  10. package/src/cartoon/anime-stage.tsx +0 -458
  11. package/src/cartoon/index.tsx +0 -542
  12. package/src/cartoon.tsx +0 -645
  13. package/src/characters.ts +0 -625
  14. package/src/components/accordion.tsx +0 -77
  15. package/src/components/alert.tsx +0 -139
  16. package/src/components/appearance-menu.tsx +0 -181
  17. package/src/components/artwork-frame.tsx +0 -49
  18. package/src/components/audio.tsx +0 -97
  19. package/src/components/avatar.tsx +0 -75
  20. package/src/components/badge.tsx +0 -94
  21. package/src/components/brand-mark.tsx +0 -73
  22. package/src/components/breadcrumbs.tsx +0 -98
  23. package/src/components/button.tsx +0 -340
  24. package/src/components/card.tsx +0 -171
  25. package/src/components/character-badge.tsx +0 -58
  26. package/src/components/character-preview.tsx +0 -104
  27. package/src/components/character-stage.tsx +0 -225
  28. package/src/components/chart.tsx +0 -481
  29. package/src/components/checkbox.tsx +0 -64
  30. package/src/components/comic-panel.tsx +0 -301
  31. package/src/components/comic-theater.tsx +0 -170
  32. package/src/components/command.tsx +0 -189
  33. package/src/components/confirm-dialog.tsx +0 -129
  34. package/src/components/copy-button.tsx +0 -62
  35. package/src/components/date-picker.tsx +0 -126
  36. package/src/components/dialog.tsx +0 -164
  37. package/src/components/dna-icon.tsx +0 -77
  38. package/src/components/dropdown-menu.tsx +0 -87
  39. package/src/components/effects.tsx +0 -1021
  40. package/src/components/empty-state.tsx +0 -93
  41. package/src/components/epistemic-branch-panel.tsx +0 -101
  42. package/src/components/error-state.tsx +0 -137
  43. package/src/components/field.tsx +0 -96
  44. package/src/components/filter-facet-bar.tsx +0 -91
  45. package/src/components/inbox-popover.tsx +0 -146
  46. package/src/components/input.tsx +0 -25
  47. package/src/components/kanban-board.tsx +0 -190
  48. package/src/components/label.tsx +0 -19
  49. package/src/components/layered-scene.tsx +0 -555
  50. package/src/components/log-console.tsx +0 -261
  51. package/src/components/metric-tile.tsx +0 -99
  52. package/src/components/mode-picker.tsx +0 -149
  53. package/src/components/motion-timeline.tsx +0 -848
  54. package/src/components/number-input.tsx +0 -104
  55. package/src/components/page-header.tsx +0 -123
  56. package/src/components/pagination.tsx +0 -83
  57. package/src/components/panel.tsx +0 -121
  58. package/src/components/paper-note.tsx +0 -77
  59. package/src/components/popover.tsx +0 -72
  60. package/src/components/progress.tsx +0 -127
  61. package/src/components/quest-card.tsx +0 -319
  62. package/src/components/radio-group.tsx +0 -50
  63. package/src/components/riot-sticker.tsx +0 -151
  64. package/src/components/scene-particles.tsx +0 -196
  65. package/src/components/scene-transitions.tsx +0 -130
  66. package/src/components/section-ribbon.tsx +0 -94
  67. package/src/components/select-field.tsx +0 -27
  68. package/src/components/select.tsx +0 -81
  69. package/src/components/separator.tsx +0 -58
  70. package/src/components/sheet.tsx +0 -96
  71. package/src/components/skeleton.tsx +0 -35
  72. package/src/components/sketch-annotation.tsx +0 -87
  73. package/src/components/smart-button-box.tsx +0 -114
  74. package/src/components/speech-bubble.tsx +0 -116
  75. package/src/components/spinner.tsx +0 -69
  76. package/src/components/sprite-player.tsx +0 -412
  77. package/src/components/status-bar.tsx +0 -63
  78. package/src/components/status-pill.tsx +0 -68
  79. package/src/components/switch.tsx +0 -76
  80. package/src/components/table.tsx +0 -163
  81. package/src/components/tabs.tsx +0 -101
  82. package/src/components/tag-input.tsx +0 -170
  83. package/src/components/textarea.tsx +0 -25
  84. package/src/components/toast.tsx +0 -14
  85. package/src/components/toolbar.tsx +0 -39
  86. package/src/components/tooltip.tsx +0 -49
  87. package/src/components/update-banner.tsx +0 -220
  88. package/src/components/xv-primitives.tsx +0 -256
  89. package/src/css-exports.ts +0 -142
  90. package/src/dna.tsx +0 -137
  91. package/src/game/boss-hud.tsx +0 -384
  92. package/src/game/index.tsx +0 -886
  93. package/src/game/tactical.tsx +0 -245
  94. package/src/game.tsx +0 -770
  95. package/src/icons/activity.tsx +0 -38
  96. package/src/icons/add.tsx +0 -38
  97. package/src/icons/addon.tsx +0 -37
  98. package/src/icons/anime-anger.tsx +0 -37
  99. package/src/icons/anime-shock.tsx +0 -37
  100. package/src/icons/anime-sparkle.tsx +0 -38
  101. package/src/icons/anime-sweatdrop.tsx +0 -38
  102. package/src/icons/archive.tsx +0 -37
  103. package/src/icons/arrow-left.tsx +0 -37
  104. package/src/icons/arrow-right.tsx +0 -37
  105. package/src/icons/attachment.tsx +0 -38
  106. package/src/icons/bank.tsx +0 -37
  107. package/src/icons/bolt.tsx +0 -37
  108. package/src/icons/book-open.tsx +0 -37
  109. package/src/icons/bookmark.tsx +0 -37
  110. package/src/icons/boss-skull.tsx +0 -40
  111. package/src/icons/calendar-clock.tsx +0 -40
  112. package/src/icons/calendar.tsx +0 -38
  113. package/src/icons/check-circle.tsx +0 -38
  114. package/src/icons/check-square.tsx +0 -38
  115. package/src/icons/check.tsx +0 -37
  116. package/src/icons/chevron-right.tsx +0 -37
  117. package/src/icons/chevrons-left.tsx +0 -37
  118. package/src/icons/chevrons-right.tsx +0 -37
  119. package/src/icons/clapperboard.tsx +0 -38
  120. package/src/icons/clock.tsx +0 -38
  121. package/src/icons/close.tsx +0 -37
  122. package/src/icons/code.tsx +0 -37
  123. package/src/icons/columns.tsx +0 -38
  124. package/src/icons/combo-flame.tsx +0 -38
  125. package/src/icons/company.tsx +0 -38
  126. package/src/icons/credit-card.tsx +0 -38
  127. package/src/icons/critical-star.tsx +0 -37
  128. package/src/icons/currency.tsx +0 -38
  129. package/src/icons/delete.tsx +0 -37
  130. package/src/icons/document.tsx +0 -38
  131. package/src/icons/download.tsx +0 -37
  132. package/src/icons/dpad.tsx +0 -38
  133. package/src/icons/edit.tsx +0 -38
  134. package/src/icons/element-fire.tsx +0 -37
  135. package/src/icons/element-ice.tsx +0 -38
  136. package/src/icons/element-solar.tsx +0 -38
  137. package/src/icons/element-void.tsx +0 -38
  138. package/src/icons/element-volt.tsx +0 -38
  139. package/src/icons/element-wind.tsx +0 -37
  140. package/src/icons/error.tsx +0 -38
  141. package/src/icons/external-link.tsx +0 -38
  142. package/src/icons/field.tsx +0 -38
  143. package/src/icons/file-spreadsheet.tsx +0 -38
  144. package/src/icons/filter.tsx +0 -37
  145. package/src/icons/gacha-ticket.tsx +0 -38
  146. package/src/icons/gamepad.tsx +0 -40
  147. package/src/icons/globe.tsx +0 -38
  148. package/src/icons/grid.tsx +0 -40
  149. package/src/icons/hash.tsx +0 -37
  150. package/src/icons/heart-hp.tsx +0 -38
  151. package/src/icons/history.tsx +0 -37
  152. package/src/icons/home.tsx +0 -37
  153. package/src/icons/image.tsx +0 -39
  154. package/src/icons/impact-slash.tsx +0 -38
  155. package/src/icons/inbox.tsx +0 -38
  156. package/src/icons/index.ts +0 -120
  157. package/src/icons/info.tsx +0 -38
  158. package/src/icons/jobs.tsx +0 -38
  159. package/src/icons/katana.tsx +0 -38
  160. package/src/icons/key.tsx +0 -38
  161. package/src/icons/keyboard.tsx +0 -38
  162. package/src/icons/keyframe-diamond.tsx +0 -38
  163. package/src/icons/knowledge.tsx +0 -38
  164. package/src/icons/language.tsx +0 -39
  165. package/src/icons/lock.tsx +0 -38
  166. package/src/icons/logout.tsx +0 -37
  167. package/src/icons/loot-chest.tsx +0 -39
  168. package/src/icons/mail.tsx +0 -38
  169. package/src/icons/mana-crystal.tsx +0 -38
  170. package/src/icons/map-pin.tsx +0 -38
  171. package/src/icons/mecha-helm.tsx +0 -38
  172. package/src/icons/menu.tsx +0 -37
  173. package/src/icons/message.tsx +0 -38
  174. package/src/icons/model.tsx +0 -38
  175. package/src/icons/moon.tsx +0 -37
  176. package/src/icons/notification.tsx +0 -38
  177. package/src/icons/partner.tsx +0 -41
  178. package/src/icons/pause.tsx +0 -37
  179. package/src/icons/phone.tsx +0 -37
  180. package/src/icons/play.tsx +0 -37
  181. package/src/icons/potion-flask.tsx +0 -40
  182. package/src/icons/quest-scroll.tsx +0 -39
  183. package/src/icons/radar-ping.tsx +0 -40
  184. package/src/icons/refresh.tsx +0 -38
  185. package/src/icons/relation.tsx +0 -40
  186. package/src/icons/save.tsx +0 -38
  187. package/src/icons/search.tsx +0 -38
  188. package/src/icons/security.tsx +0 -38
  189. package/src/icons/send.tsx +0 -38
  190. package/src/icons/settings.tsx +0 -39
  191. package/src/icons/shield-crest.tsx +0 -38
  192. package/src/icons/shuriken.tsx +0 -38
  193. package/src/icons/signal-off.tsx +0 -37
  194. package/src/icons/signal.tsx +0 -37
  195. package/src/icons/skill-node.tsx +0 -40
  196. package/src/icons/smartphone.tsx +0 -38
  197. package/src/icons/sort-ascending.tsx +0 -37
  198. package/src/icons/sort-descending.tsx +0 -37
  199. package/src/icons/sort.tsx +0 -37
  200. package/src/icons/sparkle.tsx +0 -38
  201. package/src/icons/speech-burst.tsx +0 -37
  202. package/src/icons/story.tsx +0 -37
  203. package/src/icons/sun.tsx +0 -38
  204. package/src/icons/tag.tsx +0 -38
  205. package/src/icons/team.tsx +0 -40
  206. package/src/icons/trophy-crown.tsx +0 -39
  207. package/src/icons/upload.tsx +0 -37
  208. package/src/icons/user.tsx +0 -38
  209. package/src/icons/users.tsx +0 -39
  210. package/src/icons/visibility-off.tsx +0 -38
  211. package/src/icons/visibility.tsx +0 -38
  212. package/src/icons/volume-off.tsx +0 -37
  213. package/src/icons/volume.tsx +0 -37
  214. package/src/icons/warning.tsx +0 -38
  215. package/src/icons/workflow.tsx +0 -40
  216. package/src/icons.tsx +0 -965
  217. package/src/index.ts +0 -89
  218. package/src/lib/asset-registry.ts +0 -534
  219. package/src/lib/audio-runtime.ts +0 -314
  220. package/src/lib/character-adapter.ts +0 -370
  221. package/src/lib/character-registry.ts +0 -2368
  222. package/src/lib/cn.ts +0 -6
  223. package/src/lib/compose-refs.ts +0 -16
  224. package/src/lib/sanitize-url.ts +0 -51
  225. package/src/lib/scene-camera.ts +0 -483
  226. package/src/lib/scene-playback.ts +0 -622
  227. package/src/lib/scene-soundscape.ts +0 -151
  228. package/src/lib/scene-test-harness.ts +0 -200
  229. package/src/lib/scene-timeline.ts +0 -398
  230. package/src/lib/use-animation-visibility.ts +0 -45
  231. package/src/lib/use-modal-focus.ts +0 -270
  232. package/src/lib/use-reduced-motion.ts +0 -37
  233. package/src/motion/easing-presets.ts +0 -262
  234. package/src/motion/index.tsx +0 -894
  235. package/src/motion/physics.ts +0 -259
  236. package/src/motion/timeline-math.ts +0 -358
  237. package/src/motion.tsx +0 -639
  238. package/src/pixelfx-boundary.ts +0 -188
  239. package/src/pixelfx-registry.ts +0 -1190
  240. package/src/pixelfx-types.d.ts +0 -73
  241. package/src/pixelfx.tsx +0 -1022
  242. package/src/provider.tsx +0 -63
  243. package/src/skin-catalog.ts +0 -306
  244. package/src/skin-tokens.ts +0 -425
  245. package/src/ssr/init-script.ts +0 -281
  246. package/src/ssr/resolve-skin.ts +0 -217
  247. package/src/ssr/theme-mismatch-dev.ts +0 -181
  248. package/src/templates/battle-arena.tsx +0 -688
  249. package/src/templates/index.tsx +0 -314
  250. package/src/templates.tsx +0 -225
  251. package/src/themes/dna-presets.ts +0 -119
  252. package/src/themes/index.ts +0 -56
  253. package/src/themes/provider.tsx +0 -183
  254. package/src/themes/types.ts +0 -111
  255. package/src/themes.ts +0 -9
  256. package/src/token-exporter.ts +0 -12
  257. package/src/token-exporters.ts +0 -343
  258. package/src/token-seeds.ts +0 -335
  259. package/src/token-snapshot.ts +0 -179
  260. package/src/utils.ts +0 -58
@@ -1,196 +0,0 @@
1
- "use client";
2
-
3
- import { useMemo, type CSSProperties } from "react";
4
- import { PixelFxCanvas } from "../pixelfx.js";
5
- import {
6
- resolveSceneParticleFx,
7
- type EmpirePaletteId,
8
- type SceneParticleIntensityKey,
9
- } from "../pixelfx-registry.js";
10
- import { cn } from "../lib/cn.js";
11
- import { useAnimationVisibility } from "../lib/use-animation-visibility.js";
12
- import { useReducedMotion } from "../lib/use-reduced-motion.js";
13
-
14
- export type SceneParticlePreset = "rain" | "dust" | "stars" | "sparks";
15
- export type SceneParticleIntensity = "subtle" | "medium" | "intense";
16
-
17
- export const MAX_SCENE_PARTICLES = 36;
18
-
19
- const PRESET_DEFAULT_COUNT: Record<SceneParticlePreset, number> = {
20
- rain: 24,
21
- dust: 16,
22
- stars: 20,
23
- sparks: 18,
24
- };
25
-
26
- const INTENSITY_FACTOR: Record<SceneParticleIntensity, number> = {
27
- subtle: 0.5,
28
- medium: 1,
29
- intense: 1.5,
30
- };
31
-
32
- export interface SceneParticleDatum {
33
- readonly id: number;
34
- readonly xPct: number;
35
- readonly yPct: number;
36
- readonly sizePx: number;
37
- readonly durationMs: number;
38
- readonly delayMs: number;
39
- readonly opacity: number;
40
- }
41
-
42
- function mulberry32(seed: number) {
43
- let state = seed | 0;
44
- return () => {
45
- state = (state + 0x6d2b79f5) | 0;
46
- let t = Math.imul(state ^ (state >>> 15), 1 | state);
47
- t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
48
- return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
49
- };
50
- }
51
-
52
- function particleShape(preset: SceneParticlePreset) {
53
- if (preset === "rain")
54
- return { borderRadius: "1px", heightScale: 10, widthScale: 0.55 };
55
- if (preset === "sparks")
56
- return { borderRadius: "1px", heightScale: 1.8, widthScale: 0.55 };
57
- if (preset === "stars")
58
- return { borderRadius: "1px", heightScale: 1, widthScale: 1 };
59
- return { borderRadius: "999px", heightScale: 1, widthScale: 1 };
60
- }
61
-
62
- export function generateSceneParticles(
63
- preset: SceneParticlePreset,
64
- options: {
65
- count?: number;
66
- intensity?: SceneParticleIntensity;
67
- seed?: number;
68
- } = {},
69
- ): readonly SceneParticleDatum[] {
70
- const base = options.count ?? PRESET_DEFAULT_COUNT[preset];
71
- const factor = INTENSITY_FACTOR[options.intensity ?? "medium"];
72
- const bounded = Math.max(
73
- 0,
74
- Math.min(MAX_SCENE_PARTICLES, Math.round(base * factor)),
75
- );
76
- const rand = mulberry32(options.seed ?? preset.length * 97 + 13);
77
- const items: SceneParticleDatum[] = [];
78
- for (let index = 0; index < bounded; index += 1) {
79
- items.push({
80
- id: index,
81
- xPct: Number((rand() * 100).toFixed(2)),
82
- yPct: Number((rand() * 100).toFixed(2)),
83
- sizePx:
84
- preset === "rain"
85
- ? Number((1 + rand() * 1.5).toFixed(2))
86
- : Number((2 + rand() * 3).toFixed(2)),
87
- durationMs: Math.round(1400 + rand() * 1800),
88
- delayMs: Math.round(rand() * 1200),
89
- opacity: Number((0.28 + rand() * 0.55).toFixed(2)),
90
- });
91
- }
92
- return items;
93
- }
94
-
95
- export interface SceneParticlesProps {
96
- readonly preset: SceneParticlePreset;
97
- readonly intensity?: SceneParticleIntensity;
98
- readonly count?: number;
99
- readonly seed?: number;
100
- readonly paused?: boolean;
101
- readonly reducedMotion?: boolean;
102
- readonly paletteId?: EmpirePaletteId;
103
- readonly className?: string;
104
- readonly style?: CSSProperties;
105
- }
106
-
107
- export function SceneParticles({
108
- preset,
109
- intensity = "medium",
110
- count,
111
- seed,
112
- paused = false,
113
- reducedMotion,
114
- paletteId,
115
- className,
116
- style,
117
- }: SceneParticlesProps) {
118
- const motion = useAnimationVisibility<HTMLDivElement>();
119
- const effectiveReducedMotion = useReducedMotion(reducedMotion);
120
- const particles = useMemo(
121
- () => generateSceneParticles(preset, { count, intensity, seed }),
122
- [preset, count, intensity, seed],
123
- );
124
- const staticMode = effectiveReducedMotion || paused;
125
- const shape = particleShape(preset);
126
- const resolvedFx = resolveSceneParticleFx(
127
- preset,
128
- intensity as SceneParticleIntensityKey,
129
- );
130
-
131
- return (
132
- <div
133
- ref={motion.ref}
134
- aria-hidden="true"
135
- className={cn(
136
- "mw-ui-scene-particles",
137
- staticMode ? "mw-ui-motion-paused" : motion.visibilityClass,
138
- className,
139
- )}
140
- data-particle-preset={preset}
141
- data-particle-intensity={intensity}
142
- data-particle-count={particles.length}
143
- data-particle-state={staticMode ? "static" : "active"}
144
- data-reduced-motion={effectiveReducedMotion ? "true" : "false"}
145
- data-pixelfx={staticMode ? "none" : resolvedFx.effectId}
146
- data-pixelfx-ready="true"
147
- style={{
148
- position: "relative",
149
- overflow: "hidden",
150
- pointerEvents: "none",
151
- contain: "layout style paint",
152
- ...style,
153
- }}
154
- >
155
- {!staticMode ? (
156
- <PixelFxCanvas
157
- effectId={resolvedFx.effectId}
158
- paletteId={resolvedFx.paletteId}
159
- layer={resolvedFx.layer}
160
- active={!staticMode}
161
- reducedMotion={effectiveReducedMotion}
162
- speed={resolvedFx.speed}
163
- seed={resolvedFx.seed}
164
- lightK={resolvedFx.lightK}
165
- className="mw-ui-scene-particles-fx"
166
- style={{ opacity: resolvedFx.opacity }}
167
- />
168
- ) : null}
169
- {particles.map((particle) => (
170
- <span
171
- key={particle.id}
172
- className="mw-ui-scene-particle"
173
- data-particle-id={particle.id}
174
- style={{
175
- position: "absolute",
176
- left: `${particle.xPct}%`,
177
- top: `${particle.yPct}%`,
178
- width: `${particle.sizePx * shape.widthScale}px`,
179
- height: `${particle.sizePx * shape.heightScale}px`,
180
- borderRadius: shape.borderRadius,
181
- opacity: particle.opacity,
182
- background:
183
- preset === "sparks"
184
- ? "var(--mw-yellow)"
185
- : preset === "rain"
186
- ? "var(--mw-cyan)"
187
- : "var(--mw-paper)",
188
- transform: staticMode ? "none" : "translate3d(0, 0, 0)",
189
- animationDuration: staticMode ? "0ms" : `${particle.durationMs}ms`,
190
- animationDelay: staticMode ? "0ms" : `${particle.delayMs}ms`,
191
- }}
192
- />
193
- ))}
194
- </div>
195
- );
196
- }
@@ -1,130 +0,0 @@
1
- "use client";
2
-
3
- import {
4
- useCallback,
5
- useEffect,
6
- useRef,
7
- useState,
8
- type CSSProperties,
9
- type ReactNode,
10
- } from "react";
11
- import { PixelFxCanvas } from "../pixelfx.js";
12
- import {
13
- resolveSceneTransitionFx,
14
- type EmpirePaletteId,
15
- } from "../pixelfx-registry.js";
16
- import { cn } from "../lib/cn.js";
17
- import { useReducedMotion } from "../lib/use-reduced-motion.js";
18
-
19
- export type ComicTransitionVariant =
20
- "ink-wipe" | "panel-reveal" | "cut-impact" | "soft";
21
- export type ComicTransitionState =
22
- "idle" | "entering" | "entered" | "cancelled";
23
-
24
- export interface SceneTransitionProps {
25
- readonly variant?: ComicTransitionVariant;
26
- readonly active?: boolean;
27
- readonly durationMs?: number;
28
- readonly reducedMotion?: boolean;
29
- readonly onComplete?: () => void;
30
- readonly children: ReactNode;
31
- readonly paletteId?: EmpirePaletteId;
32
- readonly className?: string;
33
- readonly style?: CSSProperties;
34
- }
35
-
36
- export function ComicSceneTransition({
37
- variant = "panel-reveal",
38
- active = true,
39
- durationMs = 280,
40
- reducedMotion,
41
- onComplete,
42
- children,
43
- paletteId,
44
- className,
45
- style,
46
- }: SceneTransitionProps) {
47
- const effectiveReducedMotion = useReducedMotion(reducedMotion);
48
- const resolvedFx = resolveSceneTransitionFx(variant);
49
- const [state, setState] = useState<ComicTransitionState>(
50
- effectiveReducedMotion || !active ? "entered" : "entering",
51
- );
52
- const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
53
- const onCompleteRef = useRef(onComplete);
54
-
55
- useEffect(() => {
56
- onCompleteRef.current = onComplete;
57
- }, [onComplete]);
58
-
59
- const cancel = useCallback(() => {
60
- if (timerRef.current !== null) {
61
- clearTimeout(timerRef.current);
62
- timerRef.current = null;
63
- }
64
- setState("entered");
65
- }, []);
66
-
67
- useEffect(() => {
68
- if (effectiveReducedMotion || !active || durationMs <= 0) {
69
- setState("entered");
70
- onCompleteRef.current?.();
71
- return;
72
- }
73
- setState("entering");
74
- timerRef.current = setTimeout(
75
- () => {
76
- timerRef.current = null;
77
- setState("entered");
78
- onCompleteRef.current?.();
79
- },
80
- Math.min(durationMs, 1500),
81
- );
82
- return () => {
83
- if (timerRef.current !== null) {
84
- clearTimeout(timerRef.current);
85
- timerRef.current = null;
86
- }
87
- };
88
- }, [active, durationMs, effectiveReducedMotion]);
89
-
90
- return (
91
- <div
92
- className={cn("mw-ui-comic-transition", className)}
93
- data-transition-variant={variant}
94
- data-transition-state={state}
95
- data-reduced-motion={effectiveReducedMotion ? "true" : "false"}
96
- data-pixelfx={
97
- effectiveReducedMotion || state === "entered" ? "none" : resolvedFx.effectId
98
- }
99
- data-pixelfx-ready="true"
100
- onPointerDown={state === "entering" ? cancel : undefined}
101
- onKeyDown={state === "entering" ? cancel : undefined}
102
- style={{
103
- opacity: 1,
104
- visibility: "visible",
105
- transition: effectiveReducedMotion
106
- ? "none"
107
- : `transform ${Math.min(durationMs, 1500)}ms ease-out`,
108
- ...style,
109
- }}
110
- >
111
- {!effectiveReducedMotion && state === "entering" ? (
112
- <div className="mw-ui-scene-transition-fx" aria-hidden="true">
113
- <PixelFxCanvas
114
- effectId={resolvedFx.effectId}
115
- paletteId={resolvedFx.paletteId}
116
- layer="all"
117
- active
118
- reducedMotion={effectiveReducedMotion}
119
- speed={resolvedFx.speed}
120
- seed={Math.max(1, Math.round(durationMs))}
121
- triggerKey={Math.max(1, Math.round(durationMs))}
122
- lightK={resolvedFx.lightK}
123
- className="mw-ui-scene-transition-fx-canvas"
124
- />
125
- </div>
126
- ) : null}
127
- {children}
128
- </div>
129
- );
130
- }
@@ -1,94 +0,0 @@
1
- 'use client';
2
- import { useState, type HTMLAttributes, type ReactNode } from "react";
3
- import { PixelFxComponentLayer } from "../pixelfx.js";
4
- import {
5
- resolveComponentPixelFx,
6
- type EmpirePaletteId,
7
- type PixelFxEffectId,
8
- } from "../pixelfx-registry.js";
9
-
10
- export interface SectionRibbonProps extends HTMLAttributes<HTMLDivElement> {
11
- title: string;
12
- number?: string;
13
- accent?: "magenta" | "cyan" | "yellow";
14
- surface?: "paper" | "ink";
15
- frame?: "line" | "torn" | "scuffed" | "grunge";
16
- size?: "sm" | "md" | "lg";
17
- treatment?: "display" | "brush";
18
- headingLevel?: 2 | 3 | 4 | 5;
19
- action?: ReactNode;
20
- fx?: PixelFxEffectId | "auto" | false;
21
- fxPalette?: EmpirePaletteId;
22
- fxTrigger?: "hover" | "always";
23
- }
24
-
25
- export function SectionRibbon({
26
- title,
27
- number,
28
- accent = "magenta",
29
- surface = "paper",
30
- frame = "line",
31
- size = "md",
32
- treatment = "display",
33
- headingLevel = 3,
34
- action,
35
- fx = "auto",
36
- fxPalette,
37
- fxTrigger = "hover",
38
- className,
39
- onMouseEnter,
40
- onMouseLeave,
41
- ...props
42
- }: SectionRibbonProps) {
43
- const [hovered, setHovered] = useState(false);
44
- const autoFx = resolveComponentPixelFx("section-ribbon", accent);
45
- const resolvedEffectId =
46
- fx === false ? null : fx === "auto" ? autoFx.effectId : fx;
47
- const fxActive = Boolean(
48
- resolvedEffectId && (fxTrigger === "always" || hovered),
49
- );
50
- const Heading = `h${headingLevel}` as "h2" | "h3" | "h4" | "h5";
51
-
52
- return (
53
- <div
54
- className={
55
- className ? `mw-ui-section-ribbon ${className}` : "mw-ui-section-ribbon"
56
- }
57
- data-accent={accent}
58
- data-surface={surface}
59
- data-frame={frame}
60
- data-size={size}
61
- data-treatment={treatment}
62
- data-pixelfx={resolvedEffectId ?? undefined}
63
- data-pixelfx-ready={resolvedEffectId ? "true" : undefined}
64
- onMouseEnter={(event) => {
65
- if (resolvedEffectId && fxTrigger === "hover") setHovered(true);
66
- onMouseEnter?.(event);
67
- }}
68
- onMouseLeave={(event) => {
69
- if (resolvedEffectId && fxTrigger === "hover") setHovered(false);
70
- onMouseLeave?.(event);
71
- }}
72
- {...props}
73
- >
74
- {resolvedEffectId ? (
75
- <PixelFxComponentLayer
76
- effectId={resolvedEffectId}
77
- paletteId={fxPalette ?? autoFx.paletteId}
78
- layer={autoFx.layer}
79
- loop
80
- active={fxActive}
81
- speed={autoFx.speed}
82
- seed={autoFx.seed}
83
- lightK={autoFx.lightK}
84
- placement="background"
85
- />
86
- ) : null}
87
- <div style={{ display: "flex", alignItems: "center", gap: "0.6rem" }}>
88
- {number ? <span className="mw-ui-section-ribbon-num">{number}</span> : null}
89
- <Heading className="mw-ui-section-ribbon-title">{title}</Heading>
90
- </div>
91
- {action ? <div>{action}</div> : null}
92
- </div>
93
- );
94
- }
@@ -1,27 +0,0 @@
1
- import { forwardRef, type SelectHTMLAttributes } from "react";
2
- import { useComponentPixelFx } from "../pixelfx.js";
3
- import type { PixelFxProp } from "../pixelfx-registry.js";
4
- import { cn } from "../utils.js";
5
-
6
- export interface SelectFieldProps extends Omit<
7
- SelectHTMLAttributes<HTMLSelectElement>,
8
- "size"
9
- > {
10
- fx?: PixelFxProp;
11
- size?: "sm" | "md" | "lg";
12
- }
13
-
14
- export const SelectField = forwardRef<HTMLSelectElement, SelectFieldProps>(
15
- function SelectField({ className, fx = "auto", size = "lg", ...props }, ref) {
16
- const pfx = useComponentPixelFx({ kind: "select-field", fx });
17
- return (
18
- <select
19
- ref={ref}
20
- className={cn("mw-ui-select-field", className)}
21
- data-size={size}
22
- {...pfx.dataAttributes}
23
- {...props}
24
- />
25
- );
26
- },
27
- );
@@ -1,81 +0,0 @@
1
- 'use client';
2
- import { Select as RadixSelect } from "radix-ui";
3
- import type { ComponentProps } from "react";
4
- import { useComponentPixelFx } from "../pixelfx.js";
5
- import type { PixelFxProp } from "../pixelfx-registry.js";
6
- import { cn } from "../utils.js";
7
-
8
- export const Select = RadixSelect.Root;
9
- export const SelectValue = RadixSelect.Value;
10
-
11
- export function SelectTrigger({
12
- className,
13
- children,
14
- size = "default",
15
- fullWidth = false,
16
- fx = "auto",
17
- ...props
18
- }: ComponentProps<typeof RadixSelect.Trigger> & {
19
- size?: "sm" | "default";
20
- fullWidth?: boolean;
21
- fx?: PixelFxProp;
22
- }) {
23
- const pfx = useComponentPixelFx({ kind: "select", fx });
24
- return (
25
- <RadixSelect.Trigger
26
- data-slot="select-trigger"
27
- data-size={size}
28
- data-full-width={fullWidth ? "true" : undefined}
29
- className={cn("mw-ui-select-trigger", className)}
30
- {...pfx.dataAttributes}
31
- {...props}
32
- >
33
- {children}
34
- <RadixSelect.Icon aria-hidden="true">▾</RadixSelect.Icon>
35
- </RadixSelect.Trigger>
36
- );
37
- }
38
-
39
- export function SelectContent({
40
- className,
41
- children,
42
- position = "popper",
43
- fx = "auto",
44
- ...props
45
- }: ComponentProps<typeof RadixSelect.Content> & { fx?: PixelFxProp }) {
46
- const pfx = useComponentPixelFx({
47
- kind: "select",
48
- fx,
49
- placement: "background",
50
- });
51
- return (
52
- <RadixSelect.Portal>
53
- <RadixSelect.Content
54
- position={position}
55
- sideOffset={4}
56
- className={cn("mw-ui-select-content", className)}
57
- {...pfx.dataAttributes}
58
- {...pfx.handlers}
59
- {...props}
60
- >
61
- {pfx.layer}
62
- <RadixSelect.Viewport>{children}</RadixSelect.Viewport>
63
- </RadixSelect.Content>
64
- </RadixSelect.Portal>
65
- );
66
- }
67
-
68
- export function SelectItem({
69
- className,
70
- children,
71
- ...props
72
- }: ComponentProps<typeof RadixSelect.Item>) {
73
- return (
74
- <RadixSelect.Item
75
- className={cn("mw-ui-select-item", className)}
76
- {...props}
77
- >
78
- <RadixSelect.ItemText>{children}</RadixSelect.ItemText>
79
- </RadixSelect.Item>
80
- );
81
- }
@@ -1,58 +0,0 @@
1
- import { forwardRef, type HTMLAttributes } from "react";
2
- import { useComponentPixelFx } from "../pixelfx.js";
3
- import type { PixelFxProp } from "../pixelfx-registry.js";
4
- import { cn } from "../utils.js";
5
-
6
- export interface SeparatorProps extends HTMLAttributes<HTMLDivElement> {
7
- orientation?: "horizontal" | "vertical";
8
- variant?: "solid" | "dashed";
9
- label?: string;
10
- fx?: PixelFxProp;
11
- }
12
-
13
- export const Separator = forwardRef<HTMLElement, SeparatorProps>((
14
- {
15
- orientation = "horizontal",
16
- variant = "solid",
17
- label,
18
- fx = "auto",
19
- className,
20
- ...props
21
- },
22
- ref,
23
- ) => {
24
- const pfx = useComponentPixelFx({ kind: "separator", fx });
25
-
26
- if (orientation === "vertical") {
27
- return (
28
- <span
29
- ref={ref as any}
30
- role="separator"
31
- aria-orientation="vertical"
32
- className={cn("mw-ui-separator", className)}
33
- data-orientation="vertical"
34
- data-variant={variant}
35
- {...pfx.dataAttributes}
36
- {...props}
37
- />
38
- );
39
- }
40
- return (
41
- <div
42
- ref={ref as any}
43
- role="separator"
44
- aria-orientation="horizontal"
45
- className={cn("mw-ui-separator", className)}
46
- data-orientation="horizontal"
47
- data-variant={variant}
48
- {...pfx.dataAttributes}
49
- {...props}
50
- >
51
- <hr className="mw-ui-separator-line" />
52
- {label ? <span>{label}</span> : null}
53
- {label ? <hr className="mw-ui-separator-line" /> : null}
54
- </div>
55
- );
56
- });
57
-
58
- Separator.displayName = "Separator";
@@ -1,96 +0,0 @@
1
- 'use client';
2
- import { Dialog as RadixDialog } from "radix-ui";
3
- import type { ComponentProps, HTMLAttributes } from "react";
4
- import { useComponentPixelFx } from "../pixelfx.js";
5
- import type { PixelFxProp } from "../pixelfx-registry.js";
6
- import { cn } from "../utils.js";
7
-
8
- export const Sheet = RadixDialog.Root;
9
- export const SheetTrigger = RadixDialog.Trigger;
10
- export const SheetClose = RadixDialog.Close;
11
-
12
- export function SheetContent({
13
- className,
14
- children,
15
- side = "left",
16
- fx = "auto",
17
- ...props
18
- }: ComponentProps<typeof RadixDialog.Content> & { fx?: PixelFxProp; side?: "left" | "right" | "top" | "bottom" }) {
19
- const pfx = useComponentPixelFx({
20
- kind: "sheet",
21
- fx,
22
- placement: "background",
23
- });
24
- return (
25
- <RadixDialog.Portal>
26
- <RadixDialog.Overlay className="mw-ui-overlay" />
27
- <RadixDialog.Content
28
- className={cn("mw-ui-sheet-content", className)}
29
- data-slot="sheet-content"
30
- data-side={side}
31
- {...pfx.dataAttributes}
32
- {...pfx.handlers}
33
- {...props}
34
- >
35
- {pfx.layer}
36
- {children}
37
- </RadixDialog.Content>
38
- </RadixDialog.Portal>
39
- );
40
- }
41
-
42
- export function SheetHeader({
43
- style,
44
- ...props
45
- }: HTMLAttributes<HTMLDivElement>) {
46
- return (
47
- <div style={{ display: "grid", gap: "0.35rem", ...style }} {...props} />
48
- );
49
- }
50
-
51
- export function SheetFooter({
52
- style,
53
- ...props
54
- }: HTMLAttributes<HTMLDivElement>) {
55
- return (
56
- <div
57
- style={{
58
- marginTop: "auto",
59
- display: "flex",
60
- justifyContent: "flex-end",
61
- gap: "0.5rem",
62
- ...style,
63
- }}
64
- {...props}
65
- />
66
- );
67
- }
68
-
69
- export function SheetTitle({
70
- style,
71
- ...props
72
- }: ComponentProps<typeof RadixDialog.Title>) {
73
- return (
74
- <RadixDialog.Title
75
- style={{ margin: 0, fontSize: "1.08rem", fontWeight: 700, ...style }}
76
- {...props}
77
- />
78
- );
79
- }
80
-
81
- export function SheetDescription({
82
- style,
83
- ...props
84
- }: ComponentProps<typeof RadixDialog.Description>) {
85
- return (
86
- <RadixDialog.Description
87
- style={{
88
- margin: 0,
89
- fontSize: "0.86rem",
90
- color: "var(--mw-muted-foreground)",
91
- ...style,
92
- }}
93
- {...props}
94
- />
95
- );
96
- }