@chuzi/shared 1.3.25 → 1.3.26

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/themes/index.ts","../../../../src/realms/cosmos/components/World.tsx","../../../../src/realms/cosmos/components/Star.tsx","../../../../src/realms/cosmos/components/ConstellationEdge.tsx","../../../../src/realms/cosmos/components/Constellation.tsx","../../../../src/realms/cosmos/index.ts","../../../../src/realms/cosmos/components/layout.ts","../../../../src/realms/cosmos/components/CosmosSandbox.tsx"],"names":["DreiStars","jsxs","jsx","useMemo"],"mappings":";;;;;;;;;AAeO,IAAM,YAAA,GAAkD;AAAA,EAC7D,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ,SAMV,CASF,CAAA;ACdO,SAAS,KAAA,CAAM,EAAE,QAAA,EAAU,GAAA,GAAM,CAAC,CAAA,EAAG,CAAC,GAAE,EAAe;AAC5D,EAAA,uBACE,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAQ,EAAE,QAAA,EAAU,CAAC,CAAA,EAAG,CAAA,EAAG,EAAE,CAAA,EAAG,GAAA,EAAK,EAAA,EAAI,IAAA,EAAM,GAAA,EAAK,KAAK,GAAA,EAAI;AAAA,MAC7D,GAAA;AAAA,MACA,EAAA,EAAI,EAAE,SAAA,EAAW,IAAA,EAAK;AAAA,MAEtB,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,OAAA,EAAA,EAAM,QAAO,YAAA,EAAa,IAAA,EAAM,CAAC,YAAA,CAAa,MAAA,CAAO,MAAM,CAAA,EAAG,CAAA;AAAA,wBAC/D,GAAA,CAAC,cAAA,EAAA,EAAa,SAAA,EAAW,IAAA,EAAM,CAAA;AAAA,wBAC/B,GAAA;AAAA,UAACA,KAAA;AAAA,UAAA;AAAA,YACC,MAAA,EAAQ,GAAA;AAAA,YACR,KAAA,EAAO,EAAA;AAAA,YACP,KAAA,E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A,CAAC,KAAA,EAAA,EACE,QAAA,EAAA,MAAA,CAAO,GAAA,CAAI,CAAC,EAAE,IAAA,EAAM,MAAA,EAAO,qBAC1BA,GAAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MAEC,MAAA;AAAA,MACA,QAAA,EAAU,YAAA,GAAe,MAAM,YAAA,CAAa,IAAI,CAAA,GAAI;AAAA,KAAA;AAAA,IAF/C,IAAA,CAAK;AAAA,GAIb,CAAA,EACH,CAAA;AAEJ","file":"index.js","sourcesContent":["import type { RealmId } from \"../types/index.js\";\n\n/**\n * CSS custom property tokens, mirroring public/css/chuzi-realms.css.\n * Use these for any non-DOM rendering (e.g. React Native, canvas).\n */\nexport interface RealmThemeTokens {\n bgDeep: string;\n bgMid: string;\n accent: string;\n accentSoft: string;\n text: string;\n muted: string;\n}\n\nexport const THEME_TOKENS: Record<RealmId, RealmThemeTokens> = {\n cosmos: {\n bgDeep: \"#04070d\",\n bgMid: \"#0a1020\",\n accent: \"#7eb8ff\",\n accentSoft: \"rgba(126, 184, 255, 0.35)\",\n text: \"#e8f0ff\",\n muted: \"rgba(232, 240, 255, 0.65)\",\n },\n wilds: {\n bgDeep: \"#0d120c\",\n bgMid: \"#152018\",\n accent: \"#7bc96f\",\n accentSoft: \"rgba(123, 201, 111, 0.35)\",\n text: \"#eef6ea\",\n muted: \"rgba(238, 246, 234, 0.7)\",\n },\n};\n\n/**\n * Scene tree visualization theme, mirroring the THEMES object in\n * resources/js/scene-tree-viewer.js.\n */\nexport interface SceneTreeTheme {\n bg: string;\n edgeChoice: string;\n edgeGoto: string;\n nodeDefault: string;\n nodeActive: string;\n borderDefault: string;\n borderActive: string;\n labelDefault: string;\n labelActive: string;\n nodeLockedFill: string;\n nodeLockedBorder: string;\n labelLocked: string;\n nodeShape: \"star\" | \"rect\";\n rectRx: number;\n}\n\nexport const SCENE_TREE_THEMES: Record<RealmId, SceneTreeTheme> = {\n cosmos: {\n bg: \"#020408\",\n edgeChoice: \"#e8f0ff\",\n edgeGoto: \"#4a9fff\",\n nodeDefault: \"#ffffff\",\n nodeActive: \"#ffd47e\",\n borderDefault: \"#3a5080\",\n borderActive: \"#fff6d0\",\n labelDefault: \"rgba(220, 232, 255, 0.92)\",\n labelActive: \"rgba(255, 246, 220, 0.98)\",\n nodeLockedFill: \"#151a28\",\n nodeLockedBorder: \"#2a3348\",\n labelLocked: \"rgba(200, 210, 230, 0.35)\",\n nodeShape: \"star\",\n rectRx: 2,\n },\n wilds: {\n bg: \"#04070d\",\n edgeChoice: \"#ffffff\",\n edgeGoto: \"#6ecf7a\",\n nodeDefault: \"#e8f5e4\",\n nodeActive: \"#d31e2f\",\n borderDefault: \"#2d4a32\",\n borderActive: \"#ff9ea8\",\n labelDefault: \"rgba(232, 245, 228, 0.92)\",\n labelActive: \"rgba(255, 214, 219, 0.98)\",\n nodeLockedFill: \"#1a221c\",\n nodeLockedBorder: \"#2a3d30\",\n labelLocked: \"rgba(200, 220, 200, 0.38)\",\n nodeShape: \"rect\",\n rectRx: 3,\n },\n};\n\n/**\n * Get theme tokens for a realm, defaulting to wilds.\n */\nexport function getThemeTokens(realmId: RealmId | null | undefined): RealmThemeTokens {\n return THEME_TOKENS[realmId ?? \"wilds\"] ?? THEME_TOKENS.wilds;\n}\n\n/**\n * Get scene tree theme for a realm, defaulting to wilds.\n */\nexport function getSceneTreeTheme(realmId: RealmId | null | undefined): SceneTreeTheme {\n return SCENE_TREE_THEMES[realmId ?? \"wilds\"] ?? SCENE_TREE_THEMES.wilds;\n}\n","import { Canvas } from \"@react-three/fiber\";\nimport { OrbitControls, Stars as DreiStars } from \"@react-three/drei\";\nimport type { ReactNode } from \"react\";\nimport { THEME_TOKENS } from \"../../../themes/index.js\";\n\nexport interface WorldProps {\n children: ReactNode;\n /** Pixel device ratio cap. Default 2 — keeps perf bounded on retina laptops. */\n dpr?: number | [number, number];\n}\n\n/**\n * Cosmos environment shell. Wraps an r3f Canvas with deep-space background,\n * ambient starfield (drei <Stars> for the *backdrop* — distinct from our\n * film-stars), and a placeholder OrbitControls camera. The real NavRig\n * (consuming an IntentSource and doing focus-snap on dpad) replaces\n * OrbitControls in a follow-up package.\n */\nexport function World({ children, dpr = [1, 2] }: WorldProps) {\n return (\n <Canvas\n camera={{ position: [0, 6, 32], fov: 60, near: 0.1, far: 500 }}\n dpr={dpr}\n gl={{ antialias: true }}\n >\n <color attach=\"background\" args={[THEME_TOKENS.cosmos.bgDeep]} />\n <ambientLight intensity={0.15} />\n <DreiStars\n radius={120}\n depth={60}\n count={3000}\n factor={4}\n fade\n saturation={0.4}\n />\n <OrbitControls enablePan={false} maxDistance={80} minDistance={4} />\n {children}\n </Canvas>\n );\n}\n","import { useRef } from \"react\";\nimport { useFrame } from \"@react-three/fiber\";\nimport type { Mesh } from \"three\";\nimport type { AtomVisualProps } from \"../../index.js\";\n\nexport interface StarProps {\n visual: AtomVisualProps;\n onSelect?: () => void;\n /** Reduce brightness and saturation to indicate an unwatched scene. */\n dimmed?: boolean;\n /** Non-navigable — suppresses click and lowers brightness further. */\n locked?: boolean;\n}\n\n/**\n * One film as a star. Color is HSL-derived from the realm mapping's hue +\n * intensity. Each star pulses on its own phase so a thousand of them don't\n * breathe in lockstep — gives the field life without per-star animation\n * state.\n */\nexport function Star({ visual, onSelect, dimmed, locked }: StarProps) {\n const ref = useRef<Mesh>(null);\n\n useFrame(({ clock }) => {\n if (!ref.current) return;\n const phase = visual.position[0] * 0.7 + visual.position[2] * 0.3;\n const pulse = 1 + Math.sin(clock.elapsedTime * 0.8 + phase) * 0.05;\n ref.current.scale.setScalar(visual.scale * pulse);\n });\n\n const saturation = dimmed || locked ? 25 : 75;\n const lightness = dimmed || locked\n ? 25 + visual.intensity * 10\n : 50 + visual.intensity * 25;\n const color = `hsl(${visual.hue}, ${saturation}%, ${lightness}%)`;\n\n const handleClick = locked\n ? undefined\n : onSelect\n ? (e: any) => {\n e.stopPropagation();\n onSelect();\n }\n : undefined;\n\n return (\n <mesh\n ref={ref}\n position={visual.position}\n onClick={handleClick}\n >\n <sphereGeometry args={[0.5, 16, 16]} />\n <meshBasicMaterial\n color={color}\n toneMapped={false}\n transparent={!!(dimmed || locked)}\n opacity={dimmed ? 0.35 : locked ? 0.25 : 1}\n />\n </mesh>\n );\n}\n","import { useMemo } from \"react\";\nimport { Line } from \"@react-three/drei\";\nimport * as THREE from \"three\";\n\nexport interface ConstellationEdgeProps {\n from: [number, number, number];\n to: [number, number, number];\n hueA: number;\n hueB: number;\n /** Inward gap so the line doesn't touch the star spheres. */\n gap?: number;\n intensityA?: number;\n intensityB?: number;\n /** Reduce opacity to indicate an unwatched connection. */\n dimmed?: boolean;\n}\n\n/**\n * A luminous line connecting two stars in a constellation. Endpoints are\n * pulled inward so the line floats between the stars rather than touching\n * them. Color interpolates from hueA to hueB via vertex colors.\n *\n * Two overlapping lines produce the glow: a thin bright core and a wider\n * soft bloom behind it.\n */\nexport function ConstellationEdge({\n from,\n to,\n hueA,\n hueB,\n gap = 0.55,\n intensityA = 0.5,\n intensityB = 0.5,\n dimmed,\n}: ConstellationEdgeProps) {\n const { points, colorA, colorB, glowA, glowB } = useMemo(() => {\n const a = new THREE.Vector3(...from);\n const b = new THREE.Vector3(...to);\n const dir = b.clone().sub(a);\n const len = dir.length();\n\n if (len < gap * 2.5) {\n return { points: null, colorA: null, colorB: null, glowA: null, glowB: null };\n }\n\n dir.normalize();\n const start = a.clone().add(dir.clone().multiplyScalar(gap));\n const end = b.clone().sub(dir.clone().multiplyScalar(gap));\n\n const lA = 55 + intensityA * 20;\n const lB = 55 + intensityB * 20;\n\n const cA = new THREE.Color(`hsl(${hueA}, 70%, ${lA}%)`);\n const cB = new THREE.Color(`hsl(${hueB}, 70%, ${lB}%)`);\n\n const gA = new THREE.Color(`hsl(${hueA}, 50%, ${lA + 10}%)`);\n const gB = new THREE.Color(`hsl(${hueB}, 50%, ${lB + 10}%)`);\n\n return {\n points: [start, end] as [THREE.Vector3, THREE.Vector3],\n colorA: cA,\n colorB: cB,\n glowA: gA,\n glowB: gB,\n };\n }, [from, to, hueA, hueB, gap, intensityA, intensityB]);\n\n if (!points || !colorA || !colorB || !glowA || !glowB) return null;\n\n const glowOpacity = dimmed ? 0.04 : 0.12;\n const coreOpacity = dimmed ? 0.15 : 0.6;\n\n return (\n <group>\n {/* Outer glow pass */}\n <Line\n points={points}\n vertexColors={[glowA, glowB]}\n lineWidth={4}\n transparent\n opacity={glowOpacity}\n toneMapped={false}\n />\n {/* Inner core pass */}\n <Line\n points={points}\n vertexColors={[colorA, colorB]}\n lineWidth={1.5}\n transparent\n opacity={coreOpacity}\n toneMapped={false}\n />\n </group>\n );\n}\n","import type { AtomVisualProps } from \"../../index.js\";\nimport { Star } from \"./Star.js\";\nimport { ConstellationEdge } from \"./ConstellationEdge.js\";\n\nexport interface ConstellationSceneEntry {\n id: string;\n /** Visual with final position already computed by the consumer. */\n visual: AtomVisualProps;\n /** When true the star renders at reduced brightness/saturation. */\n dimmed?: boolean;\n /** When true the star is non-navigable (click suppressed). */\n locked?: boolean;\n}\n\nexport interface ConstellationProps {\n /** Scene entries in order (title first, end last), already positioned. */\n scenes: ConstellationSceneEntry[];\n onSceneSelect?: (index: number) => void;\n}\n\n/**\n * A single story rendered as a constellation: scene-stars connected by\n * luminous gradient edges. This is the cosmos realm's `Group` component —\n * identical rendering for own and others' stories.\n *\n * The consumer provides scenes with positions already computed so that\n * overlay logic (camera targeting, focus rings) can use the same positions.\n */\nexport function Constellation({\n scenes,\n onSceneSelect,\n}: ConstellationProps) {\n return (\n <group>\n {scenes.map((entry, i) => (\n <Star\n key={entry.id}\n visual={entry.visual}\n dimmed={entry.dimmed}\n locked={entry.locked}\n onSelect={onSceneSelect ? () => onSceneSelect(i) : undefined}\n />\n ))}\n\n {scenes.map((entry, i) => {\n if (i === 0) return null;\n const prev = scenes[i - 1];\n const edgeDimmed = !!(entry.dimmed || prev.dimmed);\n return (\n <ConstellationEdge\n key={`edge-${prev.id}-${entry.id}`}\n from={prev.visual.position}\n to={entry.visual.position}\n hueA={prev.visual.hue}\n hueB={entry.visual.hue}\n intensityA={prev.visual.intensity}\n intensityB={entry.visual.intensity}\n dimmed={edgeDimmed}\n />\n );\n })}\n </group>\n );\n}\n","import type { StoryListItem } from \"../../types/index.js\";\nimport type { AtomMapping, AtomState, AudioPalette, MotionTokens } from \"../index.js\";\n\n/**\n * COSMOS realm — pure-data layer. The 3D components (World, Star, NavRig,\n * EngageTransition) live in a follow-up package once the JSX build is\n * wired up; this file owns the realm's mapping and tuning constants so\n * they can be consumed today by any non-3D surface (catalog list, search,\n * preview cards, sound design tooling).\n *\n * Mapping rationale:\n * runtime → scale (longer film = bigger star)\n * popularity → intensity (more watches = brighter)\n * mood → hue (warm/cool palette by tone)\n * genre → spectral hint (small offset on top of mood, reads as\n * \"stellar class\" — drama is yellow-G,\n * thriller is blue-O, romance is red-M).\n * state → orbit-ring rendering (handled by Atom component).\n */\n\nconst GENRE_HUE_OFFSET: Record<string, number> = {\n drama: 50,\n thriller: 220,\n horror: 0,\n comedy: 35,\n romance: 340,\n scifi: 200,\n documentary: 180,\n animation: 280,\n};\n\nconst MOOD_HUE: Record<string, number> = {\n bright: 50,\n warm: 25,\n bittersweet: 290,\n somber: 230,\n tense: 210,\n playful: 110,\n melancholy: 250,\n};\n\nfunction clamp01(n: number): number {\n return Math.max(0, Math.min(1, n));\n}\n\nfunction popularityToIntensity(film: StoryListItem): number {\n // Log-compress: a 100x more-watched film should not be 100x brighter.\n const watches = Math.max(0, film.watch_starts_count);\n const log = Math.log10(1 + watches);\n // Rough cap at ~6 (1M watches saturates the scale).\n return clamp01(log / 6);\n}\n\nfunction deriveScale(film: StoryListItem): number {\n // We don't have runtime in StoryListItem yet; proxy with scenes_count.\n // Caps the starfield from going visually noisy.\n const scenes = film.scenes_count ?? 1;\n return clamp01(0.25 + Math.log10(1 + scenes) / 4);\n}\n\nfunction deriveHue(film: StoryListItem): number {\n const genreKey = (film.genre ?? \"\").toLowerCase().replace(/[^a-z]/g, \"\");\n const moodKey = \"\";\n const moodHue = MOOD_HUE[moodKey];\n const genreOffset = GENRE_HUE_OFFSET[genreKey];\n if (moodHue !== undefined) return moodHue;\n if (genreOffset !== undefined) return genreOffset;\n return 210;\n}\n\nfunction deriveState(film: StoryListItem): AtomState {\n // Without per-user progress threaded through, default; the consuming\n // app will overlay state from CatalogResponse.meta.progress.\n return film.published ? \"default\" : \"new\";\n}\n\nexport const cosmosMapping: AtomMapping = (film) => ({\n position: [0, 0, 0], // assigned by the realm's spatial layouter\n scale: deriveScale(film),\n hue: deriveHue(film),\n intensity: popularityToIntensity(film),\n state: deriveState(film),\n metadata: {\n title: film.title,\n popularity: film.watch_starts_count,\n genre: film.genre,\n },\n});\n\nexport const cosmosMotion: MotionTokens = {\n flightAcceleration: 14,\n flightDamping: 0.92,\n focusEaseMs: 380,\n engageDurationMs: 900,\n backDurationMs: 900,\n};\n\nexport const cosmosAudio: AudioPalette = {\n // Asset paths are resolved by the host app's asset bundler; chuzi-shared\n // only declares the contract. Replace with CDN URLs at integration time.\n ambientLoop: \"audio/cosmos/ambient-deep.ogg\",\n focusChime: \"audio/cosmos/focus-shimmer.ogg\",\n engageImpact: \"audio/cosmos/dolly-in.ogg\",\n backWhoosh: \"audio/cosmos/dolly-out.ogg\",\n};\n","/**\n * Spatial distribution helpers for the cosmos realm. Kept as a stand-alone\n * module so non-3D surfaces (search overlays, accessibility list view,\n * minimap) can compute and reuse positions without pulling in three.js.\n */\n\nexport type Vec3 = [number, number, number];\n\nexport interface DistributeOptions {\n /** Outer radius of the disk in world units. */\n radius?: number;\n /** Vertical jitter band (±). Larger values flatten the disk less. */\n thickness?: number;\n /** Deterministic seed; identical seeds produce identical layouts. */\n seed?: number;\n}\n\n/**\n * Galaxy-disk distribution: stars cluster denser toward the center\n * (sqrt-r weighting), with a vertical jitter band. Deterministic when a\n * seed is provided so the same catalog produces the same starfield across\n * sessions.\n */\nexport function distributeStars(\n count: number,\n options: DistributeOptions = {},\n): Vec3[] {\n const radius = options.radius ?? 25;\n const thickness = options.thickness ?? 4;\n const random = options.seed !== undefined ? mulberry32(options.seed) : Math.random;\n\n const positions: Vec3[] = [];\n for (let i = 0; i < count; i++) {\n const r = Math.sqrt(random()) * radius;\n const theta = random() * Math.PI * 2;\n const y = (random() - 0.5) * thickness;\n positions.push([Math.cos(theta) * r, y, Math.sin(theta) * r]);\n }\n return positions;\n}\n\nfunction mulberry32(seed: number): () => number {\n let s = seed >>> 0;\n return () => {\n s = (s + 0x6d2b79f5) >>> 0;\n let t = s;\n t = Math.imul(t ^ (t >>> 15), t | 1);\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n","import { useMemo } from \"react\";\nimport type { StoryListItem } from \"../../../types/index.js\";\nimport { cosmosMapping } from \"../index.js\";\nimport { Star } from \"./Star.js\";\nimport { World } from \"./World.js\";\nimport { distributeStars, type Vec3 } from \"./layout.js\";\n\nexport interface CosmosSandboxProps {\n films: StoryListItem[];\n onFilmSelect?: (film: StoryListItem) => void;\n /** Layout seed — same seed + same films = same layout. */\n seed?: number;\n}\n\n/**\n * Drop-in 3D sandbox. Hands a list of films, gets back a navigable\n * starfield where each star is a film. Useful for: integration tests, the\n * realm-picker preview thumbnail, the editor's \"preview as star\" mode, and\n * as the smoke-test entry while migrating chuzi-web off Laravel.\n */\nexport function CosmosSandbox({\n films,\n onFilmSelect,\n seed = 1,\n}: CosmosSandboxProps) {\n const placed = useMemo(() => {\n const positions: Vec3[] = distributeStars(films.length, { seed });\n return films.map((film, i) => ({\n film,\n visual: { ...cosmosMapping(film), position: positions[i] },\n }));\n }, [films, seed]);\n\n return (\n <World>\n {placed.map(({ film, visual }) => (\n <Star\n key={film.id}\n visual={visual}\n onSelect={onFilmSelect ? () => onFilmSelect(film) : undefined}\n />\n ))}\n </World>\n );\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/themes/index.ts","../../../../src/realms/cosmos/components/World.tsx","../../../../src/realms/cosmos/components/Star.tsx","../../../../src/realms/cosmos/components/ConstellationEdge.tsx","../../../../src/realms/cosmos/components/Constellation.tsx","../../../../src/realms/cosmos/index.ts","../../../../src/realms/cosmos/components/layout.ts","../../../../src/realms/cosmos/components/CosmosSandbox.tsx"],"names":["DreiStars","jsxs","jsx","useMemo"],"mappings":";;;;;;;;;AAgBO,IAAM,YAAA,GAAkD;AAAA,EAC7D,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ,SAOV,CAUF,CAAA;ACjBO,SAAS,KAAA,CAAM,EAAE,QAAA,EAAU,GAAA,GAAM,CAAC,CAAA,EAAG,CAAC,GAAE,EAAe;AAC5D,EAAA,uBACE,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAQ,EAAE,QAAA,EAAU,CAAC,CAAA,EAAG,CAAA,EAAG,EAAE,CAAA,EAAG,GAAA,EAAK,EAAA,EAAI,IAAA,EAAM,GAAA,EAAK,KAAK,GAAA,EAAI;AAAA,MAC7D,GAAA;AAAA,MACA,EAAA,EAAI,EAAE,SAAA,EAAW,IAAA,EAAK;AAAA,MAEtB,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,OAAA,EAAA,EAAM,QAAO,YAAA,EAAa,IAAA,EAAM,CAAC,YAAA,CAAa,MAAA,CAAO,MAAM,CAAA,EAAG,CAAA;AAAA,wBAC/D,GAAA,CAAC,cAAA,EAAA,EAAa,SAAA,EAAW,IAAA,EAAM,CAAA;AAAA,wBAC/B,GAAA;AAAA,UAACA,KAAA;AAAA,UAAA;AAAA,YACC,MAAA,EAAQ,GAAA;AAAA,YACR,KAAA,EAAO,EAAA;AAAA,YACP,KAAA,EAAO,GAAA;AAAA,YACP,MAAA,EAAQ,CAAA;AAAA,YACR,IAAA,EAAI,IAAA;AAAA,YACJ,UAAA,EAAY;AAAA;AAAA,SACd;AAAA,4BACC,aAAA,EAAA,EAAc,SAAA,EAAW,OAAO,WAAA,EAAa,EAAA,EAAI,aAAa,CA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GAAe,MAAM,YAAA,CAAa,IAAI,CAAA,GAAI;AAAA,KAAA;AAAA,IAF/C,IAAA,CAAK;AAAA,GAIb,CAAA,EACH,CAAA;AAEJ","file":"index.js","sourcesContent":["import type { RealmId } from \"../types/index.js\";\n\n/**\n * CSS custom property tokens, mirroring public/css/chuzi-realms.css.\n * Use these for any non-DOM rendering (e.g. React Native, canvas).\n */\nexport interface RealmThemeTokens {\n bgDeep: string;\n bgMid: string;\n accent: string;\n accentSoft: string;\n text: string;\n muted: string;\n effectLine: string;\n}\n\nexport const THEME_TOKENS: Record<RealmId, RealmThemeTokens> = {\n cosmos: {\n bgDeep: \"#04070d\",\n bgMid: \"#0a1020\",\n accent: \"#7eb8ff\",\n accentSoft: \"rgba(126, 184, 255, 0.35)\",\n text: \"#e8f0ff\",\n muted: \"rgba(232, 240, 255, 0.65)\",\n effectLine: \"#ffb347\",\n },\n wilds: {\n bgDeep: \"#0d120c\",\n bgMid: \"#152018\",\n accent: \"#7bc96f\",\n accentSoft: \"rgba(123, 201, 111, 0.35)\",\n text: \"#eef6ea\",\n muted: \"rgba(238, 246, 234, 0.7)\",\n effectLine: \"#b78aff\",\n },\n};\n\n/**\n * Scene tree visualization theme, mirroring the THEMES object in\n * resources/js/scene-tree-viewer.js.\n */\nexport interface SceneTreeTheme {\n bg: string;\n edgeChoice: string;\n edgeGoto: string;\n nodeDefault: string;\n nodeActive: string;\n borderDefault: string;\n borderActive: string;\n labelDefault: string;\n labelActive: string;\n nodeLockedFill: string;\n nodeLockedBorder: string;\n labelLocked: string;\n nodeShape: \"star\" | \"rect\";\n rectRx: number;\n}\n\nexport const SCENE_TREE_THEMES: Record<RealmId, SceneTreeTheme> = {\n cosmos: {\n bg: \"#020408\",\n edgeChoice: \"#e8f0ff\",\n edgeGoto: \"#4a9fff\",\n nodeDefault: \"#ffffff\",\n nodeActive: \"#ffd47e\",\n borderDefault: \"#3a5080\",\n borderActive: \"#fff6d0\",\n labelDefault: \"rgba(220, 232, 255, 0.92)\",\n labelActive: \"rgba(255, 246, 220, 0.98)\",\n nodeLockedFill: \"#151a28\",\n nodeLockedBorder: \"#2a3348\",\n labelLocked: \"rgba(200, 210, 230, 0.35)\",\n nodeShape: \"star\",\n rectRx: 2,\n },\n wilds: {\n bg: \"#04070d\",\n edgeChoice: \"#ffffff\",\n edgeGoto: \"#6ecf7a\",\n nodeDefault: \"#e8f5e4\",\n nodeActive: \"#d31e2f\",\n borderDefault: \"#2d4a32\",\n borderActive: \"#ff9ea8\",\n labelDefault: \"rgba(232, 245, 228, 0.92)\",\n labelActive: \"rgba(255, 214, 219, 0.98)\",\n nodeLockedFill: \"#1a221c\",\n nodeLockedBorder: \"#2a3d30\",\n labelLocked: \"rgba(200, 220, 200, 0.38)\",\n nodeShape: \"rect\",\n rectRx: 3,\n },\n};\n\n/**\n * Get theme tokens for a realm, defaulting to wilds.\n */\nexport function getThemeTokens(realmId: RealmId | null | undefined): RealmThemeTokens {\n return THEME_TOKENS[realmId ?? \"wilds\"] ?? THEME_TOKENS.wilds;\n}\n\n/**\n * Get scene tree theme for a realm, defaulting to wilds.\n */\nexport function getSceneTreeTheme(realmId: RealmId | null | undefined): SceneTreeTheme {\n return SCENE_TREE_THEMES[realmId ?? \"wilds\"] ?? SCENE_TREE_THEMES.wilds;\n}\n","import { Canvas } from \"@react-three/fiber\";\nimport { OrbitControls, Stars as DreiStars } from \"@react-three/drei\";\nimport type { ReactNode } from \"react\";\nimport { THEME_TOKENS } from \"../../../themes/index.js\";\n\nexport interface WorldProps {\n children: ReactNode;\n /** Pixel device ratio cap. Default 2 — keeps perf bounded on retina laptops. */\n dpr?: number | [number, number];\n}\n\n/**\n * Cosmos environment shell. Wraps an r3f Canvas with deep-space background,\n * ambient starfield (drei <Stars> for the *backdrop* — distinct from our\n * film-stars), and a placeholder OrbitControls camera. The real NavRig\n * (consuming an IntentSource and doing focus-snap on dpad) replaces\n * OrbitControls in a follow-up package.\n */\nexport function World({ children, dpr = [1, 2] }: WorldProps) {\n return (\n <Canvas\n camera={{ position: [0, 6, 32], fov: 60, near: 0.1, far: 500 }}\n dpr={dpr}\n gl={{ antialias: true }}\n >\n <color attach=\"background\" args={[THEME_TOKENS.cosmos.bgDeep]} />\n <ambientLight intensity={0.15} />\n <DreiStars\n radius={120}\n depth={60}\n count={3000}\n factor={4}\n fade\n saturation={0.4}\n />\n <OrbitControls enablePan={false} maxDistance={80} minDistance={4} />\n {children}\n </Canvas>\n );\n}\n","import { useRef } from \"react\";\nimport { useFrame } from \"@react-three/fiber\";\nimport type { Mesh } from \"three\";\nimport type { AtomVisualProps } from \"../../index.js\";\n\nexport interface StarProps {\n visual: AtomVisualProps;\n onSelect?: () => void;\n /** Reduce brightness and saturation to indicate an unwatched scene. */\n dimmed?: boolean;\n /** Non-navigable — suppresses click and lowers brightness further. */\n locked?: boolean;\n}\n\n/**\n * One film as a star. Color is HSL-derived from the realm mapping's hue +\n * intensity. Each star pulses on its own phase so a thousand of them don't\n * breathe in lockstep — gives the field life without per-star animation\n * state.\n */\nexport function Star({ visual, onSelect, dimmed, locked }: StarProps) {\n const ref = useRef<Mesh>(null);\n\n useFrame(({ clock }) => {\n if (!ref.current) return;\n const phase = visual.position[0] * 0.7 + visual.position[2] * 0.3;\n const pulse = 1 + Math.sin(clock.elapsedTime * 0.8 + phase) * 0.05;\n ref.current.scale.setScalar(visual.scale * pulse);\n });\n\n const saturation = dimmed || locked ? 25 : 75;\n const lightness = dimmed || locked\n ? 25 + visual.intensity * 10\n : 50 + visual.intensity * 25;\n const color = `hsl(${visual.hue}, ${saturation}%, ${lightness}%)`;\n\n const handleClick = locked\n ? undefined\n : onSelect\n ? (e: any) => {\n e.stopPropagation();\n onSelect();\n }\n : undefined;\n\n return (\n <mesh\n ref={ref}\n position={visual.position}\n onClick={handleClick}\n >\n <sphereGeometry args={[0.5, 16, 16]} />\n <meshBasicMaterial\n color={color}\n toneMapped={false}\n transparent={!!(dimmed || locked)}\n opacity={dimmed ? 0.35 : locked ? 0.25 : 1}\n />\n </mesh>\n );\n}\n","import { useMemo } from \"react\";\nimport { Line } from \"@react-three/drei\";\nimport * as THREE from \"three\";\n\nexport interface ConstellationEdgeProps {\n from: [number, number, number];\n to: [number, number, number];\n hueA: number;\n hueB: number;\n /** Inward gap so the line doesn't touch the star spheres. */\n gap?: number;\n intensityA?: number;\n intensityB?: number;\n /** Reduce opacity to indicate an unwatched connection. */\n dimmed?: boolean;\n}\n\n/**\n * A luminous line connecting two stars in a constellation. Endpoints are\n * pulled inward so the line floats between the stars rather than touching\n * them. Color interpolates from hueA to hueB via vertex colors.\n *\n * Two overlapping lines produce the glow: a thin bright core and a wider\n * soft bloom behind it.\n */\nexport function ConstellationEdge({\n from,\n to,\n hueA,\n hueB,\n gap = 0.55,\n intensityA = 0.5,\n intensityB = 0.5,\n dimmed,\n}: ConstellationEdgeProps) {\n const { points, colorA, colorB, glowA, glowB } = useMemo(() => {\n const a = new THREE.Vector3(...from);\n const b = new THREE.Vector3(...to);\n const dir = b.clone().sub(a);\n const len = dir.length();\n\n if (len < gap * 2.5) {\n return { points: null, colorA: null, colorB: null, glowA: null, glowB: null };\n }\n\n dir.normalize();\n const start = a.clone().add(dir.clone().multiplyScalar(gap));\n const end = b.clone().sub(dir.clone().multiplyScalar(gap));\n\n const lA = 55 + intensityA * 20;\n const lB = 55 + intensityB * 20;\n\n const cA = new THREE.Color(`hsl(${hueA}, 70%, ${lA}%)`);\n const cB = new THREE.Color(`hsl(${hueB}, 70%, ${lB}%)`);\n\n const gA = new THREE.Color(`hsl(${hueA}, 50%, ${lA + 10}%)`);\n const gB = new THREE.Color(`hsl(${hueB}, 50%, ${lB + 10}%)`);\n\n return {\n points: [start, end] as [THREE.Vector3, THREE.Vector3],\n colorA: cA,\n colorB: cB,\n glowA: gA,\n glowB: gB,\n };\n }, [from, to, hueA, hueB, gap, intensityA, intensityB]);\n\n if (!points || !colorA || !colorB || !glowA || !glowB) return null;\n\n const glowOpacity = dimmed ? 0.04 : 0.12;\n const coreOpacity = dimmed ? 0.15 : 0.6;\n\n return (\n <group>\n {/* Outer glow pass */}\n <Line\n points={points}\n vertexColors={[glowA, glowB]}\n lineWidth={4}\n transparent\n opacity={glowOpacity}\n toneMapped={false}\n />\n {/* Inner core pass */}\n <Line\n points={points}\n vertexColors={[colorA, colorB]}\n lineWidth={1.5}\n transparent\n opacity={coreOpacity}\n toneMapped={false}\n />\n </group>\n );\n}\n","import type { AtomVisualProps } from \"../../index.js\";\nimport { Star } from \"./Star.js\";\nimport { ConstellationEdge } from \"./ConstellationEdge.js\";\n\nexport interface ConstellationSceneEntry {\n id: string;\n /** Visual with final position already computed by the consumer. */\n visual: AtomVisualProps;\n /** When true the star renders at reduced brightness/saturation. */\n dimmed?: boolean;\n /** When true the star is non-navigable (click suppressed). */\n locked?: boolean;\n}\n\nexport interface ConstellationProps {\n /** Scene entries in order (title first, end last), already positioned. */\n scenes: ConstellationSceneEntry[];\n onSceneSelect?: (index: number) => void;\n}\n\n/**\n * A single story rendered as a constellation: scene-stars connected by\n * luminous gradient edges. This is the cosmos realm's `Group` component —\n * identical rendering for own and others' stories.\n *\n * The consumer provides scenes with positions already computed so that\n * overlay logic (camera targeting, focus rings) can use the same positions.\n */\nexport function Constellation({\n scenes,\n onSceneSelect,\n}: ConstellationProps) {\n return (\n <group>\n {scenes.map((entry, i) => (\n <Star\n key={entry.id}\n visual={entry.visual}\n dimmed={entry.dimmed}\n locked={entry.locked}\n onSelect={onSceneSelect ? () => onSceneSelect(i) : undefined}\n />\n ))}\n\n {scenes.map((entry, i) => {\n if (i === 0) return null;\n const prev = scenes[i - 1];\n const edgeDimmed = !!(entry.dimmed || prev.dimmed);\n return (\n <ConstellationEdge\n key={`edge-${prev.id}-${entry.id}`}\n from={prev.visual.position}\n to={entry.visual.position}\n hueA={prev.visual.hue}\n hueB={entry.visual.hue}\n intensityA={prev.visual.intensity}\n intensityB={entry.visual.intensity}\n dimmed={edgeDimmed}\n />\n );\n })}\n </group>\n );\n}\n","import type { StoryListItem } from \"../../types/index.js\";\nimport type { AtomMapping, AtomState, AudioPalette, MotionTokens } from \"../index.js\";\n\n/**\n * COSMOS realm — pure-data layer. The 3D components (World, Star, NavRig,\n * EngageTransition) live in a follow-up package once the JSX build is\n * wired up; this file owns the realm's mapping and tuning constants so\n * they can be consumed today by any non-3D surface (catalog list, search,\n * preview cards, sound design tooling).\n *\n * Mapping rationale:\n * runtime → scale (longer film = bigger star)\n * popularity → intensity (more watches = brighter)\n * mood → hue (warm/cool palette by tone)\n * genre → spectral hint (small offset on top of mood, reads as\n * \"stellar class\" — drama is yellow-G,\n * thriller is blue-O, romance is red-M).\n * state → orbit-ring rendering (handled by Atom component).\n */\n\nconst GENRE_HUE_OFFSET: Record<string, number> = {\n drama: 50,\n thriller: 220,\n horror: 0,\n comedy: 35,\n romance: 340,\n scifi: 200,\n documentary: 180,\n animation: 280,\n};\n\nconst MOOD_HUE: Record<string, number> = {\n bright: 50,\n warm: 25,\n bittersweet: 290,\n somber: 230,\n tense: 210,\n playful: 110,\n melancholy: 250,\n};\n\nfunction clamp01(n: number): number {\n return Math.max(0, Math.min(1, n));\n}\n\nfunction popularityToIntensity(film: StoryListItem): number {\n // Log-compress: a 100x more-watched film should not be 100x brighter.\n const watches = Math.max(0, film.watch_starts_count);\n const log = Math.log10(1 + watches);\n // Rough cap at ~6 (1M watches saturates the scale).\n return clamp01(log / 6);\n}\n\nfunction deriveScale(film: StoryListItem): number {\n // We don't have runtime in StoryListItem yet; proxy with scenes_count.\n // Caps the starfield from going visually noisy.\n const scenes = film.scenes_count ?? 1;\n return clamp01(0.25 + Math.log10(1 + scenes) / 4);\n}\n\nfunction deriveHue(film: StoryListItem): number {\n const genreKey = (film.genre ?? \"\").toLowerCase().replace(/[^a-z]/g, \"\");\n const moodKey = \"\";\n const moodHue = MOOD_HUE[moodKey];\n const genreOffset = GENRE_HUE_OFFSET[genreKey];\n if (moodHue !== undefined) return moodHue;\n if (genreOffset !== undefined) return genreOffset;\n return 210;\n}\n\nfunction deriveState(film: StoryListItem): AtomState {\n // Without per-user progress threaded through, default; the consuming\n // app will overlay state from CatalogResponse.meta.progress.\n return film.published ? \"default\" : \"new\";\n}\n\nexport const cosmosMapping: AtomMapping = (film) => ({\n position: [0, 0, 0], // assigned by the realm's spatial layouter\n scale: deriveScale(film),\n hue: deriveHue(film),\n intensity: popularityToIntensity(film),\n state: deriveState(film),\n metadata: {\n title: film.title,\n popularity: film.watch_starts_count,\n genre: film.genre,\n },\n});\n\nexport const cosmosMotion: MotionTokens = {\n flightAcceleration: 14,\n flightDamping: 0.92,\n focusEaseMs: 380,\n engageDurationMs: 900,\n backDurationMs: 900,\n};\n\nexport const cosmosAudio: AudioPalette = {\n // Asset paths are resolved by the host app's asset bundler; chuzi-shared\n // only declares the contract. Replace with CDN URLs at integration time.\n ambientLoop: \"audio/cosmos/ambient-deep.ogg\",\n focusChime: \"audio/cosmos/focus-shimmer.ogg\",\n engageImpact: \"audio/cosmos/dolly-in.ogg\",\n backWhoosh: \"audio/cosmos/dolly-out.ogg\",\n};\n","/**\n * Spatial distribution helpers for the cosmos realm. Kept as a stand-alone\n * module so non-3D surfaces (search overlays, accessibility list view,\n * minimap) can compute and reuse positions without pulling in three.js.\n */\n\nexport type Vec3 = [number, number, number];\n\nexport interface DistributeOptions {\n /** Outer radius of the disk in world units. */\n radius?: number;\n /** Vertical jitter band (±). Larger values flatten the disk less. */\n thickness?: number;\n /** Deterministic seed; identical seeds produce identical layouts. */\n seed?: number;\n}\n\n/**\n * Galaxy-disk distribution: stars cluster denser toward the center\n * (sqrt-r weighting), with a vertical jitter band. Deterministic when a\n * seed is provided so the same catalog produces the same starfield across\n * sessions.\n */\nexport function distributeStars(\n count: number,\n options: DistributeOptions = {},\n): Vec3[] {\n const radius = options.radius ?? 25;\n const thickness = options.thickness ?? 4;\n const random = options.seed !== undefined ? mulberry32(options.seed) : Math.random;\n\n const positions: Vec3[] = [];\n for (let i = 0; i < count; i++) {\n const r = Math.sqrt(random()) * radius;\n const theta = random() * Math.PI * 2;\n const y = (random() - 0.5) * thickness;\n positions.push([Math.cos(theta) * r, y, Math.sin(theta) * r]);\n }\n return positions;\n}\n\nfunction mulberry32(seed: number): () => number {\n let s = seed >>> 0;\n return () => {\n s = (s + 0x6d2b79f5) >>> 0;\n let t = s;\n t = Math.imul(t ^ (t >>> 15), t | 1);\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n","import { useMemo } from \"react\";\nimport type { StoryListItem } from \"../../../types/index.js\";\nimport { cosmosMapping } from \"../index.js\";\nimport { Star } from \"./Star.js\";\nimport { World } from \"./World.js\";\nimport { distributeStars, type Vec3 } from \"./layout.js\";\n\nexport interface CosmosSandboxProps {\n films: StoryListItem[];\n onFilmSelect?: (film: StoryListItem) => void;\n /** Layout seed — same seed + same films = same layout. */\n seed?: number;\n}\n\n/**\n * Drop-in 3D sandbox. Hands a list of films, gets back a navigable\n * starfield where each star is a film. Useful for: integration tests, the\n * realm-picker preview thumbnail, the editor's \"preview as star\" mode, and\n * as the smoke-test entry while migrating chuzi-web off Laravel.\n */\nexport function CosmosSandbox({\n films,\n onFilmSelect,\n seed = 1,\n}: CosmosSandboxProps) {\n const placed = useMemo(() => {\n const positions: Vec3[] = distributeStars(films.length, { seed });\n return films.map((film, i) => ({\n film,\n visual: { ...cosmosMapping(film), position: positions[i] },\n }));\n }, [films, seed]);\n\n return (\n <World>\n {placed.map(({ film, visual }) => (\n <Star\n key={film.id}\n visual={visual}\n onSelect={onFilmSelect ? () => onFilmSelect(film) : undefined}\n />\n ))}\n </World>\n );\n}\n"]}
@@ -11,6 +11,7 @@ interface RealmThemeTokens {
11
11
  accentSoft: string;
12
12
  text: string;
13
13
  muted: string;
14
+ effectLine: string;
14
15
  }
