@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.
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,301 +0,0 @@
1
- 'use client';
2
- import { forwardRef, useState, type ReactNode } from "react";
3
- import { PixelFxComponentLayer } from "../pixelfx.js";
4
- import { resolveComponentPixelFx } from "../pixelfx-registry.js";
5
-
6
- export type ComicPanelProps = {
7
- panelNumber?: string;
8
- kicker?: string;
9
- title?: string;
10
- surface?: "paper" | "ink" | "default";
11
- frame?: string;
12
- accent?: "magenta" | "cyan" | "yellow";
13
- halftone?: boolean;
14
- actions?: ReactNode;
15
- children?: ReactNode;
16
- fx?: boolean | "auto";
17
- className?: string;
18
- };
19
-
20
- export const ComicPanel = forwardRef<HTMLElement, ComicPanelProps>(
21
- function ComicPanel(
22
- {
23
- panelNumber,
24
- kicker,
25
- title,
26
- surface = "paper",
27
- frame,
28
- accent = "magenta",
29
- halftone = false,
30
- actions,
31
- children,
32
- fx = "auto",
33
- className = "",
34
- },
35
- ref
36
- ) {
37
- const [hovered, setHovered] = useState(false);
38
- const fxEnabled = fx !== false;
39
- const resolvedFx = resolveComponentPixelFx(
40
- "panel",
41
- surface === "ink" ? "ink" : accent,
42
- );
43
- const accentColor =
44
- accent === "cyan"
45
- ? "var(--mw-cyan)"
46
- : accent === "yellow"
47
- ? "var(--mw-yellow)"
48
- : "var(--mw-magenta)";
49
- const bg =
50
- surface === "ink"
51
- ? "var(--mw-night)"
52
- : surface === "paper"
53
- ? "var(--mw-paper)"
54
- : "var(--mw-surface)";
55
- const fg = surface === "ink" ? "var(--mw-moon)" : "var(--mw-ink)";
56
-
57
- return (
58
- <section
59
- ref={ref}
60
- className={`mw-ui-comic-panel ${className}`.trim()}
61
- data-pixelfx={fxEnabled ? resolvedFx.effectId : "none"}
62
- data-pixelfx-ready="true"
63
- data-surface={surface}
64
- data-frame={frame}
65
- data-accent={accent}
66
- data-halftone={halftone ? "true" : undefined}
67
- onMouseEnter={() => setHovered(true)}
68
- onMouseLeave={() => setHovered(false)}
69
- style={{
70
- position: "relative",
71
- overflow: "hidden",
72
- display: "grid",
73
- gap: "0.85rem",
74
- padding: "1.1rem",
75
- border: "2.5px solid var(--mw-border-strong)",
76
- background: bg,
77
- color: fg,
78
- boxShadow: `5px 5px 0 0 ${accentColor}`,
79
- }}
80
- >
81
- {fxEnabled ? (
82
- <PixelFxComponentLayer
83
- effectId={resolvedFx.effectId}
84
- paletteId={resolvedFx.paletteId}
85
- layer={resolvedFx.layer}
86
- loop
87
- active={hovered}
88
- speed={resolvedFx.speed}
89
- seed={resolvedFx.seed}
90
- lightK={resolvedFx.lightK}
91
- placement="background"
92
- />
93
- ) : null}
94
- <header
95
- style={{
96
- position: "relative",
97
- zIndex: 2,
98
- display: "flex",
99
- flexWrap: "wrap",
100
- alignItems: "center",
101
- justifyContent: "space-between",
102
- gap: "0.65rem",
103
- borderBottom: "1.5px solid currentColor",
104
- paddingBottom: "0.55rem",
105
- }}
106
- >
107
- <div style={{ display: "flex", alignItems: "center", gap: "0.6rem" }}>
108
- {panelNumber ? (
109
- <span
110
- style={{
111
- padding: "0.15rem 0.45rem",
112
- background: accentColor,
113
- color:
114
- accent === "magenta"
115
- ? "var(--mw-on-magenta)"
116
- : "var(--mw-on-accent)",
117
- fontFamily: "var(--mw-font-mono)",
118
- fontWeight: 700,
119
- fontSize: "0.75rem",
120
- className: "mw-ui-comic-panel-num",
121
- } as React.CSSProperties}
122
- >
123
- {panelNumber}
124
- </span>
125
- ) : null}
126
- <div>
127
- {kicker ? (
128
- <div
129
- style={{
130
- fontSize: "0.7rem",
131
- letterSpacing: "0.1em",
132
- fontWeight: 700,
133
- opacity: 0.78,
134
- }}
135
- >
136
- {kicker}
137
- </div>
138
- ) : null}
139
- {title ? (
140
- <h4
141
- style={{
142
- margin: 0,
143
- fontFamily: "var(--mw-font-display)",
144
- fontSize: "1.2rem",
145
- letterSpacing: "0.03em",
146
- }}
147
- >
148
- {title}
149
- </h4>
150
- ) : null}
151
- </div>
152
- </div>
153
- {actions}
154
- </header>
155
- <div style={{ position: "relative", zIndex: 2 }}>{children}</div>
156
- </section>
157
- );
158
- }
159
-
160
- );
161
- export const MangaFrame = forwardRef<HTMLDivElement, ComicPanelProps>(
162
- function MangaFrame(
163
- {
164
- panelNumber,
165
- kicker,
166
- title,
167
- surface = "paper",
168
- frame,
169
- accent = "magenta",
170
- halftone = false,
171
- actions,
172
- children,
173
- fx = "auto",
174
- className = "",
175
- },
176
- ref
177
- ) {
178
- const [hovered, setHovered] = useState(false);
179
- const fxEnabled = fx !== false;
180
- const resolvedFx = resolveComponentPixelFx(
181
- "panel",
182
- surface === "ink" ? "ink" : accent,
183
- );
184
- const accentColor =
185
- accent === "cyan"
186
- ? "var(--mw-cyan)"
187
- : accent === "yellow"
188
- ? "var(--mw-yellow)"
189
- : "var(--mw-magenta)";
190
- const bg =
191
- surface === "ink"
192
- ? "var(--mw-night)"
193
- : surface === "paper"
194
- ? "var(--mw-paper)"
195
- : "var(--mw-surface)";
196
- const fg = surface === "ink" ? "var(--mw-moon)" : "var(--mw-ink)";
197
-
198
- return (
199
- <div
200
- ref={ref}
201
- className={`mw-ui-comic-panel mw-ui-manga-frame ${className}`.trim()}
202
- data-pixelfx={fxEnabled ? resolvedFx.effectId : "none"}
203
- data-pixelfx-ready="true"
204
- data-surface={surface}
205
- data-frame={frame}
206
- data-accent={accent}
207
- data-halftone={halftone ? "true" : undefined}
208
- onMouseEnter={() => setHovered(true)}
209
- onMouseLeave={() => setHovered(false)}
210
- style={{
211
- position: "relative",
212
- overflow: "hidden",
213
- display: "grid",
214
- gap: "0.85rem",
215
- padding: "1.1rem",
216
- border: "2.5px solid var(--mw-border-strong)",
217
- background: bg,
218
- color: fg,
219
- boxShadow: `5px 5px 0 0 ${accentColor}`,
220
- }}
221
- >
222
- {fxEnabled ? (
223
- <PixelFxComponentLayer
224
- effectId={resolvedFx.effectId}
225
- paletteId={resolvedFx.paletteId}
226
- layer={resolvedFx.layer}
227
- loop
228
- active={hovered}
229
- speed={resolvedFx.speed}
230
- seed={resolvedFx.seed}
231
- lightK={resolvedFx.lightK}
232
- placement="background"
233
- />
234
- ) : null}
235
- <header
236
- style={{
237
- position: "relative",
238
- zIndex: 2,
239
- display: "flex",
240
- flexWrap: "wrap",
241
- alignItems: "center",
242
- justifyContent: "space-between",
243
- gap: "0.65rem",
244
- borderBottom: "1.5px solid currentColor",
245
- paddingBottom: "0.55rem",
246
- }}
247
- >
248
- <div style={{ display: "flex", alignItems: "center", gap: "0.6rem" }}>
249
- {panelNumber ? (
250
- <span
251
- className="mw-ui-comic-panel-num"
252
- style={{
253
- padding: "0.15rem 0.45rem",
254
- background: accentColor,
255
- color:
256
- accent === "magenta"
257
- ? "var(--mw-on-magenta)"
258
- : "var(--mw-on-accent)",
259
- fontFamily: "var(--mw-font-mono)",
260
- fontWeight: 700,
261
- fontSize: "0.75rem",
262
- }}
263
- >
264
- {panelNumber}
265
- </span>
266
- ) : null}
267
- <div>
268
- {kicker ? (
269
- <div
270
- style={{
271
- fontSize: "0.7rem",
272
- letterSpacing: "0.1em",
273
- fontWeight: 700,
274
- opacity: 0.78,
275
- }}
276
- >
277
- {kicker}
278
- </div>
279
- ) : null}
280
- {title ? (
281
- <h4
282
- style={{
283
- margin: 0,
284
- fontFamily: "var(--mw-font-display)",
285
- fontSize: "1.2rem",
286
- letterSpacing: "0.03em",
287
- }}
288
- >
289
- {title}
290
- </h4>
291
- ) : null}
292
- </div>
293
- </div>
294
- {actions}
295
- </header>
296
- <div style={{ position: "relative", zIndex: 2 }}>{children}</div>
297
- </div>
298
- );
299
- }
300
- );
301
- export type MangaFrameProps = ComicPanelProps;
@@ -1,170 +0,0 @@
1
- 'use client';
2
- import { useState } from "react";
3
- import { Button } from "./button.js";
4
- import { Badge } from "./badge.js";
5
- import { useComponentPixelFx } from "../pixelfx.js";
6
- import type { PixelFxProp } from "../pixelfx-registry.js";
7
- import { cn } from "../utils.js";
8
-
9
- export type ComicTheaterPanelItem = {
10
- id: string;
11
- beat: string;
12
- imageSrc: string;
13
- imageAlt: string;
14
- speaker: string;
15
- dialogue: string;
16
- dialogueId?: string;
17
- caption?: string;
18
- };
19
-
20
- export type ComicTheaterProps = {
21
- episodeCode: string;
22
- title: string;
23
- panels: readonly ComicTheaterPanelItem[];
24
- fx?: PixelFxProp;
25
- className?: string;
26
- };
27
-
28
- export function ComicTheater({
29
- episodeCode,
30
- title,
31
- panels,
32
- fx = "auto",
33
- className = "",
34
- }: ComicTheaterProps) {
35
- const [activeIndex, setActiveIndex] = useState(0);
36
- const [lang, setLang] = useState<"en" | "id">("en");
37
- const pfx = useComponentPixelFx({
38
- kind: "comic-theater",
39
- fx,
40
- placement: "background",
41
- });
42
- const current = panels[activeIndex] ?? panels[0];
43
-
44
- if (!current) return null;
45
-
46
- return (
47
- <section
48
- className={cn("mw-ui-comic-theater", className)}
49
- {...pfx.dataAttributes}
50
- {...pfx.handlers}
51
- style={{
52
- position: "relative",
53
- overflow: "hidden",
54
- display: "grid",
55
- gap: "0.85rem",
56
- padding: "1rem",
57
- border: "2px solid var(--mw-border-strong)",
58
- background: "var(--mw-surface)",
59
- boxShadow: "var(--mw-shadow-ink)",
60
- }}
61
- >
62
- {pfx.layer}
63
- <header
64
- style={{
65
- display: "flex",
66
- flexWrap: "wrap",
67
- alignItems: "center",
68
- justifyContent: "space-between",
69
- gap: "0.5rem",
70
- }}
71
- >
72
- <div style={{ display: "flex", alignItems: "center", gap: "0.55rem" }}>
73
- <Badge variant="magenta" size="sm">
74
- {episodeCode}
75
- </Badge>
76
- <strong style={{ fontFamily: "var(--mw-font-display)", fontSize: "1.1rem" }}>
77
- {title}
78
- </strong>
79
- </div>
80
- <div style={{ display: "flex", gap: "0.35rem" }}>
81
- <Button
82
- type="button"
83
- size="xs"
84
- variant={lang === "en" ? "default" : "outline"}
85
- onClick={() => setLang("en")}
86
- >
87
- EN
88
- </Button>
89
- <Button
90
- type="button"
91
- size="xs"
92
- variant={lang === "id" ? "default" : "outline"}
93
- onClick={() => setLang("id")}
94
- >
95
- ID
96
- </Button>
97
- </div>
98
- </header>
99
-
100
- <div
101
- style={{
102
- display: "grid",
103
- gridTemplateColumns: "minmax(0, 1.2fr) minmax(14rem, 1fr)",
104
- gap: "1rem",
105
- alignItems: "center",
106
- }}
107
- >
108
- <figure style={{ margin: 0, display: "grid", gap: "0.35rem" }}>
109
- <img
110
- src={current.imageSrc}
111
- alt={current.imageAlt}
112
- style={{
113
- width: "100%",
114
- maxHeight: "15rem",
115
- objectFit: "cover",
116
- border: "2px solid var(--mw-ink)",
117
- }}
118
- />
119
- {current.caption ? (
120
- <figcaption style={{ fontSize: "0.78rem", color: "var(--mw-muted-foreground)" }}>
121
- {current.caption}
122
- </figcaption>
123
- ) : null}
124
- </figure>
125
- <div style={{ display: "grid", gap: "0.55rem" }}>
126
- <Badge size="sm" variant="cyan">
127
- {current.id} · {current.beat}
128
- </Badge>
129
- <strong>{current.speaker}</strong>
130
- <blockquote
131
- style={{
132
- margin: 0,
133
- padding: "0.75rem",
134
- border: "2px solid var(--mw-ink)",
135
- background: "var(--mw-paper)",
136
- color: "var(--mw-ink)",
137
- fontSize: "0.9rem",
138
- }}
139
- >
140
- {lang === "id" && current.dialogueId
141
- ? current.dialogueId
142
- : current.dialogue}
143
- </blockquote>
144
- <div style={{ display: "flex", gap: "0.4rem" }}>
145
- <Button
146
- type="button"
147
- size="xs"
148
- variant="outline"
149
- disabled={activeIndex === 0}
150
- onClick={() => setActiveIndex((i) => Math.max(0, i - 1))}
151
- >
152
- Prev panel
153
- </Button>
154
- <Button
155
- type="button"
156
- size="xs"
157
- variant="outline"
158
- disabled={activeIndex >= panels.length - 1}
159
- onClick={() =>
160
- setActiveIndex((i) => Math.min(panels.length - 1, i + 1))
161
- }
162
- >
163
- Next panel
164
- </Button>
165
- </div>
166
- </div>
167
- </div>
168
- </section>
169
- );
170
- }
@@ -1,189 +0,0 @@
1
- 'use client';
2
- import {
3
- createContext,
4
- useContext,
5
- useState,
6
- type HTMLAttributes,
7
- type InputHTMLAttributes,
8
- type ReactNode,
9
- } from "react";
10
- import { useComponentPixelFx } from "../pixelfx.js";
11
- import type { PixelFxProp } from "../pixelfx-registry.js";
12
- import { cn } from "../utils.js";
13
-
14
- const CommandContext = createContext<{
15
- query: string;
16
- setQuery: (q: string) => void;
17
- shouldFilter: boolean;
18
- }>({ query: "", setQuery: () => {}, shouldFilter: true });
19
-
20
- export function Command({
21
- className,
22
- defaultValue: _defaultValue,
23
- shouldFilter,
24
- fx = "auto",
25
- children,
26
- ...props
27
- }: HTMLAttributes<HTMLDivElement> & { defaultValue?: string; shouldFilter?: boolean; fx?: PixelFxProp }) {
28
- const [query, setQuery] = useState("");
29
- const pfx = useComponentPixelFx({
30
- kind: "command",
31
- fx,
32
- placement: "background",
33
- });
34
- return (
35
- <CommandContext.Provider value={{ query, setQuery, shouldFilter: shouldFilter !== false }}>
36
- <div
37
- data-slot="command"
38
- role="dialog"
39
- aria-label={props["aria-label"] ?? "Command menu"}
40
- className={cn("mw-ui-command", className)}
41
- {...pfx.dataAttributes}
42
- {...pfx.handlers}
43
- {...props}
44
- >
45
- {pfx.layer}
46
- {children}
47
- </div>
48
- </CommandContext.Provider>
49
- );
50
- }
51
-
52
- export function CommandInput({
53
- className,
54
- onChange,
55
- onValueChange,
56
- ...props
57
- }: InputHTMLAttributes<HTMLInputElement> & { onValueChange?: (value: string) => void }) {
58
- const { query, setQuery } = useContext(CommandContext);
59
- return (
60
- <input
61
- type="search"
62
- value={query}
63
- onChange={(e) => {
64
- setQuery(e.target.value);
65
- onValueChange?.(e.target.value);
66
- onChange?.(e);
67
- }}
68
- data-slot="command-input"
69
- className={cn("mw-ui-input mw-ui-command-input", className)}
70
- {...props}
71
- />
72
- );
73
- }
74
-
75
- export function CommandList({
76
- className,
77
- children,
78
- ...props
79
- }: HTMLAttributes<HTMLDivElement>) {
80
- return (
81
- <div
82
- data-slot="command-list"
83
- role="listbox"
84
- aria-label={props["aria-label"] ?? "Command options"}
85
- tabIndex={0}
86
- className={cn("mw-ui-command-list", className)}
87
- {...props}
88
- >
89
- {children}
90
- </div>
91
- );
92
- }
93
-
94
- export function CommandEmpty({ children }: { children?: ReactNode }) {
95
- const { query } = useContext(CommandContext);
96
- if (!query.trim()) return null;
97
- return <p data-slot="command-empty" className="mw-ui-command-empty">{children}</p>;
98
- }
99
-
100
- export function CommandGroup({
101
- heading,
102
- children,
103
- }: {
104
- heading?: string;
105
- children?: ReactNode;
106
- }) {
107
- return (
108
- <div data-slot="command-group" role="group" aria-label={heading} className="mw-ui-command-group">
109
- {heading ? <div className="mw-ui-dropdown-label">{heading}</div> : null}
110
- <div className="mw-ui-command-group-items">{children}</div>
111
- </div>
112
- );
113
- }
114
-
115
- export function CommandItem({
116
- onSelect,
117
- value,
118
- className,
119
- children,
120
- ...props
121
- }: Omit<HTMLAttributes<HTMLButtonElement>, "onSelect"> & {
122
- onSelect?: (value: string) => void;
123
- value?: string;
124
- }) {
125
- const { query, shouldFilter } = useContext(CommandContext);
126
- const text =
127
- typeof children === "string"
128
- ? children
129
- : Array.isArray(children)
130
- ? children.map((c) => (typeof c === "string" ? c : "")).join(" ")
131
- : "";
132
- if (shouldFilter && query.trim() && text && !text.toLowerCase().includes(query.trim().toLowerCase())) {
133
- return null;
134
- }
135
- return (
136
- <button
137
- type="button"
138
- role="option"
139
- data-slot="command-item"
140
- className={cn("mw-ui-dropdown-item mw-ui-command-item", className)}
141
- onClick={() => onSelect?.(value ?? "")}
142
- {...props}
143
- >
144
- {children}
145
- </button>
146
- );
147
- }
148
-
149
- export function CommandSeparator({
150
- className,
151
- ...props
152
- }: HTMLAttributes<HTMLDivElement>) {
153
- return (
154
- <div
155
- data-slot="command-separator"
156
- role="separator"
157
- className={cn("mw-ui-command-separator", className)}
158
- {...props}
159
- />
160
- );
161
- }
162
-
163
- export function CommandShortcut({
164
- className,
165
- ...props
166
- }: HTMLAttributes<HTMLSpanElement>) {
167
- return (
168
- <span
169
- data-slot="command-shortcut"
170
- className={cn("mw-ui-command-shortcut", className)}
171
- {...props}
172
- />
173
- );
174
- }
175
-
176
- export type CommandDialogProps = HTMLAttributes<HTMLDivElement> & {
177
- defaultValue?: string;
178
- shouldFilter?: boolean;
179
- open?: boolean;
180
- onOpenChange?: (open: boolean) => void;
181
- fx?: PixelFxProp;
182
- };
183
- export function CommandDialog({
184
- open: _open,
185
- onOpenChange: _onOpenChange,
186
- ...props
187
- }: CommandDialogProps) {
188
- return <Command {...props} />;
189
- }