@chuzi/shared 1.3.43 → 1.3.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.d.ts +3 -1
- package/dist/api/index.js +7 -1
- package/dist/api/index.js.map +1 -1
- package/dist/config/index.js +24 -0
- package/dist/config/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +31 -1
- package/dist/index.js.map +1 -1
- package/dist/realms/cosmos/components/index.d.ts +51 -1
- package/dist/realms/cosmos/components/index.js +114 -1
- package/dist/realms/cosmos/components/index.js.map +1 -1
- package/dist/types/index.d.ts +36 -1
- package/dist/types/index.js.map +1 -1
- package/dist/ui/index.js +24 -0
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -175,6 +175,56 @@ interface DistributeOptions {
|
|
|
175
175
|
* sessions.
|
|
176
176
|
*/
|
|
177
177
|
declare function distributeStars(count: number, options?: DistributeOptions): Vec3[];
|
|
178
|
+
/** World-space gap between adjacent scenes along the story spine. */
|
|
179
|
+
declare const COSMOS_SCENE_LEVEL_SPACING = 6;
|
|
180
|
+
/** Branch spread multiplier for tree_graph x offsets. */
|
|
181
|
+
declare const COSMOS_SCENE_BRANCH_SPACING = 1.1;
|
|
182
|
+
/** Minimum empty space between constellation bounds, in scene spacings. */
|
|
183
|
+
declare const COSMOS_CONSTELLATION_GAP_SCENES = 2;
|
|
184
|
+
/** Halo around a lone title star before scenes load. */
|
|
185
|
+
declare const COSMOS_DEFAULT_FOOTPRINT_RADIUS = 10;
|
|
186
|
+
/** Extra world units around the outermost scene for billboards / focus glow. */
|
|
187
|
+
declare const COSMOS_CONSTELLATION_VISUAL_PADDING = 6;
|
|
188
|
+
interface ConstellationLayoutScene {
|
|
189
|
+
id: string;
|
|
190
|
+
is_title?: boolean;
|
|
191
|
+
is_end?: boolean;
|
|
192
|
+
order?: number;
|
|
193
|
+
created_at?: string;
|
|
194
|
+
}
|
|
195
|
+
interface ConstellationLayoutNode {
|
|
196
|
+
id: string;
|
|
197
|
+
level: number;
|
|
198
|
+
x: number;
|
|
199
|
+
index?: number;
|
|
200
|
+
}
|
|
201
|
+
interface ConstellationLayoutGraph {
|
|
202
|
+
nodes: ConstellationLayoutNode[];
|
|
203
|
+
meta?: {
|
|
204
|
+
root_id?: string | null;
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
interface ConstellationAnchorInput {
|
|
208
|
+
id: string;
|
|
209
|
+
footprintRadius: number;
|
|
210
|
+
}
|
|
211
|
+
interface ConstellationAnchorOptions {
|
|
212
|
+
/** Gap between constellation bounds in scene spacings (default 2). */
|
|
213
|
+
minGapScenes?: number;
|
|
214
|
+
levelSpacing?: number;
|
|
215
|
+
visualPadding?: number;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Scene positions relative to the title star at the origin (constellation anchor).
|
|
219
|
+
*/
|
|
220
|
+
declare function computeConstellationScenePositions(scenes: ConstellationLayoutScene[], graph: ConstellationLayoutGraph | undefined, anchor?: Vec3): Map<string, Vec3>;
|
|
221
|
+
/** Bounding radius from the title anchor to the outermost scene plus visual padding. */
|
|
222
|
+
declare function constellationFootprintRadius(localPositions: Map<string, Vec3>, padding?: number): number;
|
|
223
|
+
/**
|
|
224
|
+
* Place constellation anchors so each title star stays outside other
|
|
225
|
+
* constellations, with at least `minGapScenes` scene spacings between bounds.
|
|
226
|
+
*/
|
|
227
|
+
declare function distributeConstellationAnchors(items: ConstellationAnchorInput[], options?: ConstellationAnchorOptions): Map<string, Vec3>;
|
|
178
228
|
|
|
179
229
|
interface StarBillboardProps {
|
|
180
230
|
label: string;
|
|
@@ -194,4 +244,4 @@ interface StarBillboardProps {
|
|
|
194
244
|
*/
|
|
195
245
|
declare function StarBillboard({ label, appearance, previewImageUrl, previewContent, dimmed, focused, visible, controlsSlot, }: StarBillboardProps): react_jsx_runtime.JSX.Element | null;
|
|
196
246
|
|
|
197
|
-
export { Constellation, ConstellationAppearance, type ConstellationBounds, ConstellationEdge, type ConstellationEdgeEntry, type ConstellationEdgeProps, type ConstellationProps, type ConstellationSceneEntry, type ConstellationStoryOverlay, ConstellationTitle, type ConstellationTitleProps, CosmosSandbox, type CosmosSandboxProps, type DistributeOptions, Star, StarBillboard, type StarBillboardProps, type StarProps, type Vec3, World, type WorldProps, computeConstellationBounds, distributeStars };
|
|
247
|
+
export { COSMOS_CONSTELLATION_GAP_SCENES, COSMOS_CONSTELLATION_VISUAL_PADDING, COSMOS_DEFAULT_FOOTPRINT_RADIUS, COSMOS_SCENE_BRANCH_SPACING, COSMOS_SCENE_LEVEL_SPACING, Constellation, type ConstellationAnchorInput, type ConstellationAnchorOptions, ConstellationAppearance, type ConstellationBounds, ConstellationEdge, type ConstellationEdgeEntry, type ConstellationEdgeProps, type ConstellationLayoutGraph, type ConstellationLayoutNode, type ConstellationLayoutScene, type ConstellationProps, type ConstellationSceneEntry, type ConstellationStoryOverlay, ConstellationTitle, type ConstellationTitleProps, CosmosSandbox, type CosmosSandboxProps, type DistributeOptions, Star, StarBillboard, type StarBillboardProps, type StarProps, type Vec3, World, type WorldProps, computeConstellationBounds, computeConstellationScenePositions, constellationFootprintRadius, distributeConstellationAnchors, distributeStars };
|
|
@@ -728,6 +728,119 @@ function mulberry32(seed) {
|
|
|
728
728
|
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
729
729
|
};
|
|
730
730
|
}
|
|
731
|
+
var COSMOS_SCENE_LEVEL_SPACING = 6;
|
|
732
|
+
var COSMOS_SCENE_BRANCH_SPACING = 1.1;
|
|
733
|
+
var COSMOS_CONSTELLATION_GAP_SCENES = 2;
|
|
734
|
+
var COSMOS_DEFAULT_FOOTPRINT_RADIUS = 10;
|
|
735
|
+
var COSMOS_CONSTELLATION_VISUAL_PADDING = 6;
|
|
736
|
+
function sortScenesForConstellationLayout(sceneList) {
|
|
737
|
+
return [...sceneList].sort((a, b) => {
|
|
738
|
+
if (a.is_title !== b.is_title) return a.is_title ? -1 : 1;
|
|
739
|
+
if (a.is_end !== b.is_end) return a.is_end ? 1 : -1;
|
|
740
|
+
const orderA = a.order ?? 0;
|
|
741
|
+
const orderB = b.order ?? 0;
|
|
742
|
+
if (orderA !== orderB) return orderA - orderB;
|
|
743
|
+
return (a.created_at ?? "").localeCompare(b.created_at ?? "");
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
function orderScenesForConstellationLayout(sceneList, graph) {
|
|
747
|
+
if (!graph?.nodes?.length) return sortScenesForConstellationLayout(sceneList);
|
|
748
|
+
const sceneById = new Map(sceneList.map((scene) => [scene.id, scene]));
|
|
749
|
+
const ordered = [];
|
|
750
|
+
const seen = /* @__PURE__ */ new Set();
|
|
751
|
+
const sortedNodes = [...graph.nodes].sort((a, b) => {
|
|
752
|
+
if (a.level !== b.level) return a.level - b.level;
|
|
753
|
+
if (a.x !== b.x) return a.x - b.x;
|
|
754
|
+
return (a.index ?? 0) - (b.index ?? 0);
|
|
755
|
+
});
|
|
756
|
+
for (const node of sortedNodes) {
|
|
757
|
+
const scene = sceneById.get(node.id);
|
|
758
|
+
if (scene && !seen.has(scene.id)) {
|
|
759
|
+
ordered.push(scene);
|
|
760
|
+
seen.add(scene.id);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
for (const scene of sortScenesForConstellationLayout(sceneList)) {
|
|
764
|
+
if (!seen.has(scene.id)) {
|
|
765
|
+
ordered.push(scene);
|
|
766
|
+
seen.add(scene.id);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
return ordered;
|
|
770
|
+
}
|
|
771
|
+
function computeConstellationScenePositions(scenes, graph, anchor = [0, 0, 0]) {
|
|
772
|
+
const positions = /* @__PURE__ */ new Map();
|
|
773
|
+
const ordered = orderScenesForConstellationLayout(scenes, graph);
|
|
774
|
+
const count = ordered.length;
|
|
775
|
+
if (!graph?.nodes?.length) {
|
|
776
|
+
ordered.forEach((scene, idx) => {
|
|
777
|
+
const along = count === 1 ? 0 : idx * COSMOS_SCENE_LEVEL_SPACING;
|
|
778
|
+
positions.set(scene.id, [anchor[0] + along, anchor[1], anchor[2]]);
|
|
779
|
+
});
|
|
780
|
+
return positions;
|
|
781
|
+
}
|
|
782
|
+
const nodeById = new Map(graph.nodes.map((node) => [node.id, node]));
|
|
783
|
+
const rootId = graph.meta?.root_id ?? graph.nodes[0]?.id;
|
|
784
|
+
const rootNode = rootId ? nodeById.get(rootId) : graph.nodes[0];
|
|
785
|
+
ordered.forEach((scene, idx) => {
|
|
786
|
+
const node = nodeById.get(scene.id);
|
|
787
|
+
if (node && rootNode) {
|
|
788
|
+
const alongPath = node.level * COSMOS_SCENE_LEVEL_SPACING;
|
|
789
|
+
const branchSpread = (node.x - rootNode.x) * COSMOS_SCENE_BRANCH_SPACING;
|
|
790
|
+
positions.set(scene.id, [
|
|
791
|
+
anchor[0] + alongPath,
|
|
792
|
+
anchor[1],
|
|
793
|
+
anchor[2] + branchSpread
|
|
794
|
+
]);
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
const along = count === 1 ? 0 : idx * COSMOS_SCENE_LEVEL_SPACING;
|
|
798
|
+
positions.set(scene.id, [anchor[0] + along, anchor[1], anchor[2]]);
|
|
799
|
+
});
|
|
800
|
+
return positions;
|
|
801
|
+
}
|
|
802
|
+
function constellationFootprintRadius(localPositions, padding = COSMOS_CONSTELLATION_VISUAL_PADDING) {
|
|
803
|
+
let maxReach = COSMOS_DEFAULT_FOOTPRINT_RADIUS;
|
|
804
|
+
for (const [x, , z] of localPositions.values()) {
|
|
805
|
+
maxReach = Math.max(maxReach, Math.hypot(x, z) + padding);
|
|
806
|
+
}
|
|
807
|
+
return maxReach;
|
|
808
|
+
}
|
|
809
|
+
function circlesSeparated(ax, az, aRadius, bx, bz, bRadius, minGap) {
|
|
810
|
+
return Math.hypot(ax - bx, az - bz) >= aRadius + bRadius + minGap;
|
|
811
|
+
}
|
|
812
|
+
function findConstellationAnchor(footprintRadius, placed, minGap) {
|
|
813
|
+
if (placed.length === 0) return [0, 0, 0];
|
|
814
|
+
let angle = 0;
|
|
815
|
+
let radius = 0;
|
|
816
|
+
const angleStep = 0.62;
|
|
817
|
+
const radiusGrowth = minGap * 0.75;
|
|
818
|
+
for (let attempt = 0; attempt < 8e3; attempt++) {
|
|
819
|
+
angle += angleStep;
|
|
820
|
+
radius += radiusGrowth / (2 * Math.PI);
|
|
821
|
+
const cx = Math.cos(angle) * radius;
|
|
822
|
+
const cz = Math.sin(angle) * radius;
|
|
823
|
+
const ok = placed.every(
|
|
824
|
+
(other) => circlesSeparated(cx, cz, footprintRadius, other.x, other.z, other.radius, minGap)
|
|
825
|
+
);
|
|
826
|
+
if (ok) return [cx, 0, cz];
|
|
827
|
+
}
|
|
828
|
+
const fallback = placed.length * (minGap + footprintRadius * 2);
|
|
829
|
+
return [fallback, 0, 0];
|
|
830
|
+
}
|
|
831
|
+
function distributeConstellationAnchors(items, options = {}) {
|
|
832
|
+
const minGapScenes = options.minGapScenes ?? COSMOS_CONSTELLATION_GAP_SCENES;
|
|
833
|
+
const levelSpacing = options.levelSpacing ?? COSMOS_SCENE_LEVEL_SPACING;
|
|
834
|
+
const minGap = minGapScenes * levelSpacing;
|
|
835
|
+
const anchors = /* @__PURE__ */ new Map();
|
|
836
|
+
const placed = [];
|
|
837
|
+
for (const item of items) {
|
|
838
|
+
const [x, , z] = findConstellationAnchor(item.footprintRadius, placed, minGap);
|
|
839
|
+
anchors.set(item.id, [x, 0, z]);
|
|
840
|
+
placed.push({ x, z, radius: item.footprintRadius });
|
|
841
|
+
}
|
|
842
|
+
return anchors;
|
|
843
|
+
}
|
|
731
844
|
function CosmosSandbox({
|
|
732
845
|
films,
|
|
733
846
|
onFilmSelect,
|
|
@@ -750,6 +863,6 @@ function CosmosSandbox({
|
|
|
750
863
|
)) });
|
|
751
864
|
}
|
|
752
865
|
|
|
753
|
-
export { Constellation, ConstellationEdge, ConstellationTitle, CosmosSandbox, DEFAULT_CONSTELLATION_APPEARANCE, Star, StarBillboard, World, computeConstellationBounds, distributeStars, mergeConstellationAppearance };
|
|
866
|
+
export { COSMOS_CONSTELLATION_GAP_SCENES, COSMOS_CONSTELLATION_VISUAL_PADDING, COSMOS_DEFAULT_FOOTPRINT_RADIUS, COSMOS_SCENE_BRANCH_SPACING, COSMOS_SCENE_LEVEL_SPACING, Constellation, ConstellationEdge, ConstellationTitle, CosmosSandbox, DEFAULT_CONSTELLATION_APPEARANCE, Star, StarBillboard, World, computeConstellationBounds, computeConstellationScenePositions, constellationFootprintRadius, distributeConstellationAnchors, distributeStars, mergeConstellationAppearance };
|
|
754
867
|
//# sourceMappingURL=index.js.map
|
|
755
868
|
//# sourceMappingURL=index.js.map
|
|
@@ -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/appearance.ts","../../../../src/realms/cosmos/components/ConstellationEdge.tsx","../../../../src/realms/cosmos/components/ConstellationTitle.tsx","../../../../src/realms/cosmos/components/StarBillboard.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","Html","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,MA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EAAQ,EAAE,GAAG,aAAA,CAAc,IAAI,CAAA,EAAG,QAAA,EAAU,SAAA,CAAU,CAAC,CAAA;AAAE,KAC3D,CAAE,CAAA;AAAA,EACJ,CAAA,EAAG,CAAC,KAAA,EAAO,IAAI,CAAC,CAAA;AAEhB,EAAA,uBACEF,GAAAA,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 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","/**\n * Constellation presentation tokens — consumed by the cosmos realm camera,\n * star billboards, and ghost title typography. Admins can override via\n * saved experience / appearance templates.\n */\nexport interface ConstellationAppearance {\n /** Rainbow arc title above the constellation (SVG px). */\n titleFontSize: number;\n titleOpacity: number;\n titleColor: string;\n titleLetterSpacing: number;\n /** World-space lift above constellation center. */\n titleYOffset: number;\n /** Html distance factor for the arc title billboard. */\n titleDistanceFactor: number;\n /** DOM z-index ceiling for constellation Html overlays (keep below editor). */\n htmlZIndexRange: [number, number];\n\n /** Per-star preview card + label. */\n previewWidth: number;\n previewHeight: number;\n previewOffsetY: number;\n labelFontSize: number;\n labelLetterSpacing: number;\n labelGap: number;\n /** Reserved space below preview for the 2×2 HUD control grid (px). */\n controlsGridHeight: number;\n billboardDistanceFactor: number;\n\n /** Camera — floating-in-space slide between stars. */\n cameraDefaultOffset: [number, number, number];\n cameraTargetOffset: [number, number, number];\n /** 0–1 lerp factor per frame while gliding (lower = smoother / pressurized). */\n cameraSlideLerp: number;\n cameraArrivalThreshold: number;\n}\n\nexport const DEFAULT_CONSTELLATION_APPEARANCE: ConstellationAppearance = {\n titleFontSize: 34,\n titleOpacity: 0.82,\n titleColor: \"#c8dce8\",\n titleLetterSpacing: 6,\n titleYOffset: 16,\n titleDistanceFactor: 12,\n htmlZIndexRange: [8, 0],\n\n previewWidth: 148,\n previewHeight: 96,\n previewOffsetY: 2.4,\n labelFontSize: 13,\n labelLetterSpacing: 1.2,\n labelGap: 10,\n controlsGridHeight: 92,\n billboardDistanceFactor: 10,\n\n cameraDefaultOffset: [0, 4, 12],\n cameraTargetOffset: [0, 0, 0],\n cameraSlideLerp: 0.035,\n cameraArrivalThreshold: 0.08,\n};\n\nexport function mergeConstellationAppearance(\n overrides?: Partial<ConstellationAppearance>,\n): ConstellationAppearance {\n return { ...DEFAULT_CONSTELLATION_APPEARANCE, ...overrides };\n}\n","import { useMemo } from \"react\";\nimport { Line } from \"@react-three/drei\";\nimport * as THREE from \"three\";\n\nexport type ConstellationEdgeVariant = \"solid\" | \"dotted\";\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 /** @deprecated All edges render as soft solid glow; variant is ignored. */\n variant?: ConstellationEdgeVariant;\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 */\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 <Line\n points={points}\n vertexColors={[glowA, glowB]}\n lineWidth={4}\n transparent\n opacity={glowOpacity}\n toneMapped={false}\n />\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 { useId, type ReactNode } from \"react\";\nimport { Billboard, Html } from \"@react-three/drei\";\nimport type { ConstellationAppearance } from \"../appearance.js\";\n\nexport interface ConstellationBounds {\n center: [number, number, number];\n spanX: number;\n spanZ: number;\n}\n\nexport function computeConstellationBounds(\n positions: [number, number, number][],\n): ConstellationBounds | null {\n if (positions.length === 0) return null;\n\n let minX = Infinity;\n let maxX = -Infinity;\n let minZ = Infinity;\n let maxZ = -Infinity;\n let sumY = 0;\n\n for (const [x, y, z] of positions) {\n minX = Math.min(minX, x);\n maxX = Math.max(maxX, x);\n minZ = Math.min(minZ, z);\n maxZ = Math.max(maxZ, z);\n sumY += y;\n }\n\n return {\n center: [(minX + maxX) / 2, sumY / positions.length, (minZ + maxZ) / 2],\n spanX: Math.max(10, maxX - minX + 6),\n spanZ: Math.max(8, maxZ - minZ + 5),\n };\n}\n\nexport interface ConstellationStoryOverlay {\n /** Localized prefix, e.g. \"Chosen by\". */\n chosenByPrefix: string;\n directorName?: string | null;\n directorAvatarUrl?: string | null;\n /** Procedural avatar when no uploaded photo (e.g. constellation seal). */\n directorAvatarFallback?: ReactNode;\n contentRating?: string | null;\n genre?: string | null;\n /** Shown between rating and genre. */\n ratingGenreSeparator?: string;\n /** When true the arched title is clickable. */\n editable?: boolean;\n onEditClick?: () => void;\n /** Accessible label for the editable title control. */\n editAriaLabel?: string;\n}\n\nexport interface ConstellationTitleProps {\n title: string;\n bounds: ConstellationBounds;\n appearance: ConstellationAppearance;\n /** World position of the title (first) scene — arc starts here. */\n arcFrom?: [number, number, number];\n /** World position of the end scene — arc ends here. */\n arcTo?: [number, number, number];\n storyOverlay?: ConstellationStoryOverlay;\n}\n\nconst WORLD_TO_SVG = 58;\n\n/**\n * Vintage cartography-style ocean label arcing from title scene to end scene.\n */\nexport function ConstellationTitle({\n title,\n bounds,\n appearance,\n arcFrom,\n arcTo,\n storyOverlay,\n}: ConstellationTitleProps) {\n const gradientId = useId().replace(/:/g, \"\");\n const pathId = `arc-${gradientId}`;\n\n if (!title.trim()) return null;\n\n const span = Math.max(bounds.spanX, bounds.spanZ);\n const svgWidth = Math.max(420, Math.round(span * WORLD_TO_SVG + 80));\n const svgHeight = 110;\n\n const centerX = svgWidth / 2;\n const arcY = svgHeight * 0.88;\n const arcPeak = svgHeight * 0.06;\n\n let arcStartX = svgWidth * 0.04;\n let arcEndX = svgWidth * 0.96;\n\n if (arcFrom && arcTo) {\n const [fromX] = arcFrom;\n const [toX] = arcTo;\n arcStartX = centerX + (fromX - bounds.center[0]) * WORLD_TO_SVG;\n arcEndX = centerX + (toX - bounds.center[0]) * WORLD_TO_SVG;\n arcStartX = Math.max(12, Math.min(arcStartX, svgWidth - 12));\n arcEndX = Math.max(12, Math.min(arcEndX, svgWidth - 12));\n if (arcStartX > arcEndX) {\n const swap = arcStartX;\n arcStartX = arcEndX;\n arcEndX = swap;\n }\n }\n\n const arcMidX = (arcStartX + arcEndX) / 2;\n const arcPath = `M ${arcStartX} ${arcY} Q ${arcMidX} ${arcPeak} ${arcEndX} ${arcY}`;\n\n const editable = !!(storyOverlay?.editable && storyOverlay.onEditClick);\n const hasDirector = !!(\n storyOverlay?.directorName && storyOverlay.directorName.trim()\n );\n const hasRatingGenre = !!(\n storyOverlay?.contentRating || storyOverlay?.genre\n );\n const showOverlay = hasDirector || hasRatingGenre;\n\n const titleControl = (\n <svg\n width={svgWidth}\n height={svgHeight}\n viewBox={`0 0 ${svgWidth} ${svgHeight}`}\n style={{\n overflow: \"visible\",\n display: \"block\",\n cursor: editable ? \"pointer\" : undefined,\n }}\n aria-hidden={editable ? undefined : true}\n role={editable ? \"button\" : undefined}\n tabIndex={editable ? 0 : undefined}\n aria-label={editable ? storyOverlay?.editAriaLabel : undefined}\n onClick={editable ? storyOverlay?.onEditClick : undefined}\n onKeyDown={\n editable\n ? (e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n storyOverlay?.onEditClick?.();\n }\n }\n : undefined\n }\n >\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\">\n <stop offset=\"0%\" stopColor=\"#8ab4c8\" />\n <stop offset=\"35%\" stopColor=\"#c8d8e4\" />\n <stop offset=\"65%\" stopColor=\"#e8dcc8\" />\n <stop offset=\"100%\" stopColor=\"#8ab4c8\" />\n </linearGradient>\n <path id={pathId} d={arcPath} fill=\"none\" />\n </defs>\n <text\n fill={`url(#${gradientId})`}\n fontFamily=\"'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif\"\n fontSize={appearance.titleFontSize}\n fontWeight={700}\n fontStyle=\"italic\"\n letterSpacing={appearance.titleLetterSpacing}\n opacity={appearance.titleOpacity}\n stroke=\"rgba(20,40,60,0.35)\"\n strokeWidth={0.6}\n paintOrder=\"stroke fill\"\n style={{ pointerEvents: \"none\" }}\n >\n <textPath href={`#${pathId}`} startOffset=\"50%\" textAnchor=\"middle\">\n {title.toUpperCase()}\n </textPath>\n </text>\n </svg>\n );\n\n return (\n <Billboard\n position={[\n bounds.center[0],\n bounds.center[1] + appearance.titleYOffset,\n bounds.center[2],\n ]}\n >\n <Html\n center\n transform\n distanceFactor={appearance.titleDistanceFactor}\n zIndexRange={appearance.htmlZIndexRange}\n occlude={false}\n style={{\n pointerEvents: editable ? \"auto\" : \"none\",\n userSelect: \"none\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: 8,\n marginTop: 4,\n }}\n >\n {titleControl}\n\n {showOverlay ? (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: 6,\n maxWidth: svgWidth,\n marginTop: 6,\n pointerEvents: \"none\",\n }}\n >\n {hasDirector ? (\n <DirectorCredit\n prefix={storyOverlay!.chosenByPrefix}\n name={storyOverlay!.directorName!}\n avatarUrl={storyOverlay!.directorAvatarUrl ?? null}\n avatarFallback={storyOverlay!.directorAvatarFallback}\n />\n ) : null}\n\n {hasRatingGenre ? (\n <RatingGenreLine\n contentRating={storyOverlay!.contentRating ?? null}\n genre={storyOverlay!.genre ?? null}\n separator={storyOverlay!.ratingGenreSeparator ?? \" · \"}\n />\n ) : null}\n </div>\n ) : null}\n </div>\n </Html>\n </Billboard>\n );\n}\n\nfunction DirectorCredit({\n prefix,\n name,\n avatarUrl,\n avatarFallback,\n}: {\n prefix: string;\n name: string;\n avatarUrl: string | null;\n avatarFallback?: ReactNode;\n}) {\n const initial = name.trim().charAt(0).toUpperCase() || \"?\";\n\n return (\n <div\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: 6,\n fontSize: 11,\n color: \"rgba(232,240,255,0.72)\",\n letterSpacing: 0.35,\n textShadow: \"0 1px 8px rgba(0,0,0,0.95)\",\n whiteSpace: \"nowrap\",\n }}\n >\n <span style={{ opacity: 0.85 }}>{prefix}</span>\n <span\n style={{\n width: 20,\n height: 20,\n borderRadius: \"50%\",\n overflow: \"hidden\",\n flexShrink: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"rgba(255,255,255,0.1)\",\n border: \"1px solid rgba(126,184,255,0.35)\",\n fontSize: 9,\n fontWeight: 700,\n color: \"rgba(232,240,255,0.9)\",\n }}\n >\n {avatarUrl ? (\n <img\n src={avatarUrl}\n alt=\"\"\n style={{ width: \"100%\", height: \"100%\", objectFit: \"cover\" }}\n />\n ) : avatarFallback ? (\n avatarFallback\n ) : (\n initial\n )}\n </span>\n <span style={{ fontWeight: 600 }}>{name}</span>\n </div>\n );\n}\n\nfunction RatingGenreLine({\n contentRating,\n genre,\n separator,\n}: {\n contentRating: string | null;\n genre: string | null;\n separator: string;\n}) {\n const parts: ReactNode[] = [];\n if (contentRating) {\n parts.push(\n <span key=\"rating\" style={{ fontWeight: 700 }}>\n {contentRating}\n </span>,\n );\n }\n if (genre) {\n parts.push(<span key=\"genre\">{genre}</span>);\n }\n if (parts.length === 0) return null;\n\n return (\n <div\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: 0,\n fontSize: 10,\n letterSpacing: 0.5,\n textTransform: \"uppercase\",\n color: \"rgba(232,240,255,0.55)\",\n textShadow: \"0 1px 6px rgba(0,0,0,0.95)\",\n }}\n >\n {parts.map((part, i) => (\n <span key={i}>\n {i > 0 ? separator : null}\n {part}\n </span>\n ))}\n </div>\n );\n}\n","import { Html } from \"@react-three/drei\";\nimport type { ReactNode } from \"react\";\nimport type { ConstellationAppearance } from \"../appearance.js\";\n\nexport interface StarBillboardProps {\n label: string;\n appearance: ConstellationAppearance;\n previewImageUrl?: string | null;\n previewContent?: ReactNode;\n dimmed?: boolean;\n focused?: boolean;\n visible?: boolean;\n /** Control strip rendered flush beneath the preview when focused. */\n controlsSlot?: ReactNode;\n}\n\n/**\n * Floating preview card and scene label above a star. Unfocused previews\n * are dimmed; labels stay prominent. Anchor sits at preview bottom-center\n * so attached controls align with the card edge.\n */\nexport function StarBillboard({\n label,\n appearance,\n previewImageUrl,\n previewContent,\n dimmed,\n focused,\n visible = true,\n controlsSlot,\n}: StarBillboardProps) {\n if (!visible) return null;\n\n const borderColor = focused\n ? \"rgba(126,184,255,0.75)\"\n : \"rgba(126,184,255,0.22)\";\n const previewOpacity = focused ? 1 : dimmed ? 0.22 : 0.34;\n const previewFilter = focused\n ? \"brightness(1.08) saturate(1.1)\"\n : \"brightness(0.72) saturate(0.65)\";\n const hasControls = !!(focused && controlsSlot);\n\n return (\n <Html\n position={[0, appearance.previewOffsetY, 0]}\n center\n transform\n distanceFactor={appearance.billboardDistanceFactor}\n zIndexRange={appearance.htmlZIndexRange}\n occlude={false}\n style={{\n pointerEvents: \"none\",\n userSelect: \"none\",\n }}\n >\n <style>{`\n @keyframes chuziPreviewFocusIn {\n 0% { opacity: 0.4; transform: scale(0.9); filter: brightness(0.8) saturate(0.7); }\n 55% { opacity: 1; transform: scale(1.05); filter: brightness(1.12) saturate(1.15); }\n 100% { opacity: 1; transform: scale(1); filter: brightness(1.08) saturate(1.1); }\n }\n @keyframes chuziPreviewFocusOut {\n 0% { opacity: 1; transform: scale(1); }\n 100% { opacity: ${previewOpacity}; transform: scale(0.96); }\n }\n `}</style>\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n transform: `translateY(-${appearance.previewHeight / 2}px)`,\n }}\n >\n <div\n key={focused ? \"focused\" : \"unfocused\"}\n style={{\n width: appearance.previewWidth,\n height: appearance.previewHeight,\n borderRadius: hasControls ? \"8px 8px 0 0\" : 8,\n overflow: \"hidden\",\n border: `1px solid ${borderColor}`,\n borderBottom: hasControls ? \"none\" : `1px solid ${borderColor}`,\n background: \"rgba(4,7,13,0.92)\",\n boxShadow: focused\n ? \"0 0 28px rgba(126,184,255,0.45), 0 4px 24px rgba(0,0,0,0.5)\"\n : \"0 4px 20px rgba(0,0,0,0.55)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n opacity: previewOpacity,\n filter: previewFilter,\n transition: \"border-color 0.35s ease, box-shadow 0.35s ease\",\n animation: focused\n ? \"chuziPreviewFocusIn 0.48s cubic-bezier(0.34, 1.45, 0.64, 1) forwards\"\n : \"chuziPreviewFocusOut 0.32s ease forwards\",\n }}\n >\n {previewImageUrl ? (\n <img\n src={previewImageUrl}\n alt=\"\"\n style={{\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n display: \"block\",\n }}\n />\n ) : (\n previewContent ?? (\n <div\n style={{\n width: \"100%\",\n height: \"100%\",\n background:\n \"radial-gradient(ellipse at 30% 20%, rgba(80,120,200,0.2) 0%, rgba(10,14,30,0.95) 70%)\",\n }}\n />\n )\n )}\n </div>\n\n {hasControls ? (\n <div\n style={{\n width: appearance.previewWidth,\n pointerEvents: \"auto\",\n flexShrink: 0,\n }}\n >\n {controlsSlot}\n </div>\n ) : null}\n\n <div\n style={{\n marginTop: appearance.labelGap,\n fontSize: appearance.labelFontSize,\n fontWeight: 700,\n letterSpacing: appearance.labelLetterSpacing,\n textTransform: \"uppercase\",\n color: \"rgba(232,240,255,0.96)\",\n textAlign: \"center\",\n textShadow:\n \"0 0 18px rgba(0,0,0,0.95), 0 2px 12px rgba(0,0,0,0.95), 0 0 6px rgba(126,184,255,0.25)\",\n whiteSpace: \"nowrap\",\n maxWidth: appearance.previewWidth + 48,\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n }}\n >\n {label}\n </div>\n </div>\n </Html>\n );\n}\n","import type { ReactNode } from \"react\";\nimport type { AtomVisualProps } from \"../../index.js\";\nimport {\n mergeConstellationAppearance,\n type ConstellationAppearance,\n} from \"../appearance.js\";\nimport { Star } from \"./Star.js\";\nimport { ConstellationEdge } from \"./ConstellationEdge.js\";\nimport {\n ConstellationTitle,\n computeConstellationBounds,\n type ConstellationStoryOverlay,\n} from \"./ConstellationTitle.js\";\nimport { StarBillboard } from \"./StarBillboard.js\";\n\nexport interface ConstellationSceneEntry {\n id: string;\n /** Visual with final position already computed by the consumer. */\n visual: AtomVisualProps;\n /** Scene label shown beneath the preview card. */\n label?: string;\n /** Static preview image (coverbox, poster frame, etc.). */\n previewImageUrl?: string | null;\n /** Custom preview when no image URL is available. */\n previewContent?: ReactNode;\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 /** Highlight this star's billboard (focused traversal). */\n focused?: boolean;\n /** Control strip slot — rendered beneath preview when focused. */\n controlsSlot?: ReactNode;\n}\n\nexport interface ConstellationEdgeEntry {\n source: string;\n target: string;\n type: \"choice\" | \"go_to_scene\" | \"sequential\";\n}\n\nexport interface ConstellationProps {\n /** Scene entries with positions already computed by the consumer. */\n scenes: ConstellationSceneEntry[];\n /** Film title rendered as ghost typography across the group. */\n storyTitle?: string;\n /** Director credit, rating, and genre beneath the arched title. */\n storyOverlay?: ConstellationStoryOverlay;\n /** Explicit story-flow edges (goto + choice). No implicit sequential links. */\n edges?: ConstellationEdgeEntry[];\n appearance?: Partial<ConstellationAppearance>;\n /** When false, hide Html billboards and arc title (e.g. while editor is open). */\n showOverlays?: boolean;\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 */\nexport function Constellation({\n scenes,\n storyTitle,\n storyOverlay,\n edges = [],\n appearance: appearanceOverrides,\n showOverlays = true,\n onSceneSelect,\n}: ConstellationProps) {\n const appearance = mergeConstellationAppearance(appearanceOverrides);\n const sceneMap = new Map(scenes.map((s, i) => [s.id, { entry: s, index: i }]));\n const bounds = computeConstellationBounds(\n scenes.map((s) => s.visual.position),\n );\n\n const resolvedEdges: {\n from: ConstellationSceneEntry;\n to: ConstellationSceneEntry;\n type: ConstellationEdgeEntry[\"type\"];\n }[] = [];\n\n for (const edge of edges) {\n const src = sceneMap.get(edge.source);\n const tgt = sceneMap.get(edge.target);\n if (src && tgt) {\n resolvedEdges.push({ from: src.entry, to: tgt.entry, type: edge.type });\n }\n }\n\n return (\n <group>\n {showOverlays && storyTitle && bounds ? (\n <ConstellationTitle\n title={storyTitle}\n bounds={bounds}\n appearance={appearance}\n arcFrom={scenes[0]?.visual.position}\n arcTo={scenes[scenes.length - 1]?.visual.position}\n storyOverlay={storyOverlay}\n />\n ) : null}\n\n {scenes.map((entry, i) => (\n <group key={entry.id} position={entry.visual.position}>\n <Star\n visual={{ ...entry.visual, position: [0, 0, 0] }}\n dimmed={entry.dimmed}\n locked={entry.locked}\n onSelect={onSceneSelect ? () => onSceneSelect(i) : undefined}\n />\n\n {showOverlays &&\n (entry.label || entry.previewImageUrl || entry.previewContent) ? (\n <StarBillboard\n label={entry.label ?? \"\"}\n appearance={appearance}\n previewImageUrl={entry.previewImageUrl}\n previewContent={entry.previewContent}\n dimmed={entry.dimmed}\n focused={entry.focused}\n controlsSlot={entry.controlsSlot}\n visible={showOverlays}\n />\n ) : null}\n </group>\n ))}\n\n {resolvedEdges.map(({ from, to, type }) => {\n const edgeDimmed = !!(from.dimmed || to.dimmed);\n return (\n <ConstellationEdge\n key={`edge-${from.id}-${to.id}-${type}`}\n from={from.visual.position}\n to={to.visual.position}\n hueA={from.visual.hue}\n hueB={to.visual.hue}\n intensityA={from.visual.intensity}\n intensityB={to.visual.intensity}\n dimmed={edgeDimmed}\n />\n );\n })}\n </group>\n );\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 {\n DEFAULT_CONSTELLATION_APPEARANCE,\n mergeConstellationAppearance,\n} from \"./appearance.js\";\nexport type { ConstellationAppearance } from \"./appearance.js\";\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/appearance.ts","../../../../src/realms/cosmos/components/ConstellationEdge.tsx","../../../../src/realms/cosmos/components/ConstellationTitle.tsx","../../../../src/realms/cosmos/components/StarBillboard.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","Html","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,C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AAA;AAC9B,IAAA,MAAA,CAAO,KAAK,EAAE,CAAA,EAAG,GAAG,MAAA,EAAQ,IAAA,CAAK,iBAAiB,CAAA;AAAA,EACpD;AAEA,EAAA,OAAO,OAAA;AACT;AClPO,SAAS,aAAA,CAAc;AAAA,EAC5B,KAAA;AAAA,EACA,YAAA;AAAA,EACA,IAAA,GAAO;AACT,CAAA,EAAuB;AACrB,EAAA,MAAM,MAAA,GAASE,QAAQ,MAAM;AAC3B,IAAA,MAAM,YAAoB,eAAA,CAAgB,KAAA,CAAM,MAAA,EAAQ,EAAE,MAAM,CAAA;AAChE,IAAA,OAAO,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,EAAM,CAAA,MAAO;AAAA,MAC7B,IAAA;AAAA,MACA,MAAA,EAAQ,EAAE,GAAG,aAAA,CAAc,IAAI,CAAA,EAAG,QAAA,EAAU,SAAA,CAAU,CAAC,CAAA;AAAE,KAC3D,CAAE,CAAA;AAAA,EACJ,CAAA,EAAG,CAAC,KAAA,EAAO,IAAI,CAAC,CAAA;AAEhB,EAAA,uBACEF,GAAAA,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 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","/**\n * Constellation presentation tokens — consumed by the cosmos realm camera,\n * star billboards, and ghost title typography. Admins can override via\n * saved experience / appearance templates.\n */\nexport interface ConstellationAppearance {\n /** Rainbow arc title above the constellation (SVG px). */\n titleFontSize: number;\n titleOpacity: number;\n titleColor: string;\n titleLetterSpacing: number;\n /** World-space lift above constellation center. */\n titleYOffset: number;\n /** Html distance factor for the arc title billboard. */\n titleDistanceFactor: number;\n /** DOM z-index ceiling for constellation Html overlays (keep below editor). */\n htmlZIndexRange: [number, number];\n\n /** Per-star preview card + label. */\n previewWidth: number;\n previewHeight: number;\n previewOffsetY: number;\n labelFontSize: number;\n labelLetterSpacing: number;\n labelGap: number;\n /** Reserved space below preview for the 2×2 HUD control grid (px). */\n controlsGridHeight: number;\n billboardDistanceFactor: number;\n\n /** Camera — floating-in-space slide between stars. */\n cameraDefaultOffset: [number, number, number];\n cameraTargetOffset: [number, number, number];\n /** 0–1 lerp factor per frame while gliding (lower = smoother / pressurized). */\n cameraSlideLerp: number;\n cameraArrivalThreshold: number;\n}\n\nexport const DEFAULT_CONSTELLATION_APPEARANCE: ConstellationAppearance = {\n titleFontSize: 34,\n titleOpacity: 0.82,\n titleColor: \"#c8dce8\",\n titleLetterSpacing: 6,\n titleYOffset: 16,\n titleDistanceFactor: 12,\n htmlZIndexRange: [8, 0],\n\n previewWidth: 148,\n previewHeight: 96,\n previewOffsetY: 2.4,\n labelFontSize: 13,\n labelLetterSpacing: 1.2,\n labelGap: 10,\n controlsGridHeight: 92,\n billboardDistanceFactor: 10,\n\n cameraDefaultOffset: [0, 4, 12],\n cameraTargetOffset: [0, 0, 0],\n cameraSlideLerp: 0.035,\n cameraArrivalThreshold: 0.08,\n};\n\nexport function mergeConstellationAppearance(\n overrides?: Partial<ConstellationAppearance>,\n): ConstellationAppearance {\n return { ...DEFAULT_CONSTELLATION_APPEARANCE, ...overrides };\n}\n","import { useMemo } from \"react\";\nimport { Line } from \"@react-three/drei\";\nimport * as THREE from \"three\";\n\nexport type ConstellationEdgeVariant = \"solid\" | \"dotted\";\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 /** @deprecated All edges render as soft solid glow; variant is ignored. */\n variant?: ConstellationEdgeVariant;\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 */\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 <Line\n points={points}\n vertexColors={[glowA, glowB]}\n lineWidth={4}\n transparent\n opacity={glowOpacity}\n toneMapped={false}\n />\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 { useId, type ReactNode } from \"react\";\nimport { Billboard, Html } from \"@react-three/drei\";\nimport type { ConstellationAppearance } from \"../appearance.js\";\n\nexport interface ConstellationBounds {\n center: [number, number, number];\n spanX: number;\n spanZ: number;\n}\n\nexport function computeConstellationBounds(\n positions: [number, number, number][],\n): ConstellationBounds | null {\n if (positions.length === 0) return null;\n\n let minX = Infinity;\n let maxX = -Infinity;\n let minZ = Infinity;\n let maxZ = -Infinity;\n let sumY = 0;\n\n for (const [x, y, z] of positions) {\n minX = Math.min(minX, x);\n maxX = Math.max(maxX, x);\n minZ = Math.min(minZ, z);\n maxZ = Math.max(maxZ, z);\n sumY += y;\n }\n\n return {\n center: [(minX + maxX) / 2, sumY / positions.length, (minZ + maxZ) / 2],\n spanX: Math.max(10, maxX - minX + 6),\n spanZ: Math.max(8, maxZ - minZ + 5),\n };\n}\n\nexport interface ConstellationStoryOverlay {\n /** Localized prefix, e.g. \"Chosen by\". */\n chosenByPrefix: string;\n directorName?: string | null;\n directorAvatarUrl?: string | null;\n /** Procedural avatar when no uploaded photo (e.g. constellation seal). */\n directorAvatarFallback?: ReactNode;\n contentRating?: string | null;\n genre?: string | null;\n /** Shown between rating and genre. */\n ratingGenreSeparator?: string;\n /** When true the arched title is clickable. */\n editable?: boolean;\n onEditClick?: () => void;\n /** Accessible label for the editable title control. */\n editAriaLabel?: string;\n}\n\nexport interface ConstellationTitleProps {\n title: string;\n bounds: ConstellationBounds;\n appearance: ConstellationAppearance;\n /** World position of the title (first) scene — arc starts here. */\n arcFrom?: [number, number, number];\n /** World position of the end scene — arc ends here. */\n arcTo?: [number, number, number];\n storyOverlay?: ConstellationStoryOverlay;\n}\n\nconst WORLD_TO_SVG = 58;\n\n/**\n * Vintage cartography-style ocean label arcing from title scene to end scene.\n */\nexport function ConstellationTitle({\n title,\n bounds,\n appearance,\n arcFrom,\n arcTo,\n storyOverlay,\n}: ConstellationTitleProps) {\n const gradientId = useId().replace(/:/g, \"\");\n const pathId = `arc-${gradientId}`;\n\n if (!title.trim()) return null;\n\n const span = Math.max(bounds.spanX, bounds.spanZ);\n const svgWidth = Math.max(420, Math.round(span * WORLD_TO_SVG + 80));\n const svgHeight = 110;\n\n const centerX = svgWidth / 2;\n const arcY = svgHeight * 0.88;\n const arcPeak = svgHeight * 0.06;\n\n let arcStartX = svgWidth * 0.04;\n let arcEndX = svgWidth * 0.96;\n\n if (arcFrom && arcTo) {\n const [fromX] = arcFrom;\n const [toX] = arcTo;\n arcStartX = centerX + (fromX - bounds.center[0]) * WORLD_TO_SVG;\n arcEndX = centerX + (toX - bounds.center[0]) * WORLD_TO_SVG;\n arcStartX = Math.max(12, Math.min(arcStartX, svgWidth - 12));\n arcEndX = Math.max(12, Math.min(arcEndX, svgWidth - 12));\n if (arcStartX > arcEndX) {\n const swap = arcStartX;\n arcStartX = arcEndX;\n arcEndX = swap;\n }\n }\n\n const arcMidX = (arcStartX + arcEndX) / 2;\n const arcPath = `M ${arcStartX} ${arcY} Q ${arcMidX} ${arcPeak} ${arcEndX} ${arcY}`;\n\n const editable = !!(storyOverlay?.editable && storyOverlay.onEditClick);\n const hasDirector = !!(\n storyOverlay?.directorName && storyOverlay.directorName.trim()\n );\n const hasRatingGenre = !!(\n storyOverlay?.contentRating || storyOverlay?.genre\n );\n const showOverlay = hasDirector || hasRatingGenre;\n\n const titleControl = (\n <svg\n width={svgWidth}\n height={svgHeight}\n viewBox={`0 0 ${svgWidth} ${svgHeight}`}\n style={{\n overflow: \"visible\",\n display: \"block\",\n cursor: editable ? \"pointer\" : undefined,\n }}\n aria-hidden={editable ? undefined : true}\n role={editable ? \"button\" : undefined}\n tabIndex={editable ? 0 : undefined}\n aria-label={editable ? storyOverlay?.editAriaLabel : undefined}\n onClick={editable ? storyOverlay?.onEditClick : undefined}\n onKeyDown={\n editable\n ? (e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n storyOverlay?.onEditClick?.();\n }\n }\n : undefined\n }\n >\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\">\n <stop offset=\"0%\" stopColor=\"#8ab4c8\" />\n <stop offset=\"35%\" stopColor=\"#c8d8e4\" />\n <stop offset=\"65%\" stopColor=\"#e8dcc8\" />\n <stop offset=\"100%\" stopColor=\"#8ab4c8\" />\n </linearGradient>\n <path id={pathId} d={arcPath} fill=\"none\" />\n </defs>\n <text\n fill={`url(#${gradientId})`}\n fontFamily=\"'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif\"\n fontSize={appearance.titleFontSize}\n fontWeight={700}\n fontStyle=\"italic\"\n letterSpacing={appearance.titleLetterSpacing}\n opacity={appearance.titleOpacity}\n stroke=\"rgba(20,40,60,0.35)\"\n strokeWidth={0.6}\n paintOrder=\"stroke fill\"\n style={{ pointerEvents: \"none\" }}\n >\n <textPath href={`#${pathId}`} startOffset=\"50%\" textAnchor=\"middle\">\n {title.toUpperCase()}\n </textPath>\n </text>\n </svg>\n );\n\n return (\n <Billboard\n position={[\n bounds.center[0],\n bounds.center[1] + appearance.titleYOffset,\n bounds.center[2],\n ]}\n >\n <Html\n center\n transform\n distanceFactor={appearance.titleDistanceFactor}\n zIndexRange={appearance.htmlZIndexRange}\n occlude={false}\n style={{\n pointerEvents: editable ? \"auto\" : \"none\",\n userSelect: \"none\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: 8,\n marginTop: 4,\n }}\n >\n {titleControl}\n\n {showOverlay ? (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: 6,\n maxWidth: svgWidth,\n marginTop: 6,\n pointerEvents: \"none\",\n }}\n >\n {hasDirector ? (\n <DirectorCredit\n prefix={storyOverlay!.chosenByPrefix}\n name={storyOverlay!.directorName!}\n avatarUrl={storyOverlay!.directorAvatarUrl ?? null}\n avatarFallback={storyOverlay!.directorAvatarFallback}\n />\n ) : null}\n\n {hasRatingGenre ? (\n <RatingGenreLine\n contentRating={storyOverlay!.contentRating ?? null}\n genre={storyOverlay!.genre ?? null}\n separator={storyOverlay!.ratingGenreSeparator ?? \" · \"}\n />\n ) : null}\n </div>\n ) : null}\n </div>\n </Html>\n </Billboard>\n );\n}\n\nfunction DirectorCredit({\n prefix,\n name,\n avatarUrl,\n avatarFallback,\n}: {\n prefix: string;\n name: string;\n avatarUrl: string | null;\n avatarFallback?: ReactNode;\n}) {\n const initial = name.trim().charAt(0).toUpperCase() || \"?\";\n\n return (\n <div\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: 6,\n fontSize: 11,\n color: \"rgba(232,240,255,0.72)\",\n letterSpacing: 0.35,\n textShadow: \"0 1px 8px rgba(0,0,0,0.95)\",\n whiteSpace: \"nowrap\",\n }}\n >\n <span style={{ opacity: 0.85 }}>{prefix}</span>\n <span\n style={{\n width: 20,\n height: 20,\n borderRadius: \"50%\",\n overflow: \"hidden\",\n flexShrink: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"rgba(255,255,255,0.1)\",\n border: \"1px solid rgba(126,184,255,0.35)\",\n fontSize: 9,\n fontWeight: 700,\n color: \"rgba(232,240,255,0.9)\",\n }}\n >\n {avatarUrl ? (\n <img\n src={avatarUrl}\n alt=\"\"\n style={{ width: \"100%\", height: \"100%\", objectFit: \"cover\" }}\n />\n ) : avatarFallback ? (\n avatarFallback\n ) : (\n initial\n )}\n </span>\n <span style={{ fontWeight: 600 }}>{name}</span>\n </div>\n );\n}\n\nfunction RatingGenreLine({\n contentRating,\n genre,\n separator,\n}: {\n contentRating: string | null;\n genre: string | null;\n separator: string;\n}) {\n const parts: ReactNode[] = [];\n if (contentRating) {\n parts.push(\n <span key=\"rating\" style={{ fontWeight: 700 }}>\n {contentRating}\n </span>,\n );\n }\n if (genre) {\n parts.push(<span key=\"genre\">{genre}</span>);\n }\n if (parts.length === 0) return null;\n\n return (\n <div\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: 0,\n fontSize: 10,\n letterSpacing: 0.5,\n textTransform: \"uppercase\",\n color: \"rgba(232,240,255,0.55)\",\n textShadow: \"0 1px 6px rgba(0,0,0,0.95)\",\n }}\n >\n {parts.map((part, i) => (\n <span key={i}>\n {i > 0 ? separator : null}\n {part}\n </span>\n ))}\n </div>\n );\n}\n","import { Html } from \"@react-three/drei\";\nimport type { ReactNode } from \"react\";\nimport type { ConstellationAppearance } from \"../appearance.js\";\n\nexport interface StarBillboardProps {\n label: string;\n appearance: ConstellationAppearance;\n previewImageUrl?: string | null;\n previewContent?: ReactNode;\n dimmed?: boolean;\n focused?: boolean;\n visible?: boolean;\n /** Control strip rendered flush beneath the preview when focused. */\n controlsSlot?: ReactNode;\n}\n\n/**\n * Floating preview card and scene label above a star. Unfocused previews\n * are dimmed; labels stay prominent. Anchor sits at preview bottom-center\n * so attached controls align with the card edge.\n */\nexport function StarBillboard({\n label,\n appearance,\n previewImageUrl,\n previewContent,\n dimmed,\n focused,\n visible = true,\n controlsSlot,\n}: StarBillboardProps) {\n if (!visible) return null;\n\n const borderColor = focused\n ? \"rgba(126,184,255,0.75)\"\n : \"rgba(126,184,255,0.22)\";\n const previewOpacity = focused ? 1 : dimmed ? 0.22 : 0.34;\n const previewFilter = focused\n ? \"brightness(1.08) saturate(1.1)\"\n : \"brightness(0.72) saturate(0.65)\";\n const hasControls = !!(focused && controlsSlot);\n\n return (\n <Html\n position={[0, appearance.previewOffsetY, 0]}\n center\n transform\n distanceFactor={appearance.billboardDistanceFactor}\n zIndexRange={appearance.htmlZIndexRange}\n occlude={false}\n style={{\n pointerEvents: \"none\",\n userSelect: \"none\",\n }}\n >\n <style>{`\n @keyframes chuziPreviewFocusIn {\n 0% { opacity: 0.4; transform: scale(0.9); filter: brightness(0.8) saturate(0.7); }\n 55% { opacity: 1; transform: scale(1.05); filter: brightness(1.12) saturate(1.15); }\n 100% { opacity: 1; transform: scale(1); filter: brightness(1.08) saturate(1.1); }\n }\n @keyframes chuziPreviewFocusOut {\n 0% { opacity: 1; transform: scale(1); }\n 100% { opacity: ${previewOpacity}; transform: scale(0.96); }\n }\n `}</style>\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n transform: `translateY(-${appearance.previewHeight / 2}px)`,\n }}\n >\n <div\n key={focused ? \"focused\" : \"unfocused\"}\n style={{\n width: appearance.previewWidth,\n height: appearance.previewHeight,\n borderRadius: hasControls ? \"8px 8px 0 0\" : 8,\n overflow: \"hidden\",\n border: `1px solid ${borderColor}`,\n borderBottom: hasControls ? \"none\" : `1px solid ${borderColor}`,\n background: \"rgba(4,7,13,0.92)\",\n boxShadow: focused\n ? \"0 0 28px rgba(126,184,255,0.45), 0 4px 24px rgba(0,0,0,0.5)\"\n : \"0 4px 20px rgba(0,0,0,0.55)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n opacity: previewOpacity,\n filter: previewFilter,\n transition: \"border-color 0.35s ease, box-shadow 0.35s ease\",\n animation: focused\n ? \"chuziPreviewFocusIn 0.48s cubic-bezier(0.34, 1.45, 0.64, 1) forwards\"\n : \"chuziPreviewFocusOut 0.32s ease forwards\",\n }}\n >\n {previewImageUrl ? (\n <img\n src={previewImageUrl}\n alt=\"\"\n style={{\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n display: \"block\",\n }}\n />\n ) : (\n previewContent ?? (\n <div\n style={{\n width: \"100%\",\n height: \"100%\",\n background:\n \"radial-gradient(ellipse at 30% 20%, rgba(80,120,200,0.2) 0%, rgba(10,14,30,0.95) 70%)\",\n }}\n />\n )\n )}\n </div>\n\n {hasControls ? (\n <div\n style={{\n width: appearance.previewWidth,\n pointerEvents: \"auto\",\n flexShrink: 0,\n }}\n >\n {controlsSlot}\n </div>\n ) : null}\n\n <div\n style={{\n marginTop: appearance.labelGap,\n fontSize: appearance.labelFontSize,\n fontWeight: 700,\n letterSpacing: appearance.labelLetterSpacing,\n textTransform: \"uppercase\",\n color: \"rgba(232,240,255,0.96)\",\n textAlign: \"center\",\n textShadow:\n \"0 0 18px rgba(0,0,0,0.95), 0 2px 12px rgba(0,0,0,0.95), 0 0 6px rgba(126,184,255,0.25)\",\n whiteSpace: \"nowrap\",\n maxWidth: appearance.previewWidth + 48,\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n }}\n >\n {label}\n </div>\n </div>\n </Html>\n );\n}\n","import type { ReactNode } from \"react\";\nimport type { AtomVisualProps } from \"../../index.js\";\nimport {\n mergeConstellationAppearance,\n type ConstellationAppearance,\n} from \"../appearance.js\";\nimport { Star } from \"./Star.js\";\nimport { ConstellationEdge } from \"./ConstellationEdge.js\";\nimport {\n ConstellationTitle,\n computeConstellationBounds,\n type ConstellationStoryOverlay,\n} from \"./ConstellationTitle.js\";\nimport { StarBillboard } from \"./StarBillboard.js\";\n\nexport interface ConstellationSceneEntry {\n id: string;\n /** Visual with final position already computed by the consumer. */\n visual: AtomVisualProps;\n /** Scene label shown beneath the preview card. */\n label?: string;\n /** Static preview image (coverbox, poster frame, etc.). */\n previewImageUrl?: string | null;\n /** Custom preview when no image URL is available. */\n previewContent?: ReactNode;\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 /** Highlight this star's billboard (focused traversal). */\n focused?: boolean;\n /** Control strip slot — rendered beneath preview when focused. */\n controlsSlot?: ReactNode;\n}\n\nexport interface ConstellationEdgeEntry {\n source: string;\n target: string;\n type: \"choice\" | \"go_to_scene\" | \"sequential\";\n}\n\nexport interface ConstellationProps {\n /** Scene entries with positions already computed by the consumer. */\n scenes: ConstellationSceneEntry[];\n /** Film title rendered as ghost typography across the group. */\n storyTitle?: string;\n /** Director credit, rating, and genre beneath the arched title. */\n storyOverlay?: ConstellationStoryOverlay;\n /** Explicit story-flow edges (goto + choice). No implicit sequential links. */\n edges?: ConstellationEdgeEntry[];\n appearance?: Partial<ConstellationAppearance>;\n /** When false, hide Html billboards and arc title (e.g. while editor is open). */\n showOverlays?: boolean;\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 */\nexport function Constellation({\n scenes,\n storyTitle,\n storyOverlay,\n edges = [],\n appearance: appearanceOverrides,\n showOverlays = true,\n onSceneSelect,\n}: ConstellationProps) {\n const appearance = mergeConstellationAppearance(appearanceOverrides);\n const sceneMap = new Map(scenes.map((s, i) => [s.id, { entry: s, index: i }]));\n const bounds = computeConstellationBounds(\n scenes.map((s) => s.visual.position),\n );\n\n const resolvedEdges: {\n from: ConstellationSceneEntry;\n to: ConstellationSceneEntry;\n type: ConstellationEdgeEntry[\"type\"];\n }[] = [];\n\n for (const edge of edges) {\n const src = sceneMap.get(edge.source);\n const tgt = sceneMap.get(edge.target);\n if (src && tgt) {\n resolvedEdges.push({ from: src.entry, to: tgt.entry, type: edge.type });\n }\n }\n\n return (\n <group>\n {showOverlays && storyTitle && bounds ? (\n <ConstellationTitle\n title={storyTitle}\n bounds={bounds}\n appearance={appearance}\n arcFrom={scenes[0]?.visual.position}\n arcTo={scenes[scenes.length - 1]?.visual.position}\n storyOverlay={storyOverlay}\n />\n ) : null}\n\n {scenes.map((entry, i) => (\n <group key={entry.id} position={entry.visual.position}>\n <Star\n visual={{ ...entry.visual, position: [0, 0, 0] }}\n dimmed={entry.dimmed}\n locked={entry.locked}\n onSelect={onSceneSelect ? () => onSceneSelect(i) : undefined}\n />\n\n {showOverlays &&\n (entry.label || entry.previewImageUrl || entry.previewContent) ? (\n <StarBillboard\n label={entry.label ?? \"\"}\n appearance={appearance}\n previewImageUrl={entry.previewImageUrl}\n previewContent={entry.previewContent}\n dimmed={entry.dimmed}\n focused={entry.focused}\n controlsSlot={entry.controlsSlot}\n visible={showOverlays}\n />\n ) : null}\n </group>\n ))}\n\n {resolvedEdges.map(({ from, to, type }) => {\n const edgeDimmed = !!(from.dimmed || to.dimmed);\n return (\n <ConstellationEdge\n key={`edge-${from.id}-${to.id}-${type}`}\n from={from.visual.position}\n to={to.visual.position}\n hueA={from.visual.hue}\n hueB={to.visual.hue}\n intensityA={from.visual.intensity}\n intensityB={to.visual.intensity}\n dimmed={edgeDimmed}\n />\n );\n })}\n </group>\n );\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 {\n DEFAULT_CONSTELLATION_APPEARANCE,\n mergeConstellationAppearance,\n} from \"./appearance.js\";\nexport type { ConstellationAppearance } from \"./appearance.js\";\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\n/** World-space gap between adjacent scenes along the story spine. */\nexport const COSMOS_SCENE_LEVEL_SPACING = 6;\n\n/** Branch spread multiplier for tree_graph x offsets. */\nexport const COSMOS_SCENE_BRANCH_SPACING = 1.1;\n\n/** Minimum empty space between constellation bounds, in scene spacings. */\nexport const COSMOS_CONSTELLATION_GAP_SCENES = 2;\n\n/** Halo around a lone title star before scenes load. */\nexport const COSMOS_DEFAULT_FOOTPRINT_RADIUS = 10;\n\n/** Extra world units around the outermost scene for billboards / focus glow. */\nexport const COSMOS_CONSTELLATION_VISUAL_PADDING = 6;\n\nexport interface ConstellationLayoutScene {\n id: string;\n is_title?: boolean;\n is_end?: boolean;\n order?: number;\n created_at?: string;\n}\n\nexport interface ConstellationLayoutNode {\n id: string;\n level: number;\n x: number;\n index?: number;\n}\n\nexport interface ConstellationLayoutGraph {\n nodes: ConstellationLayoutNode[];\n meta?: { root_id?: string | null };\n}\n\nexport interface ConstellationAnchorInput {\n id: string;\n footprintRadius: number;\n}\n\nexport interface ConstellationAnchorOptions {\n /** Gap between constellation bounds in scene spacings (default 2). */\n minGapScenes?: number;\n levelSpacing?: number;\n visualPadding?: number;\n}\n\nfunction sortScenesForConstellationLayout(\n sceneList: ConstellationLayoutScene[],\n): ConstellationLayoutScene[] {\n return [...sceneList].sort((a, b) => {\n if (a.is_title !== b.is_title) return a.is_title ? -1 : 1;\n if (a.is_end !== b.is_end) return a.is_end ? 1 : -1;\n const orderA = a.order ?? 0;\n const orderB = b.order ?? 0;\n if (orderA !== orderB) return orderA - orderB;\n return (a.created_at ?? \"\").localeCompare(b.created_at ?? \"\");\n });\n}\n\nfunction orderScenesForConstellationLayout(\n sceneList: ConstellationLayoutScene[],\n graph: ConstellationLayoutGraph | undefined,\n): ConstellationLayoutScene[] {\n if (!graph?.nodes?.length) return sortScenesForConstellationLayout(sceneList);\n\n const sceneById = new Map(sceneList.map((scene) => [scene.id, scene]));\n const ordered: ConstellationLayoutScene[] = [];\n const seen = new Set<string>();\n\n const sortedNodes = [...graph.nodes].sort((a, b) => {\n if (a.level !== b.level) return a.level - b.level;\n if (a.x !== b.x) return a.x - b.x;\n return (a.index ?? 0) - (b.index ?? 0);\n });\n\n for (const node of sortedNodes) {\n const scene = sceneById.get(node.id);\n if (scene && !seen.has(scene.id)) {\n ordered.push(scene);\n seen.add(scene.id);\n }\n }\n\n for (const scene of sortScenesForConstellationLayout(sceneList)) {\n if (!seen.has(scene.id)) {\n ordered.push(scene);\n seen.add(scene.id);\n }\n }\n\n return ordered;\n}\n\n/**\n * Scene positions relative to the title star at the origin (constellation anchor).\n */\nexport function computeConstellationScenePositions(\n scenes: ConstellationLayoutScene[],\n graph: ConstellationLayoutGraph | undefined,\n anchor: Vec3 = [0, 0, 0],\n): Map<string, Vec3> {\n const positions = new Map<string, Vec3>();\n const ordered = orderScenesForConstellationLayout(scenes, graph);\n const count = ordered.length;\n\n if (!graph?.nodes?.length) {\n ordered.forEach((scene, idx) => {\n const along = count === 1 ? 0 : idx * COSMOS_SCENE_LEVEL_SPACING;\n positions.set(scene.id, [anchor[0] + along, anchor[1], anchor[2]]);\n });\n return positions;\n }\n\n const nodeById = new Map(graph.nodes.map((node) => [node.id, node]));\n const rootId = graph.meta?.root_id ?? graph.nodes[0]?.id;\n const rootNode = rootId ? nodeById.get(rootId) : graph.nodes[0];\n\n ordered.forEach((scene, idx) => {\n const node = nodeById.get(scene.id);\n if (node && rootNode) {\n const alongPath = node.level * COSMOS_SCENE_LEVEL_SPACING;\n const branchSpread = (node.x - rootNode.x) * COSMOS_SCENE_BRANCH_SPACING;\n positions.set(scene.id, [\n anchor[0] + alongPath,\n anchor[1],\n anchor[2] + branchSpread,\n ]);\n return;\n }\n const along = count === 1 ? 0 : idx * COSMOS_SCENE_LEVEL_SPACING;\n positions.set(scene.id, [anchor[0] + along, anchor[1], anchor[2]]);\n });\n\n return positions;\n}\n\n/** Bounding radius from the title anchor to the outermost scene plus visual padding. */\nexport function constellationFootprintRadius(\n localPositions: Map<string, Vec3>,\n padding: number = COSMOS_CONSTELLATION_VISUAL_PADDING,\n): number {\n let maxReach = COSMOS_DEFAULT_FOOTPRINT_RADIUS;\n for (const [x, , z] of localPositions.values()) {\n maxReach = Math.max(maxReach, Math.hypot(x, z) + padding);\n }\n return maxReach;\n}\n\nfunction circlesSeparated(\n ax: number,\n az: number,\n aRadius: number,\n bx: number,\n bz: number,\n bRadius: number,\n minGap: number,\n): boolean {\n return Math.hypot(ax - bx, az - bz) >= aRadius + bRadius + minGap;\n}\n\nfunction findConstellationAnchor(\n footprintRadius: number,\n placed: Array<{ x: number; z: number; radius: number }>,\n minGap: number,\n): Vec3 {\n if (placed.length === 0) return [0, 0, 0];\n\n let angle = 0;\n let radius = 0;\n const angleStep = 0.62;\n const radiusGrowth = minGap * 0.75;\n\n for (let attempt = 0; attempt < 8000; attempt++) {\n angle += angleStep;\n radius += radiusGrowth / (2 * Math.PI);\n const cx = Math.cos(angle) * radius;\n const cz = Math.sin(angle) * radius;\n const ok = placed.every((other) =>\n circlesSeparated(cx, cz, footprintRadius, other.x, other.z, other.radius, minGap),\n );\n if (ok) return [cx, 0, cz];\n }\n\n const fallback = placed.length * (minGap + footprintRadius * 2);\n return [fallback, 0, 0];\n}\n\n/**\n * Place constellation anchors so each title star stays outside other\n * constellations, with at least `minGapScenes` scene spacings between bounds.\n */\nexport function distributeConstellationAnchors(\n items: ConstellationAnchorInput[],\n options: ConstellationAnchorOptions = {},\n): Map<string, Vec3> {\n const minGapScenes = options.minGapScenes ?? COSMOS_CONSTELLATION_GAP_SCENES;\n const levelSpacing = options.levelSpacing ?? COSMOS_SCENE_LEVEL_SPACING;\n const minGap = minGapScenes * levelSpacing;\n\n const anchors = new Map<string, Vec3>();\n const placed: Array<{ x: number; z: number; radius: number }> = [];\n\n for (const item of items) {\n const [x, , z] = findConstellationAnchor(item.footprintRadius, placed, minGap);\n anchors.set(item.id, [x, 0, z]);\n placed.push({ x, z, radius: item.footprintRadius });\n }\n\n return anchors;\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"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -548,6 +548,41 @@ interface AiStoryGenerateResponse {
|
|
|
548
548
|
generation: AiStoryGenerationResult;
|
|
549
549
|
balance: CreditBalance;
|
|
550
550
|
}
|
|
551
|
+
type AiSceneMode = "create" | "overwrite";
|
|
552
|
+
interface AiSceneEstimateRequest {
|
|
553
|
+
story_id: string;
|
|
554
|
+
brief: string;
|
|
555
|
+
mode: AiSceneMode;
|
|
556
|
+
scene_id?: string;
|
|
557
|
+
}
|
|
558
|
+
interface AiSceneEstimateResponse {
|
|
559
|
+
estimate: AiStoryTokenEstimate;
|
|
560
|
+
scene_credits: number;
|
|
561
|
+
total_credits: number;
|
|
562
|
+
balance: CreditBalance;
|
|
563
|
+
can_afford: boolean;
|
|
564
|
+
}
|
|
565
|
+
interface AiSceneGenerateRequest {
|
|
566
|
+
story_id: string;
|
|
567
|
+
brief: string;
|
|
568
|
+
mode: AiSceneMode;
|
|
569
|
+
scene_id?: string;
|
|
570
|
+
}
|
|
571
|
+
interface AiSceneGenerationResult {
|
|
572
|
+
id: string;
|
|
573
|
+
story_id: string;
|
|
574
|
+
mode: AiSceneMode;
|
|
575
|
+
scene: AiStoryScenePayload;
|
|
576
|
+
input_tokens: number;
|
|
577
|
+
output_tokens: number;
|
|
578
|
+
credits_charged: number;
|
|
579
|
+
scene_credits: number;
|
|
580
|
+
model_id: string;
|
|
581
|
+
}
|
|
582
|
+
interface AiSceneGenerateResponse {
|
|
583
|
+
generation: AiSceneGenerationResult;
|
|
584
|
+
balance: CreditBalance;
|
|
585
|
+
}
|
|
551
586
|
interface MediaItem {
|
|
552
587
|
id: string;
|
|
553
588
|
user_id: string;
|
|
@@ -681,4 +716,4 @@ declare function computeSceneVisibility(sceneList: Pick<SceneListItem, "is_title
|
|
|
681
716
|
endingSeen: boolean;
|
|
682
717
|
}): SceneVisibility[];
|
|
683
718
|
|
|
684
|
-
export { type AcceptGenerationRequest, type AcceptGenerationResponse, type AiGeneration, type AiGenerationShowResponse, type AiGenerationStatus, type AiStoryEstimateRequest, type AiStoryEstimateResponse, type AiStoryGenerateRequest, type AiStoryGenerateResponse, type AiStoryGenerationResult, type AiStoryScenePayload, type AiStoryTokenEstimate, type BookmarkListItem, type BookmarkListResponse, type BookmarkResponse, type CatalogResponse, type ContentRating, type ContentRatingDefinition, type CreateSceneActionRequest, type CreateSceneRequest, type CreateStoryRequest, type CreditBalance, type CreditBalanceResponse, type CreditPack, type CreditPool, type EngagementResponse, type GenerateImageRequest, type GenerateImageResponse, type GrantCreditsRequest, type GrantCreditsResponse, 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 PaymentMethod, type PlayUrlResponse, type PopularChoice, type PublicDirectorProfile, type PurchaseAmountRequest, type PurchaseCreditsRequest, type PurchaseCreditsResponse, 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 StorePaymentMethodRequest, 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 UploadCostResponse, type UploadUrlRequest, type UploadUrlResponse, type UserProfile, type UsernameAvailabilityResponse, type VisibilityCondition, type VisibilityRules, type WatchSnapshot, computeSceneVisibility };
|
|
719
|
+
export { type AcceptGenerationRequest, type AcceptGenerationResponse, type AiGeneration, type AiGenerationShowResponse, type AiGenerationStatus, type AiSceneEstimateRequest, type AiSceneEstimateResponse, type AiSceneGenerateRequest, type AiSceneGenerateResponse, type AiSceneGenerationResult, type AiSceneMode, type AiStoryEstimateRequest, type AiStoryEstimateResponse, type AiStoryGenerateRequest, type AiStoryGenerateResponse, type AiStoryGenerationResult, type AiStoryScenePayload, type AiStoryTokenEstimate, type BookmarkListItem, type BookmarkListResponse, type BookmarkResponse, type CatalogResponse, type ContentRating, type ContentRatingDefinition, type CreateSceneActionRequest, type CreateSceneRequest, type CreateStoryRequest, type CreditBalance, type CreditBalanceResponse, type CreditPack, type CreditPool, type EngagementResponse, type GenerateImageRequest, type GenerateImageResponse, type GrantCreditsRequest, type GrantCreditsResponse, 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 PaymentMethod, type PlayUrlResponse, type PopularChoice, type PublicDirectorProfile, type PurchaseAmountRequest, type PurchaseCreditsRequest, type PurchaseCreditsResponse, 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 StorePaymentMethodRequest, 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 UploadCostResponse, type UploadUrlRequest, type UploadUrlResponse, type UserProfile, type UsernameAvailabilityResponse, type VisibilityCondition, type VisibilityRules, type WatchSnapshot, computeSceneVisibility };
|