15
16
  declare const THEME_TOKENS: Record<RealmId, RealmThemeTokens>;
16
17
  /**
@@ -6,7 +6,8 @@ var THEME_TOKENS = {
6
6
  accent: "#7eb8ff",
7
7
  accentSoft: "rgba(126, 184, 255, 0.35)",
8
8
  text: "#e8f0ff",
9
- muted: "rgba(232, 240, 255, 0.65)"
9
+ muted: "rgba(232, 240, 255, 0.65)",
10
+ effectLine: "#ffb347"
10
11
  },
11
12
  wilds: {
12
13
  bgDeep: "#0d120c",
@@ -14,7 +15,8 @@ var THEME_TOKENS = {
14
15
  accent: "#7bc96f",
15
16
  accentSoft: "rgba(123, 201, 111, 0.35)",
16
17
  text: "#eef6ea",
17
- muted: "rgba(238, 246, 234, 0.7)"
18
+ muted: "rgba(238, 246, 234, 0.7)",
19
+ effectLine: "#b78aff"
18
20
  }
19
21
  };
20
22
  var SCENE_TREE_THEMES = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/themes/index.ts"],"names":[],"mappings":";AAeO,IAAM,YAAA,GAAkD;AAAA,EAC7D,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ,SAAA;AAAA,IACR,KAAA,EAAO,SAAA;AAAA,IACP,MAAA,EAAQ,SAAA;AAAA,IACR,UAAA,EAAY,2BAAA;AAAA,IACZ,IAAA,EAAM,SAAA;AAAA,IACN,KAAA,EAAO;AAAA,GACT;AAAA,EACA,KAAA,EAAO;AAAA,IACL,MAAA,EAAQ,SAAA;AAAA,IACR,KAAA,EAAO,SAAA;AAAA,IACP,MAAA,EAAQ,SAAA;AAAA,IACR,UAAA,EAAY,2BAAA;AAAA,IACZ,IAAA,EAAM,SAAA;AAAA,IACN,KAAA,EAAO;AAAA;AAEX;AAuBO,IAAM,iBAAA,GAAqD;AAAA,EAChE,MAAA,EAAQ;AAAA,IACN,EAAA,EAAI,SAAA;AAAA,IACJ,UAAA,EAAY,SAAA;AAAA,IACZ,QAAA,EAAU,SAAA;AAAA,IACV,WAAA,EAAa,SAAA;AAAA,IACb,UAAA,EAAY,SAAA;AAAA,IACZ,aAAA,EAAe,SAAA;AAAA,IACf,YAAA,EAAc,SAAA;AAAA,IACd,YAAA,EAAc,2BAAA;AAAA,IACd,WAAA,EAAa,2BAAA;AAAA,IACb,cAAA,EAAgB,SAAA;AAAA,IAChB,gBAAA,EAAkB,SAAA;AAAA,IAClB,WAAA,EAAa,2BAAA;AAAA,IACb,SAAA,EAAW,MAAA;AAAA,IACX,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,KAAA,EAAO;AAAA,IACL,EAAA,EAAI,SAAA;AAAA,IACJ,UAAA,EAAY,SAAA;AAAA,IACZ,QAAA,EAAU,SAAA;AAAA,IACV,WAAA,EAAa,SAAA;AAAA,IACb,UAAA,EAAY,SAAA;AAAA,IACZ,aAAA,EAAe,SAAA;AAAA,IACf,YAAA,EAAc,SAAA;AAAA,IACd,YAAA,EAAc,2BAAA;AAAA,IACd,WAAA,EAAa,2BAAA;AAAA,IACb,cAAA,EAAgB,SAAA;AAAA,IAChB,gBAAA,EAAkB,SAAA;AAAA,IAClB,WAAA,EAAa,2BAAA;AAAA,IACb,SAAA,EAAW,MAAA;AAAA,IACX,MAAA,EAAQ;AAAA;AAEZ;AAKO,SAAS,eAAe,OAAA,EAAuD;AACpF,EAAA,OAAO,YAAA,CAAa,OAAA,IAAW,OAAO,CAAA,IAAK,YAAA,CAAa,KAAA;AAC1D;AAKO,SAAS,kBAAkB,OAAA,EAAqD;AACrF,EAAA,OAAO,iBAAA,CAAkB,OAAA,IAAW,OAAO,CAAA,IAAK,iBAAA,CAAkB,KAAA;AACpE","file":"index.js","sourcesContent":["import type { RealmId } from \"../types/index.js\";\n\n/**\n * CSS custom property tokens, mirroring public/css/chuzi-realms.css.\n * Use these for any non-DOM rendering (e.g. React Native, canvas).\n */\nexport interface RealmThemeTokens {\n bgDeep: string;\n bgMid: string;\n accent: string;\n accentSoft: string;\n text: string;\n muted: string;\n}\n\nexport const THEME_TOKENS: Record<RealmId, RealmThemeTokens> = {\n cosmos: {\n bgDeep: \"#04070d\",\n bgMid: \"#0a1020\",\n accent: \"#7eb8ff\",\n accentSoft: \"rgba(126, 184, 255, 0.35)\",\n text: \"#e8f0ff\",\n muted: \"rgba(232, 240, 255, 0.65)\",\n },\n wilds: {\n bgDeep: \"#0d120c\",\n bgMid: \"#152018\",\n accent: \"#7bc96f\",\n accentSoft: \"rgba(123, 201, 111, 0.35)\",\n text: \"#eef6ea\",\n muted: \"rgba(238, 246, 234, 0.7)\",\n },\n};\n\n/**\n * Scene tree visualization theme, mirroring the THEMES object in\n * resources/js/scene-tree-viewer.js.\n */\nexport interface SceneTreeTheme {\n bg: string;\n edgeChoice: string;\n edgeGoto: string;\n nodeDefault: string;\n nodeActive: string;\n borderDefault: string;\n borderActive: string;\n labelDefault: string;\n labelActive: string;\n nodeLockedFill: string;\n nodeLockedBorder: string;\n labelLocked: string;\n nodeShape: \"star\" | \"rect\";\n rectRx: number;\n}\n\nexport const SCENE_TREE_THEMES: Record<RealmId, SceneTreeTheme> = {\n cosmos: {\n bg: \"#020408\",\n edgeChoice: \"#e8f0ff\",\n edgeGoto: \"#4a9fff\",\n nodeDefault: \"#ffffff\",\n nodeActive: \"#ffd47e\",\n borderDefault: \"#3a5080\",\n borderActive: \"#fff6d0\",\n labelDefault: \"rgba(220, 232, 255, 0.92)\",\n labelActive: \"rgba(255, 246, 220, 0.98)\",\n nodeLockedFill: \"#151a28\",\n nodeLockedBorder: \"#2a3348\",\n labelLocked: \"rgba(200, 210, 230, 0.35)\",\n nodeShape: \"star\",\n rectRx: 2,\n },\n wilds: {\n bg: \"#04070d\",\n edgeChoice: \"#ffffff\",\n edgeGoto: \"#6ecf7a\",\n nodeDefault: \"#e8f5e4\",\n nodeActive: \"#d31e2f\",\n borderDefault: \"#2d4a32\",\n borderActive: \"#ff9ea8\",\n labelDefault: \"rgba(232, 245, 228, 0.92)\",\n labelActive: \"rgba(255, 214, 219, 0.98)\",\n nodeLockedFill: \"#1a221c\",\n nodeLockedBorder: \"#2a3d30\",\n labelLocked: \"rgba(200, 220, 200, 0.38)\",\n nodeShape: \"rect\",\n rectRx: 3,\n },\n};\n\n/**\n * Get theme tokens for a realm, defaulting to wilds.\n */\nexport function getThemeTokens(realmId: RealmId | null | undefined): RealmThemeTokens {\n return THEME_TOKENS[realmId ?? \"wilds\"] ?? THEME_TOKENS.wilds;\n}\n\n/**\n * Get scene tree theme for a realm, defaulting to wilds.\n */\nexport function getSceneTreeTheme(realmId: RealmId | null | undefined): SceneTreeTheme {\n return SCENE_TREE_THEMES[realmId ?? \"wilds\"] ?? SCENE_TREE_THEMES.wilds;\n}\n"]}
1
+ {"version":3,"sources":["../../src/themes/index.ts"],"names":[],"mappings":";AAgBO,IAAM,YAAA,GAAkD;AAAA,EAC7D,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ,SAAA;AAAA,IACR,KAAA,EAAO,SAAA;AAAA,IACP,MAAA,EAAQ,SAAA;AAAA,IACR,UAAA,EAAY,2BAAA;AAAA,IACZ,IAAA,EAAM,SAAA;AAAA,IACN,KAAA,EAAO,2BAAA;AAAA,IACP,UAAA,EAAY;AAAA,GACd;AAAA,EACA,KAAA,EAAO;AAAA,IACL,MAAA,EAAQ,SAAA;AAAA,IACR,KAAA,EAAO,SAAA;AAAA,IACP,MAAA,EAAQ,SAAA;AAAA,IACR,UAAA,EAAY,2BAAA;AAAA,IACZ,IAAA,EAAM,SAAA;AAAA,IACN,KAAA,EAAO,0BAAA;AAAA,IACP,UAAA,EAAY;AAAA;AAEhB;AAuBO,IAAM,iBAAA,GAAqD;AAAA,EAChE,MAAA,EAAQ;AAAA,IACN,EAAA,EAAI,SAAA;AAAA,IACJ,UAAA,EAAY,SAAA;AAAA,IACZ,QAAA,EAAU,SAAA;AAAA,IACV,WAAA,EAAa,SAAA;AAAA,IACb,UAAA,EAAY,SAAA;AAAA,IACZ,aAAA,EAAe,SAAA;AAAA,IACf,YAAA,EAAc,SAAA;AAAA,IACd,YAAA,EAAc,2BAAA;AAAA,IACd,WAAA,EAAa,2BAAA;AAAA,IACb,cAAA,EAAgB,SAAA;AAAA,IAChB,gBAAA,EAAkB,SAAA;AAAA,IAClB,WAAA,EAAa,2BAAA;AAAA,IACb,SAAA,EAAW,MAAA;AAAA,IACX,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,KAAA,EAAO;AAAA,IACL,EAAA,EAAI,SAAA;AAAA,IACJ,UAAA,EAAY,SAAA;AAAA,IACZ,QAAA,EAAU,SAAA;AAAA,IACV,WAAA,EAAa,SAAA;AAAA,IACb,UAAA,EAAY,SAAA;AAAA,IACZ,aAAA,EAAe,SAAA;AAAA,IACf,YAAA,EAAc,SAAA;AAAA,IACd,YAAA,EAAc,2BAAA;AAAA,IACd,WAAA,EAAa,2BAAA;AAAA,IACb,cAAA,EAAgB,SAAA;AAAA,IAChB,gBAAA,EAAkB,SAAA;AAAA,IAClB,WAAA,EAAa,2BAAA;AAAA,IACb,SAAA,EAAW,MAAA;AAAA,IACX,MAAA,EAAQ;AAAA;AAEZ;AAKO,SAAS,eAAe,OAAA,EAAuD;AACpF,EAAA,OAAO,YAAA,CAAa,OAAA,IAAW,OAAO,CAAA,IAAK,YAAA,CAAa,KAAA;AAC1D;AAKO,SAAS,kBAAkB,OAAA,EAAqD;AACrF,EAAA,OAAO,iBAAA,CAAkB,OAAA,IAAW,OAAO,CAAA,IAAK,iBAAA,CAAkB,KAAA;AACpE","file":"index.js","sourcesContent":["import type { RealmId } from \"../types/index.js\";\n\n/**\n * CSS custom property tokens, mirroring public/css/chuzi-realms.css.\n * Use these for any non-DOM rendering (e.g. React Native, canvas).\n */\nexport interface RealmThemeTokens {\n bgDeep: string;\n bgMid: string;\n accent: string;\n accentSoft: string;\n text: string;\n muted: string;\n effectLine: string;\n}\n\nexport const THEME_TOKENS: Record<RealmId, RealmThemeTokens> = {\n cosmos: {\n bgDeep: \"#04070d\",\n bgMid: \"#0a1020\",\n accent: \"#7eb8ff\",\n accentSoft: \"rgba(126, 184, 255, 0.35)\",\n text: \"#e8f0ff\",\n muted: \"rgba(232, 240, 255, 0.65)\",\n effectLine: \"#ffb347\",\n },\n wilds: {\n bgDeep: \"#0d120c\",\n bgMid: \"#152018\",\n accent: \"#7bc96f\",\n accentSoft: \"rgba(123, 201, 111, 0.35)\",\n text: \"#eef6ea\",\n muted: \"rgba(238, 246, 234, 0.7)\",\n effectLine: \"#b78aff\",\n },\n};\n\n/**\n * Scene tree visualization theme, mirroring the THEMES object in\n * resources/js/scene-tree-viewer.js.\n */\nexport interface SceneTreeTheme {\n bg: string;\n edgeChoice: string;\n edgeGoto: string;\n nodeDefault: string;\n nodeActive: string;\n borderDefault: string;\n borderActive: string;\n labelDefault: string;\n labelActive: string;\n nodeLockedFill: string;\n nodeLockedBorder: string;\n labelLocked: string;\n nodeShape: \"star\" | \"rect\";\n rectRx: number;\n}\n\nexport const SCENE_TREE_THEMES: Record<RealmId, SceneTreeTheme> = {\n cosmos: {\n bg: \"#020408\",\n edgeChoice: \"#e8f0ff\",\n edgeGoto: \"#4a9fff\",\n nodeDefault: \"#ffffff\",\n nodeActive: \"#ffd47e\",\n borderDefault: \"#3a5080\",\n borderActive: \"#fff6d0\",\n labelDefault: \"rgba(220, 232, 255, 0.92)\",\n labelActive: \"rgba(255, 246, 220, 0.98)\",\n nodeLockedFill: \"#151a28\",\n nodeLockedBorder: \"#2a3348\",\n labelLocked: \"rgba(200, 210, 230, 0.35)\",\n nodeShape: \"star\",\n rectRx: 2,\n },\n wilds: {\n bg: \"#04070d\",\n edgeChoice: \"#ffffff\",\n edgeGoto: \"#6ecf7a\",\n nodeDefault: \"#e8f5e4\",\n nodeActive: \"#d31e2f\",\n borderDefault: \"#2d4a32\",\n borderActive: \"#ff9ea8\",\n labelDefault: \"rgba(232, 245, 228, 0.92)\",\n labelActive: \"rgba(255, 214, 219, 0.98)\",\n nodeLockedFill: \"#1a221c\",\n nodeLockedBorder: \"#2a3d30\",\n labelLocked: \"rgba(200, 220, 200, 0.38)\",\n nodeShape: \"rect\",\n rectRx: 3,\n },\n};\n\n/**\n * Get theme tokens for a realm, defaulting to wilds.\n */\nexport function getThemeTokens(realmId: RealmId | null | undefined): RealmThemeTokens {\n return THEME_TOKENS[realmId ?? \"wilds\"] ?? THEME_TOKENS.wilds;\n}\n\n/**\n * Get scene tree theme for a realm, defaulting to wilds.\n */\nexport function getSceneTreeTheme(realmId: RealmId | null | undefined): SceneTreeTheme {\n return SCENE_TREE_THEMES[realmId ?? \"wilds\"] ?? SCENE_TREE_THEMES.wilds;\n}\n"]}
@@ -284,8 +284,11 @@ interface PaginatedResponse<T> {
284
284
  to: number | null;
285
285
  total: number;
286
286
  }
287
+ type LineType = "text" | "sound" | "image";
287
288
  interface TextLine {
288
289
  id: string;
290
+ type?: LineType;
291
+ media_id?: string;
289
292
  html: string;
290
293
  appear_at_ms: number;
291
294
  fade_in_ms: number;
@@ -293,6 +296,8 @@ interface TextLine {
293
296
  duration_ms: number;
294
297
  position_x?: number;
295
298
  position_y?: number;
299
+ width_pct?: number;
300
+ height_pct?: number;
296
301
  persist?: boolean;
297
302
  }
298
303
  interface SceneTextContent {
@@ -570,4 +575,4 @@ declare function computeSceneVisibility(sceneList: Pick<SceneListItem, "is_title
570
575
  endingSeen: boolean;
571
576
  }): SceneVisibility[];
572
577
 
573
- export { type AcceptGenerationRequest, type AcceptGenerationResponse, type AiGeneration, type AiGenerationShowResponse, type AiGenerationStatus, type BookmarkListItem, type BookmarkListResponse, type BookmarkResponse, type CatalogResponse, type ContentRating, type ContentRatingDefinition, type CreateSceneActionRequest, type CreateSceneRequest, type CreateStoryRequest, type EngagementResponse, type GenerateImageRequest, type GenerateImageResponse, type HistoryEntry, type LocaleId, type MagicLinkRequest, type MagicLinkRequestResponse, type MagicLinkVerifyRequest, type MagicLinkVerifyResponse, type MediaItem, type MineResponse, type OidcExchangeRequest, type OidcExchangeResponse, type PaginatedLink, type PaginatedResponse, type PasswordLoginRequest, type PasswordLoginResponse, type PlayUrlResponse, type PopularChoice, type PublicDirectorProfile, type RealmConfigResponse, type RealmDefinition, type RealmId, type RegisterMediaRequest, type RegisterMediaResponse, type RejectGenerationRequest, type RejectGenerationResponse, type SaveBookmarkRequest, type SceneActionItem, type SceneActionPayload, type SceneChoice, type SceneListItem, type SceneMapEntry, type SceneMapResponse, type SceneNode, type SceneTextContent, type SceneVisibility, type SourceUrlResponse, type StateUpdate, type StoryListItem, type StoryPreview, type StoryProgress, type StoryStyleResponse, type TagListResponse, type TextLine, type TrackEngagementRequest, type TranscodeRequest, type TranscodeResponse, type TreeGraph, type TreeGraphEdge, type TreeGraphNode, type UpdateLocaleRequest, type UpdateLocaleResponse, type UpdateProfileRequest, type UpdateProfileResponse, type UpdateRealmRequest, type UpdateRealmResponse, type UpdateSceneActionRequest, type UpdateSceneRequest, type UpdateStoryRequest, type UploadUrlRequest, type UploadUrlResponse, type UserProfile, type UsernameAvailabilityResponse, type VisibilityCondition, type VisibilityRules, type WatchSnapshot, computeSceneVisibility };
578
+ export { type AcceptGenerationRequest, type AcceptGenerationResponse, type AiGeneration, type AiGenerationShowResponse, type AiGenerationStatus, type BookmarkListItem, type BookmarkListResponse, type BookmarkResponse, type CatalogResponse, type ContentRating, type ContentRatingDefinition, type CreateSceneActionRequest, type CreateSceneRequest, type CreateStoryRequest, type EngagementResponse, type GenerateImageRequest, type GenerateImageResponse, type HistoryEntry, type LineType, type LocaleId, type MagicLinkRequest, type MagicLinkRequestResponse, type MagicLinkVerifyRequest, type MagicLinkVerifyResponse, type MediaItem, type MineResponse, type OidcExchangeRequest, type OidcExchangeResponse, type PaginatedLink, type PaginatedResponse, type PasswordLoginRequest, type PasswordLoginResponse, type PlayUrlResponse, type PopularChoice, type PublicDirectorProfile, type RealmConfigResponse, type RealmDefinition, type RealmId, type RegisterMediaRequest, type RegisterMediaResponse, type RejectGenerationRequest, type RejectGenerationResponse, type SaveBookmarkRequest, type SceneActionItem, type SceneActionPayload, type SceneChoice, type SceneListItem, type SceneMapEntry, type SceneMapResponse, type SceneNode, type SceneTextContent, type SceneVisibility, type SourceUrlResponse, type StateUpdate, type StoryListItem, type StoryPreview, type StoryProgress, type StoryStyleResponse, type TagListResponse, type TextLine, type TrackEngagementRequest, type TranscodeRequest, type TranscodeResponse, type TreeGraph, type TreeGraphEdge, type TreeGraphNode, type UpdateLocaleRequest, type UpdateLocaleResponse, type UpdateProfileRequest, type UpdateProfileResponse, type UpdateRealmRequest, type UpdateRealmResponse, type UpdateSceneActionRequest, type UpdateSceneRequest, type UpdateStoryRequest, type UploadUrlRequest, type UploadUrlResponse, type UserProfile, type UsernameAvailabilityResponse, type VisibilityCondition, type VisibilityRules, type WatchSnapshot, computeSceneVisibility };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/index.ts"],"names":[],"mappings":";AAgqBO,SAAS,sBAAA,CACd,WACA,IAAA,EACmB;AACnB,EAAA,IAAI,IAAA,CAAK,SAAA,IAAa,IAAA,CAAK,UAAA,EAAY;AACrC,IAAA,OAAO,SAAA,CAAU,IAAI,OAAO,EAAE,WAAW,IAAA,EAAM,MAAA,EAAQ,OAAM,CAAE,CAAA;AAAA,EACjE;AACA,EAAA,OAAO,SAAA,CAAU,GAAA,CAAI,CAAC,KAAA,MAAW;AAAA,IAC/B,WAAW,KAAA,CAAM,QAAA;AAAA,IACjB,MAAA,EAAQ,CAAC,KAAA,CAAM;AAAA,GACjB,CAAE,CAAA;AACJ","file":"index.js","sourcesContent":["// ── Auth ──\n\nexport interface MagicLinkRequest {\n email: string;\n username?: string;\n device_name?: string;\n}\n\nexport interface MagicLinkRequestResponse {\n message: string;\n}\n\nexport interface MagicLinkVerifyRequest {\n email: string;\n token: string;\n device_name?: string;\n}\n\nexport interface MagicLinkVerifyResponse {\n token?: string;\n user: UserProfile;\n}\n\nexport interface OidcExchangeRequest {\n code: string;\n code_verifier: string;\n redirect_uri: string;\n device_name?: string;\n}\n\nexport interface OidcExchangeResponse {\n token?: string;\n user: UserProfile;\n}\n\nexport interface PasswordLoginRequest {\n email: string;\n password: string;\n device_name?: string;\n}\n\nexport interface PasswordLoginResponse {\n token?: string;\n user: UserProfile;\n}\n\n// ── User ──\n\nexport interface UserProfile {\n id: string;\n name: string;\n username: string;\n email: string;\n realm: RealmId | null;\n needs_realm_choice: boolean;\n locale: LocaleId | null;\n avatar_url: string | null;\n is_admin: boolean;\n created_at: string;\n}\n\nexport interface UpdateRealmRequest {\n realm: RealmId;\n}\n\nexport interface UpdateRealmResponse {\n realm: RealmId;\n user: UserProfile;\n}\n\nexport interface UpdateProfileRequest {\n name?: string;\n username?: string;\n}\n\nexport interface UpdateProfileResponse {\n user: UserProfile;\n}\n\nexport interface UsernameAvailabilityResponse {\n username: string;\n available: boolean;\n suggestion?: string;\n}\n\nexport interface PublicDirectorProfile {\n id: string;\n name: string;\n avatar_url: string | null;\n realm: RealmId | null;\n stories_count: number;\n}\n\n// ── Catalog ──\n\nexport interface StoryListItem {\n id: string;\n title: string;\n description: string | null;\n genre: string | null;\n content_rating: ContentRating | null;\n published: boolean;\n published_version: number;\n watch_starts_count: number;\n choice_clicks_count: number;\n scenes_count: number;\n choices_count: number;\n tags: string[];\n creator: {\n id: string;\n name: string;\n } | null;\n created_at: string;\n updated_at: string;\n}\n\nexport interface StoryPreview {\n source: \"trailer\" | \"title_scene\" | \"none\";\n title: string;\n preview_url: string | null;\n media_type: string | null;\n is_ready: boolean;\n}\n\nexport interface PopularChoice {\n label: string;\n click_count: number;\n}\n\nexport interface StoryProgress {\n last_scene_id: string | null;\n bookmark_code: string | null;\n playback_seconds: number;\n watched_version: number;\n last_watched_at: string | null;\n}\n\nexport interface CatalogResponse {\n data: StoryListItem[];\n meta: {\n previews: Record<string, StoryPreview>;\n popular_choices: Record<string, PopularChoice[]>;\n creator_avatars: Record<string, string>;\n coverboxes: Record<string, string | null>;\n progress: Record<string, StoryProgress>;\n };\n}\n\nexport interface MineResponse {\n stories: StoryListItem[];\n data?: StoryListItem[];\n progress?: Record<string, StoryProgress>;\n meta: {\n coverboxes: Record<string, string | null>;\n };\n}\n\n// ── Watch / Scene Map ──\n\nexport interface SceneChoice {\n id: string;\n label: string;\n choice_type: string;\n choice_icon: string | null;\n choice_icon_media_id: string | null;\n choice_icon_url: string | null;\n reveal_mode: string;\n start_time_seconds: number | null;\n pause_for_choice: boolean;\n end_time_seconds: number | null;\n target_scene_id: string;\n x: number;\n y: number;\n w: number;\n h: number;\n visibility_rules: VisibilityRules | null;\n state_updates: StateUpdate[];\n}\n\nexport interface VisibilityRules {\n mode: \"all\" | \"any\";\n conditions: VisibilityCondition[];\n}\n\nexport interface VisibilityCondition {\n variable?: string;\n key?: string;\n operator?: string;\n value?: string;\n}\n\nexport interface StateUpdate {\n variable?: string;\n key?: string;\n action?: string;\n value?: string;\n}\n\nexport interface SceneNode {\n type: string;\n properties?: Record<string, unknown>;\n children?: SceneNode[];\n}\n\nexport type SceneActionPayload = Record<string, unknown> | unknown[];\n\nexport interface SceneMapEntry {\n scene_id: string;\n scene_title: string;\n color: string | null;\n is_title: boolean;\n media_title: string | null;\n media_type: string | null;\n media_url: string | null;\n stream_status: string | null;\n choice_style: string;\n choice_overlay_mode: string;\n goto_scene_id: string | null;\n choices: SceneChoice[];\n nodes: SceneNode[];\n}\n\nexport interface TreeGraphNode {\n id: string;\n title: string;\n is_title: boolean;\n is_end: boolean;\n level: number;\n index: number;\n x: number;\n y: number;\n color: string | null;\n}\n\nexport interface TreeGraphEdge {\n id: string;\n source: string;\n target: string;\n type: \"choice\" | \"go_to_scene\";\n}\n\nexport interface TreeGraph {\n nodes: TreeGraphNode[];\n edges: TreeGraphEdge[];\n meta: {\n root_id: string | null;\n level_count: number;\n };\n}\n\nexport interface WatchSnapshot {\n scene_id: string | null;\n state: Record<string, string>;\n history: HistoryEntry[];\n path: string[];\n visited_scene_ids?: string[];\n playback_seconds: number;\n}\n\nexport interface HistoryEntry {\n choice_id: string;\n scene_id: string;\n target_scene_id: string | null;\n at: string | null;\n path_index: number | null;\n}\n\nexport interface SceneMapResponse {\n story: {\n id: string;\n title: string;\n description: string | null;\n genre: string | null;\n content_rating: ContentRating | null;\n published_version: number;\n watch_starts_count: number;\n choice_clicks_count: number;\n };\n start_scene_id: string;\n scene_map: Record<string, SceneMapEntry>;\n tree_graph: TreeGraph;\n initial_snapshot: WatchSnapshot;\n initial_bookmark_code: string | null;\n}\n\n// ── Engagement ──\n\nexport interface TrackEngagementRequest {\n event: \"play_start\" | \"choice_click\";\n choice_id?: string;\n}\n\nexport interface EngagementResponse {\n watch_starts_count: number;\n choice_clicks_count: number;\n}\n\n// ── Bookmarks ──\n\nexport interface SaveBookmarkRequest {\n snapshot: WatchSnapshot;\n}\n\nexport interface BookmarkResponse {\n code: string;\n snapshot: WatchSnapshot;\n}\n\nexport interface BookmarkListItem {\n code: string;\n snapshot: WatchSnapshot;\n updated_at: string;\n}\n\nexport interface BookmarkListResponse {\n bookmarks: BookmarkListItem[];\n}\n\n// ── Pagination ──\n\nexport interface PaginatedLink {\n url: string | null;\n label: string;\n active: boolean;\n}\n\nexport interface PaginatedResponse<T> {\n data: T[];\n current_page: number;\n first_page_url: string;\n from: number | null;\n last_page: number;\n last_page_url: string;\n links: PaginatedLink[];\n next_page_url: string | null;\n path: string;\n per_page: number;\n prev_page_url: string | null;\n to: number | null;\n total: number;\n}\n\n// ── Scenes ──\n\nexport interface TextLine {\n id: string;\n html: string;\n appear_at_ms: number;\n fade_in_ms: number;\n fade_out_ms: number;\n duration_ms: number;\n position_x?: number;\n position_y?: number;\n persist?: boolean;\n}\n\nexport interface SceneTextContent {\n html: string;\n lines?: TextLine[];\n}\n\nexport interface SceneListItem {\n id: string;\n story_id: string;\n title: string;\n order: number;\n is_title: boolean;\n is_end: boolean;\n color: string | null;\n media_id: string | null;\n alt_media_id: string | null;\n media_mode: \"text\" | \"imagery\" | \"film\" | null;\n text_content: SceneTextContent | null;\n text_style: {\n font_family?: string | null;\n text_color?: string | null;\n background_color?: string | null;\n } | null;\n created_at: string;\n updated_at: string;\n}\n\nexport interface UpdateSceneRequest {\n title?: string;\n order?: number;\n media_id?: string | null;\n alt_media_id?: string | null;\n media_mode?: \"text\" | \"imagery\" | \"film\" | null;\n text_content?: SceneTextContent | null;\n text_style?: {\n font_family?: string | null;\n text_color?: string | null;\n background_color?: string | null;\n } | null;\n color?: string | null;\n is_title?: boolean;\n is_end?: boolean;\n choice_style?: string | null;\n choice_overlay_mode?: string | null;\n choice_reveal_mode?: string | null;\n choice_start_time_seconds?: number | null;\n choice_pause_for_choice?: boolean;\n choice_end_time_seconds?: number | null;\n}\n\nexport interface CreateSceneRequest {\n story_id: string;\n title: string;\n order?: number;\n is_title?: boolean;\n is_end?: boolean;\n}\n\nexport interface SceneActionItem {\n id: string;\n scene_id: string;\n name: string;\n type: string | null;\n scene_choice_id: string | null;\n order: number;\n duration: number;\n properties: SceneActionPayload | null;\n subproperties: SceneActionPayload | null;\n created_at?: string;\n updated_at?: string;\n}\n\nexport interface CreateSceneActionRequest {\n scene_id: string;\n name: string;\n type?: string | null;\n order?: number;\n duration?: number;\n properties?: SceneActionPayload | null;\n subproperties?: SceneActionPayload | null;\n}\n\nexport interface UpdateSceneActionRequest {\n name?: string;\n type?: string | null;\n order?: number;\n duration?: number;\n properties?: SceneActionPayload;\n subproperties?: SceneActionPayload;\n}\n\n// ── AI Generation ──\n\nexport type AiGenerationStatus =\n | \"pending\"\n | \"generating\"\n | \"ready\"\n | \"failed\"\n | \"accepted\"\n | \"rejected\";\n\nexport interface GenerateImageRequest {\n story_id: string;\n scene_id?: string;\n prompt: string;\n mood?: string;\n visual_style?: string;\n rejection_feedback?: string;\n previous_generation_id?: string;\n}\n\nexport interface AiGeneration {\n id: string;\n story_id: string;\n scene_id: string | null;\n status: AiGenerationStatus;\n user_prompt: string;\n style_context: {\n mood?: string;\n visual_style?: string;\n subject_prompt: string;\n full_prompt: string;\n negative_prompt?: string;\n };\n preview_url?: string;\n rejection_feedback: string | null;\n media_id: string | null;\n attempt_number: number;\n credits_charged: number;\n created_at: string;\n updated_at: string;\n}\n\nexport interface GenerateImageResponse {\n generation: AiGeneration;\n balance: { watch: number; create: number };\n}\n\nexport interface AiGenerationShowResponse {\n generation: AiGeneration;\n}\n\nexport interface AcceptGenerationRequest {\n scene_id: string;\n}\n\nexport interface AcceptGenerationResponse {\n generation: AiGeneration;\n scene: SceneListItem;\n media: MediaItem;\n}\n\nexport interface RejectGenerationRequest {\n feedback: string;\n}\n\nexport interface RejectGenerationResponse {\n generation: AiGeneration;\n}\n\nexport interface StoryStyleResponse {\n has_style: boolean;\n style_context: AiGeneration[\"style_context\"] | null;\n}\n\n// ── Media ──\n\nexport interface MediaItem {\n id: string;\n user_id: string;\n s3_key: string;\n source_path: string;\n output_prefix: string | null;\n status: \"uploaded\" | \"processing\" | \"ready\" | \"error\";\n meta: Record<string, unknown>;\n order: number;\n created_at: string;\n updated_at: string;\n}\n\nexport interface UploadUrlRequest {\n filename: string;\n contentType: string;\n}\n\nexport interface UploadUrlResponse {\n key: string;\n uploadUrl: string;\n}\n\nexport interface RegisterMediaRequest {\n key: string;\n s3_key: string;\n filename: string;\n content_type?: string;\n title?: string;\n file_size?: number;\n}\n\nexport interface RegisterMediaResponse extends MediaItem {\n credits_charged: number;\n balance: number;\n}\n\nexport interface TranscodeRequest {\n media_id: string;\n}\n\nexport interface TranscodeResponse {\n message: string;\n job_id: string | null;\n manifest_path?: string;\n}\n\nexport interface PlayUrlResponse {\n play_url: string;\n status: string;\n}\n\nexport interface SourceUrlResponse {\n url: string;\n}\n\n// ── Story authoring ──\n\nexport interface CreateStoryRequest {\n title: string;\n description?: string | null;\n genre?: string | null;\n content_rating?: ContentRating | null;\n}\n\nexport interface UpdateStoryRequest {\n title?: string;\n description?: string | null;\n genre?: string | null;\n content_rating?: ContentRating | null;\n published?: boolean;\n tags?: string[];\n}\n\nexport interface TagListResponse {\n data: string[];\n}\n\n// ── Content Ratings ──\n\nexport type ContentRating = \"G\" | \"PG\" | \"PG-13\" | \"R\" | \"NC-17\";\n\nexport interface ContentRatingDefinition {\n id: ContentRating;\n label: string;\n description: string;\n}\n\n// ── Realm Config ──\n\nexport type RealmId = \"cosmos\" | \"wilds\";\n\n/** Supported UI locales — matches PHP `chuzi_realms.supported_locales`. */\nexport type LocaleId = \"en\" | \"es\" | \"fr\" | \"de\" | \"pt\";\n\nexport interface RealmDefinition {\n label: string;\n short_label: string;\n /** Canonical English lexicon (always present). */\n lexicon: Record<string, string>;\n /** Optional per-locale overrides; missing keys fall through to `lexicon`. */\n locales?: Partial<Record<LocaleId, Record<string, string>>>;\n}\n\nexport interface RealmConfigResponse {\n realms: Record<RealmId, RealmDefinition>;\n fallback_lexicon: Record<string, string>;\n fallback_locales?: Partial<Record<LocaleId, Record<string, string>>>;\n intro: {\n line1: string;\n line2: string;\n };\n intro_locales?: Partial<Record<LocaleId, { line1: string; line2: string }>>;\n profile: {\n title: string;\n current_prefix: string;\n switch_prompt: string;\n };\n profile_locales?: Partial<Record<LocaleId, { title: string; current_prefix: string; switch_prompt: string }>>;\n allowed_realm_ids: RealmId[];\n supported_locales: LocaleId[];\n locale_labels?: Partial<Record<LocaleId, string>>;\n}\n\nexport interface UpdateLocaleRequest {\n locale: LocaleId;\n}\n\nexport interface UpdateLocaleResponse {\n locale: LocaleId;\n}\n\n// ── Scene Visibility ──\n\nexport interface SceneVisibility {\n /** Whether the user can navigate to this scene-star. */\n navigable: boolean;\n /** Whether the star/edge should render at reduced opacity. */\n dimmed: boolean;\n}\n\n/**\n * Compute per-scene navigable/dimmed flags for a constellation.\n *\n * Rules:\n * - If `isCreator` is true, everything is navigable and bright.\n * - Title scenes are always navigable and bright.\n * - If the user has watched the ending (`endingSeen`), all scenes unlock.\n * - Otherwise non-title scenes are locked and dimmed.\n */\nexport function computeSceneVisibility(\n sceneList: Pick<SceneListItem, \"is_title\" | \"is_end\">[],\n opts: { isCreator: boolean; endingSeen: boolean },\n): SceneVisibility[] {\n if (opts.isCreator || opts.endingSeen) {\n return sceneList.map(() => ({ navigable: true, dimmed: false }));\n }\n return sceneList.map((scene) => ({\n navigable: scene.is_title,\n dimmed: !scene.is_title,\n }));\n}\n"]}
1
+ {"version":3,"sources":["../../src/types/index.ts"],"names":[],"mappings":";AAsqBO,SAAS,sBAAA,CACd,WACA,IAAA,EACmB;AACnB,EAAA,IAAI,IAAA,CAAK,SAAA,IAAa,IAAA,CAAK,UAAA,EAAY;AACrC,IAAA,OAAO,SAAA,CAAU,IAAI,OAAO,EAAE,WAAW,IAAA,EAAM,MAAA,EAAQ,OAAM,CAAE,CAAA;AAAA,EACjE;AACA,EAAA,OAAO,SAAA,CAAU,GAAA,CAAI,CAAC,KAAA,MAAW;AAAA,IAC/B,WAAW,KAAA,CAAM,QAAA;AAAA,IACjB,MAAA,EAAQ,CAAC,KAAA,CAAM;AAAA,GACjB,CAAE,CAAA;AACJ","file":"index.js","sourcesContent":["// ── Auth ──\n\nexport interface MagicLinkRequest {\n email: string;\n username?: string;\n device_name?: string;\n}\n\nexport interface MagicLinkRequestResponse {\n message: string;\n}\n\nexport interface MagicLinkVerifyRequest {\n email: string;\n token: string;\n device_name?: string;\n}\n\nexport interface MagicLinkVerifyResponse {\n token?: string;\n user: UserProfile;\n}\n\nexport interface OidcExchangeRequest {\n code: string;\n code_verifier: string;\n redirect_uri: string;\n device_name?: string;\n}\n\nexport interface OidcExchangeResponse {\n token?: string;\n user: UserProfile;\n}\n\nexport interface PasswordLoginRequest {\n email: string;\n password: string;\n device_name?: string;\n}\n\nexport interface PasswordLoginResponse {\n token?: string;\n user: UserProfile;\n}\n\n// ── User ──\n\nexport interface UserProfile {\n id: string;\n name: string;\n username: string;\n email: string;\n realm: RealmId | null;\n needs_realm_choice: boolean;\n locale: LocaleId | null;\n avatar_url: string | null;\n is_admin: boolean;\n created_at: string;\n}\n\nexport interface UpdateRealmRequest {\n realm: RealmId;\n}\n\nexport interface UpdateRealmResponse {\n realm: RealmId;\n user: UserProfile;\n}\n\nexport interface UpdateProfileRequest {\n name?: string;\n username?: string;\n}\n\nexport interface UpdateProfileResponse {\n user: UserProfile;\n}\n\nexport interface UsernameAvailabilityResponse {\n username: string;\n available: boolean;\n suggestion?: string;\n}\n\nexport interface PublicDirectorProfile {\n id: string;\n name: string;\n avatar_url: string | null;\n realm: RealmId | null;\n stories_count: number;\n}\n\n// ── Catalog ──\n\nexport interface StoryListItem {\n id: string;\n title: string;\n description: string | null;\n genre: string | null;\n content_rating: ContentRating | null;\n published: boolean;\n published_version: number;\n watch_starts_count: number;\n choice_clicks_count: number;\n scenes_count: number;\n choices_count: number;\n tags: string[];\n creator: {\n id: string;\n name: string;\n } | null;\n created_at: string;\n updated_at: string;\n}\n\nexport interface StoryPreview {\n source: \"trailer\" | \"title_scene\" | \"none\";\n title: string;\n preview_url: string | null;\n media_type: string | null;\n is_ready: boolean;\n}\n\nexport interface PopularChoice {\n label: string;\n click_count: number;\n}\n\nexport interface StoryProgress {\n last_scene_id: string | null;\n bookmark_code: string | null;\n playback_seconds: number;\n watched_version: number;\n last_watched_at: string | null;\n}\n\nexport interface CatalogResponse {\n data: StoryListItem[];\n meta: {\n previews: Record<string, StoryPreview>;\n popular_choices: Record<string, PopularChoice[]>;\n creator_avatars: Record<string, string>;\n coverboxes: Record<string, string | null>;\n progress: Record<string, StoryProgress>;\n };\n}\n\nexport interface MineResponse {\n stories: StoryListItem[];\n data?: StoryListItem[];\n progress?: Record<string, StoryProgress>;\n meta: {\n coverboxes: Record<string, string | null>;\n };\n}\n\n// ── Watch / Scene Map ──\n\nexport interface SceneChoice {\n id: string;\n label: string;\n choice_type: string;\n choice_icon: string | null;\n choice_icon_media_id: string | null;\n choice_icon_url: string | null;\n reveal_mode: string;\n start_time_seconds: number | null;\n pause_for_choice: boolean;\n end_time_seconds: number | null;\n target_scene_id: string;\n x: number;\n y: number;\n w: number;\n h: number;\n visibility_rules: VisibilityRules | null;\n state_updates: StateUpdate[];\n}\n\nexport interface VisibilityRules {\n mode: \"all\" | \"any\";\n conditions: VisibilityCondition[];\n}\n\nexport interface VisibilityCondition {\n variable?: string;\n key?: string;\n operator?: string;\n value?: string;\n}\n\nexport interface StateUpdate {\n variable?: string;\n key?: string;\n action?: string;\n value?: string;\n}\n\nexport interface SceneNode {\n type: string;\n properties?: Record<string, unknown>;\n children?: SceneNode[];\n}\n\nexport type SceneActionPayload = Record<string, unknown> | unknown[];\n\nexport interface SceneMapEntry {\n scene_id: string;\n scene_title: string;\n color: string | null;\n is_title: boolean;\n media_title: string | null;\n media_type: string | null;\n media_url: string | null;\n stream_status: string | null;\n choice_style: string;\n choice_overlay_mode: string;\n goto_scene_id: string | null;\n choices: SceneChoice[];\n nodes: SceneNode[];\n}\n\nexport interface TreeGraphNode {\n id: string;\n title: string;\n is_title: boolean;\n is_end: boolean;\n level: number;\n index: number;\n x: number;\n y: number;\n color: string | null;\n}\n\nexport interface TreeGraphEdge {\n id: string;\n source: string;\n target: string;\n type: \"choice\" | \"go_to_scene\";\n}\n\nexport interface TreeGraph {\n nodes: TreeGraphNode[];\n edges: TreeGraphEdge[];\n meta: {\n root_id: string | null;\n level_count: number;\n };\n}\n\nexport interface WatchSnapshot {\n scene_id: string | null;\n state: Record<string, string>;\n history: HistoryEntry[];\n path: string[];\n visited_scene_ids?: string[];\n playback_seconds: number;\n}\n\nexport interface HistoryEntry {\n choice_id: string;\n scene_id: string;\n target_scene_id: string | null;\n at: string | null;\n path_index: number | null;\n}\n\nexport interface SceneMapResponse {\n story: {\n id: string;\n title: string;\n description: string | null;\n genre: string | null;\n content_rating: ContentRating | null;\n published_version: number;\n watch_starts_count: number;\n choice_clicks_count: number;\n };\n start_scene_id: string;\n scene_map: Record<string, SceneMapEntry>;\n tree_graph: TreeGraph;\n initial_snapshot: WatchSnapshot;\n initial_bookmark_code: string | null;\n}\n\n// ── Engagement ──\n\nexport interface TrackEngagementRequest {\n event: \"play_start\" | \"choice_click\";\n choice_id?: string;\n}\n\nexport interface EngagementResponse {\n watch_starts_count: number;\n choice_clicks_count: number;\n}\n\n// ── Bookmarks ──\n\nexport interface SaveBookmarkRequest {\n snapshot: WatchSnapshot;\n}\n\nexport interface BookmarkResponse {\n code: string;\n snapshot: WatchSnapshot;\n}\n\nexport interface BookmarkListItem {\n code: string;\n snapshot: WatchSnapshot;\n updated_at: string;\n}\n\nexport interface BookmarkListResponse {\n bookmarks: BookmarkListItem[];\n}\n\n// ── Pagination ──\n\nexport interface PaginatedLink {\n url: string | null;\n label: string;\n active: boolean;\n}\n\nexport interface PaginatedResponse<T> {\n data: T[];\n current_page: number;\n first_page_url: string;\n from: number | null;\n last_page: number;\n last_page_url: string;\n links: PaginatedLink[];\n next_page_url: string | null;\n path: string;\n per_page: number;\n prev_page_url: string | null;\n to: number | null;\n total: number;\n}\n\n// ── Scenes ──\n\nexport type LineType = \"text\" | \"sound\" | \"image\";\n\nexport interface TextLine {\n id: string;\n type?: LineType;\n media_id?: string;\n html: string;\n appear_at_ms: number;\n fade_in_ms: number;\n fade_out_ms: number;\n duration_ms: number;\n position_x?: number;\n position_y?: number;\n width_pct?: number;\n height_pct?: number;\n persist?: boolean;\n}\n\nexport interface SceneTextContent {\n html: string;\n lines?: TextLine[];\n}\n\nexport interface SceneListItem {\n id: string;\n story_id: string;\n title: string;\n order: number;\n is_title: boolean;\n is_end: boolean;\n color: string | null;\n media_id: string | null;\n alt_media_id: string | null;\n media_mode: \"text\" | \"imagery\" | \"film\" | null;\n text_content: SceneTextContent | null;\n text_style: {\n font_family?: string | null;\n text_color?: string | null;\n background_color?: string | null;\n } | null;\n created_at: string;\n updated_at: string;\n}\n\nexport interface UpdateSceneRequest {\n title?: string;\n order?: number;\n media_id?: string | null;\n alt_media_id?: string | null;\n media_mode?: \"text\" | \"imagery\" | \"film\" | null;\n text_content?: SceneTextContent | null;\n text_style?: {\n font_family?: string | null;\n text_color?: string | null;\n background_color?: string | null;\n } | null;\n color?: string | null;\n is_title?: boolean;\n is_end?: boolean;\n choice_style?: string | null;\n choice_overlay_mode?: string | null;\n choice_reveal_mode?: string | null;\n choice_start_time_seconds?: number | null;\n choice_pause_for_choice?: boolean;\n choice_end_time_seconds?: number | null;\n}\n\nexport interface CreateSceneRequest {\n story_id: string;\n title: string;\n order?: number;\n is_title?: boolean;\n is_end?: boolean;\n}\n\nexport interface SceneActionItem {\n id: string;\n scene_id: string;\n name: string;\n type: string | null;\n scene_choice_id: string | null;\n order: number;\n duration: number;\n properties: SceneActionPayload | null;\n subproperties: SceneActionPayload | null;\n created_at?: string;\n updated_at?: string;\n}\n\nexport interface CreateSceneActionRequest {\n scene_id: string;\n name: string;\n type?: string | null;\n order?: number;\n duration?: number;\n properties?: SceneActionPayload | null;\n subproperties?: SceneActionPayload | null;\n}\n\nexport interface UpdateSceneActionRequest {\n name?: string;\n type?: string | null;\n order?: number;\n duration?: number;\n properties?: SceneActionPayload;\n subproperties?: SceneActionPayload;\n}\n\n// ── AI Generation ──\n\nexport type AiGenerationStatus =\n | \"pending\"\n | \"generating\"\n | \"ready\"\n | \"failed\"\n | \"accepted\"\n | \"rejected\";\n\nexport interface GenerateImageRequest {\n story_id: string;\n scene_id?: string;\n prompt: string;\n mood?: string;\n visual_style?: string;\n rejection_feedback?: string;\n previous_generation_id?: string;\n}\n\nexport interface AiGeneration {\n id: string;\n story_id: string;\n scene_id: string | null;\n status: AiGenerationStatus;\n user_prompt: string;\n style_context: {\n mood?: string;\n visual_style?: string;\n subject_prompt: string;\n full_prompt: string;\n negative_prompt?: string;\n };\n preview_url?: string;\n rejection_feedback: string | null;\n media_id: string | null;\n attempt_number: number;\n credits_charged: number;\n created_at: string;\n updated_at: string;\n}\n\nexport interface GenerateImageResponse {\n generation: AiGeneration;\n balance: { watch: number; create: number };\n}\n\nexport interface AiGenerationShowResponse {\n generation: AiGeneration;\n}\n\nexport interface AcceptGenerationRequest {\n scene_id: string;\n}\n\nexport interface AcceptGenerationResponse {\n generation: AiGeneration;\n scene: SceneListItem;\n media: MediaItem;\n}\n\nexport interface RejectGenerationRequest {\n feedback: string;\n}\n\nexport interface RejectGenerationResponse {\n generation: AiGeneration;\n}\n\nexport interface StoryStyleResponse {\n has_style: boolean;\n style_context: AiGeneration[\"style_context\"] | null;\n}\n\n// ── Media ──\n\nexport interface MediaItem {\n id: string;\n user_id: string;\n s3_key: string;\n source_path: string;\n output_prefix: string | null;\n status: \"uploaded\" | \"processing\" | \"ready\" | \"error\";\n meta: Record<string, unknown>;\n order: number;\n created_at: string;\n updated_at: string;\n}\n\nexport interface UploadUrlRequest {\n filename: string;\n contentType: string;\n}\n\nexport interface UploadUrlResponse {\n key: string;\n uploadUrl: string;\n}\n\nexport interface RegisterMediaRequest {\n key: string;\n s3_key: string;\n filename: string;\n content_type?: string;\n title?: string;\n file_size?: number;\n}\n\nexport interface RegisterMediaResponse extends MediaItem {\n credits_charged: number;\n balance: number;\n}\n\nexport interface TranscodeRequest {\n media_id: string;\n}\n\nexport interface TranscodeResponse {\n message: string;\n job_id: string | null;\n manifest_path?: string;\n}\n\nexport interface PlayUrlResponse {\n play_url: string;\n status: string;\n}\n\nexport interface SourceUrlResponse {\n url: string;\n}\n\n// ── Story authoring ──\n\nexport interface CreateStoryRequest {\n title: string;\n description?: string | null;\n genre?: string | null;\n content_rating?: ContentRating | null;\n}\n\nexport interface UpdateStoryRequest {\n title?: string;\n description?: string | null;\n genre?: string | null;\n content_rating?: ContentRating | null;\n published?: boolean;\n tags?: string[];\n}\n\nexport interface TagListResponse {\n data: string[];\n}\n\n// ── Content Ratings ──\n\nexport type ContentRating = \"G\" | \"PG\" | \"PG-13\" | \"R\" | \"NC-17\";\n\nexport interface ContentRatingDefinition {\n id: ContentRating;\n label: string;\n description: string;\n}\n\n// ── Realm Config ──\n\nexport type RealmId = \"cosmos\" | \"wilds\";\n\n/** Supported UI locales — matches PHP `chuzi_realms.supported_locales`. */\nexport type LocaleId = \"en\" | \"es\" | \"fr\" | \"de\" | \"pt\";\n\nexport interface RealmDefinition {\n label: string;\n short_label: string;\n /** Canonical English lexicon (always present). */\n lexicon: Record<string, string>;\n /** Optional per-locale overrides; missing keys fall through to `lexicon`. */\n locales?: Partial<Record<LocaleId, Record<string, string>>>;\n}\n\nexport interface RealmConfigResponse {\n realms: Record<RealmId, RealmDefinition>;\n fallback_lexicon: Record<string, string>;\n fallback_locales?: Partial<Record<LocaleId, Record<string, string>>>;\n intro: {\n line1: string;\n line2: string;\n };\n intro_locales?: Partial<Record<LocaleId, { line1: string; line2: string }>>;\n profile: {\n title: string;\n current_prefix: string;\n switch_prompt: string;\n };\n profile_locales?: Partial<Record<LocaleId, { title: string; current_prefix: string; switch_prompt: string }>>;\n allowed_realm_ids: RealmId[];\n supported_locales: LocaleId[];\n locale_labels?: Partial<Record<LocaleId, string>>;\n}\n\nexport interface UpdateLocaleRequest {\n locale: LocaleId;\n}\n\nexport interface UpdateLocaleResponse {\n locale: LocaleId;\n}\n\n// ── Scene Visibility ──\n\nexport interface SceneVisibility {\n /** Whether the user can navigate to this scene-star. */\n navigable: boolean;\n /** Whether the star/edge should render at reduced opacity. */\n dimmed: boolean;\n}\n\n/**\n * Compute per-scene navigable/dimmed flags for a constellation.\n *\n * Rules:\n * - If `isCreator` is true, everything is navigable and bright.\n * - Title scenes are always navigable and bright.\n * - If the user has watched the ending (`endingSeen`), all scenes unlock.\n * - Otherwise non-title scenes are locked and dimmed.\n */\nexport function computeSceneVisibility(\n sceneList: Pick<SceneListItem, \"is_title\" | \"is_end\">[],\n opts: { isCreator: boolean; endingSeen: boolean },\n): SceneVisibility[] {\n if (opts.isCreator || opts.endingSeen) {\n return sceneList.map(() => ({ navigable: true, dimmed: false }));\n }\n return sceneList.map((scene) => ({\n navigable: scene.is_title,\n dimmed: !scene.is_title,\n }));\n}\n"]}
package/dist/ui/index.js CHANGED
@@ -58,7 +58,7 @@ var REALMS = {
58
58
  creator_credits: "Stardust",
59
59
  editor_media_upload: "Upload Transmission",
60
60
  editor_media_preview: "Transmission Preview",
61
- editor_alt_media: "Additional Media",
61
+ editor_alt_media: "Effects",
62
62
  editor_choices: "Choices",
63
63
  editor_scene_settings: "Star Settings",
64
64
  editor_title_scene: "Title Star",
@@ -113,6 +113,12 @@ var REALMS = {
113
113
  editor_line_fade_out: "Fade Out",
114
114
  editor_line_duration: "Duration",
115
115
  editor_line_persist: "Stay on Screen",
116
+ editor_effects_section: "Effects",
117
+ editor_effects_add: "Add sounds, effects, etc",
118
+ editor_effect_fade_in_sound: "Fade In Sound",
119
+ editor_effect_fade_out_sound: "Fade Out Sound",
120
+ editor_effect_fade_in_visual: "Fade In",
121
+ editor_effect_fade_out_visual: "Fade Out",
116
122
  editor_timeline_label: "Timeline",
117
123
  editor_preview_label: "Preview",
118
124
  editor_preview_play: "Play",
@@ -327,7 +333,7 @@ var REALMS = {
327
333
  creator_credits: "Pollen",
328
334
  editor_media_upload: "Upload Bloom",
329
335
  editor_media_preview: "Bloom Preview",
330
- editor_alt_media: "Additional Media",
336
+ editor_alt_media: "Effects",
331
337
  editor_choices: "Choices",
332
338
  editor_scene_settings: "Clearing Settings",
333
339
  editor_title_scene: "Title Clearing",
@@ -382,6 +388,12 @@ var REALMS = {
382
388
  editor_line_fade_out: "Fade Out",
383
389
  editor_line_duration: "Duration",
384
390
  editor_line_persist: "Stay on Screen",
391
+ editor_effects_section: "Effects",
392
+ editor_effects_add: "Add sounds, effects, etc",
393
+ editor_effect_fade_in_sound: "Fade In Sound",
394
+ editor_effect_fade_out_sound: "Fade Out Sound",
395
+ editor_effect_fade_in_visual: "Fade In",
396
+ editor_effect_fade_out_visual: "Fade Out",
385
397
  editor_timeline_label: "Timeline",
386
398
  editor_preview_label: "Preview",
387
399
  editor_preview_play: "Play",
@@ -594,7 +606,7 @@ var FALLBACK_LEXICON = {
594
606
  creator_credits: "Creator Credits",
595
607
  editor_media_upload: "Upload Media",
596
608
  editor_media_preview: "Media Preview",
597
- editor_alt_media: "Additional Media",
609
+ editor_alt_media: "Effects",
598
610
  editor_choices: "Choices",
599
611
  editor_scene_settings: "Scene Settings",
600
612
  editor_title_scene: "Title Scene",
@@ -649,6 +661,12 @@ var FALLBACK_LEXICON = {
649
661
  editor_line_fade_out: "Fade Out",
650
662
  editor_line_duration: "Duration",
651
663
  editor_line_persist: "Stay on Screen",
664
+ editor_effects_section: "Effects",
665
+ editor_effects_add: "Add sounds, effects, etc",
666
+ editor_effect_fade_in_sound: "Fade In Sound",
667
+ editor_effect_fade_out_sound: "Fade Out Sound",
668
+ editor_effect_fade_in_visual: "Fade In",
669
+ editor_effect_fade_out_visual: "Fade Out",
652
670
  editor_timeline_label: "Timeline",
653
671
  editor_preview_label: "Preview",
654
672
  editor_preview_play: "Play",
@@ -863,7 +881,8 @@ var THEME_TOKENS = {
863
881
  accent: "#7eb8ff",
864
882
  accentSoft: "rgba(126, 184, 255, 0.35)",
865
883
  text: "#e8f0ff",
866
- muted: "rgba(232, 240, 255, 0.65)"
884
+ muted: "rgba(232, 240, 255, 0.65)",
885
+ effectLine: "#ffb347"
867
886
  },
868
887
  wilds: {
869
888
  bgDeep: "#0d120c",
@@ -871,7 +890,8 @@ var THEME_TOKENS = {
871
890
  accent: "#7bc96f",
872
891
  accentSoft: "rgba(123, 201, 111, 0.35)",
873
892
  text: "#eef6ea",
874
- muted: "rgba(238, 246, 234, 0.7)"
893
+ muted: "rgba(238, 246, 234, 0.7)",
894
+ effectLine: "#b78aff"
875
895
  }
876
896
  };
877
897
  function getThemeTokens(realmId) {