@chuzi/shared 1.3.51 → 1.3.53
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/{appearance-KP3Sa6EI.d.ts → appearance-BeQf2Gi7.d.ts} +27 -1
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/realms/cosmos/components/index.d.ts +25 -6
- package/dist/realms/cosmos/components/index.js +107 -12
- package/dist/realms/cosmos/components/index.js.map +1 -1
- package/dist/realms/cosmos/index.d.ts +1 -1
- package/dist/realms/cosmos/index.js +27 -1
- package/dist/realms/cosmos/index.js.map +1 -1
- package/dist/ui/index.js +3 -0
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { AtomVisualProps } from '../../index.js';
|
|
4
|
-
import { C as ConstellationAppearance } from '../../../appearance-
|
|
5
|
-
export { D as DEFAULT_CONSTELLATION_APPEARANCE, m as mergeConstellationAppearance } from '../../../appearance-
|
|
4
|
+
import { C as ConstellationAppearance, P as PublishedDustAppearance } from '../../../appearance-BeQf2Gi7.js';
|
|
5
|
+
export { D as DEFAULT_CONSTELLATION_APPEARANCE, a as PublishedEffectAppearance, m as mergeConstellationAppearance } from '../../../appearance-BeQf2Gi7.js';
|
|
6
6
|
import { StoryListItem } from '../../../types/index.js';
|
|
7
7
|
|
|
8
8
|
interface WorldProps {
|
|
@@ -26,6 +26,11 @@ interface StarProps {
|
|
|
26
26
|
dimmed?: boolean;
|
|
27
27
|
/** Non-navigable — suppresses click and lowers brightness further. */
|
|
28
28
|
locked?: boolean;
|
|
29
|
+
/** Launched-story boost — extra saturation and lightness from theme tokens. */
|
|
30
|
+
publishedBoost?: {
|
|
31
|
+
saturationBoost: number;
|
|
32
|
+
lightnessBoost: number;
|
|
33
|
+
};
|
|
29
34
|
}
|
|
30
35
|
/**
|
|
31
36
|
* One film as a star. Color is HSL-derived from the realm mapping's hue +
|
|
@@ -33,7 +38,7 @@ interface StarProps {
|
|
|
33
38
|
* breathe in lockstep — gives the field life without per-star animation
|
|
34
39
|
* state.
|
|
35
40
|
*/
|
|
36
|
-
declare function Star({ visual, onSelect, dimmed, locked }: StarProps): react_jsx_runtime.JSX.Element;
|
|
41
|
+
declare function Star({ visual, onSelect, dimmed, locked, publishedBoost }: StarProps): react_jsx_runtime.JSX.Element;
|
|
37
42
|
|
|
38
43
|
interface ConstellationBounds {
|
|
39
44
|
center: [number, number, number];
|
|
@@ -113,6 +118,8 @@ interface ConstellationProps {
|
|
|
113
118
|
appearance?: Partial<ConstellationAppearance>;
|
|
114
119
|
/** When false, hide Html billboards and arc title (e.g. while editor is open). */
|
|
115
120
|
showOverlays?: boolean;
|
|
121
|
+
/** When true and theme publishedEffect is enabled, stars/edges glow brighter. */
|
|
122
|
+
published?: boolean;
|
|
116
123
|
onSceneSelect?: (index: number) => void;
|
|
117
124
|
}
|
|
118
125
|
/**
|
|
@@ -120,7 +127,7 @@ interface ConstellationProps {
|
|
|
120
127
|
* luminous gradient edges. This is the cosmos realm's `Group` component —
|
|
121
128
|
* identical rendering for own and others' stories.
|
|
122
129
|
*/
|
|
123
|
-
declare function Constellation({ scenes, storyTitle, storyOverlay, edges, appearance: appearanceOverrides, showOverlays, onSceneSelect, }: ConstellationProps): react_jsx_runtime.JSX.Element;
|
|
130
|
+
declare function Constellation({ scenes, storyTitle, storyOverlay, edges, appearance: appearanceOverrides, showOverlays, published, onSceneSelect, }: ConstellationProps): react_jsx_runtime.JSX.Element;
|
|
124
131
|
|
|
125
132
|
type ConstellationEdgeVariant = "solid" | "dotted";
|
|
126
133
|
interface ConstellationEdgeProps {
|
|
@@ -134,6 +141,8 @@ interface ConstellationEdgeProps {
|
|
|
134
141
|
intensityB?: number;
|
|
135
142
|
/** Reduce opacity to indicate an unwatched connection. */
|
|
136
143
|
dimmed?: boolean;
|
|
144
|
+
/** Multiplier on glow/core opacity for launched stories (1 = baseline). */
|
|
145
|
+
glowMultiplier?: number;
|
|
137
146
|
/** @deprecated All edges render as soft solid glow; variant is ignored. */
|
|
138
147
|
variant?: ConstellationEdgeVariant;
|
|
139
148
|
}
|
|
@@ -142,7 +151,7 @@ interface ConstellationEdgeProps {
|
|
|
142
151
|
* pulled inward so the line floats between the stars rather than touching
|
|
143
152
|
* them. Color interpolates from hueA to hueB via vertex colors.
|
|
144
153
|
*/
|
|
145
|
-
declare function ConstellationEdge({ from, to, hueA, hueB, gap, intensityA, intensityB, dimmed, }: ConstellationEdgeProps): react_jsx_runtime.JSX.Element | null;
|
|
154
|
+
declare function ConstellationEdge({ from, to, hueA, hueB, gap, intensityA, intensityB, dimmed, glowMultiplier, }: ConstellationEdgeProps): react_jsx_runtime.JSX.Element | null;
|
|
146
155
|
|
|
147
156
|
interface CosmosSandboxProps {
|
|
148
157
|
films: StoryListItem[];
|
|
@@ -263,4 +272,14 @@ interface StarBillboardProps {
|
|
|
263
272
|
*/
|
|
264
273
|
declare function StarBillboard({ label, appearance, previewImageUrl, previewContent, dimmed, focused, visible, controlsSlot, }: StarBillboardProps): react_jsx_runtime.JSX.Element | null;
|
|
265
274
|
|
|
266
|
-
|
|
275
|
+
interface PublishedConstellationAuraProps {
|
|
276
|
+
bounds: ConstellationBounds;
|
|
277
|
+
dust: PublishedDustAppearance;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Soft dust motes swirling around a launched constellation. Driven entirely
|
|
281
|
+
* by theme tokens so admins can tune count, speed, and color.
|
|
282
|
+
*/
|
|
283
|
+
declare function PublishedConstellationAura({ bounds, dust, }: PublishedConstellationAuraProps): react_jsx_runtime.JSX.Element;
|
|
284
|
+
|
|
285
|
+
export { COSMOS_BRANCH_SIBLING_SPACING, COSMOS_CONSTELLATION_GAP_SCENES, COSMOS_CONSTELLATION_VISUAL_PADDING, COSMOS_DEFAULT_FOOTPRINT_RADIUS, COSMOS_MAX_SCENE_EDGE_LENGTH, COSMOS_MIN_EDGE_CLEARANCE, COSMOS_MIN_NODE_CLEARANCE, COSMOS_SCENE_BRANCH_SPACING, COSMOS_SCENE_LEVEL_SPACING, Constellation, type ConstellationAnchorInput, type ConstellationAnchorOptions, ConstellationAppearance, type ConstellationBounds, ConstellationEdge, type ConstellationEdgeEntry, type ConstellationEdgeProps, type ConstellationLayoutEdge, type ConstellationLayoutGraph, type ConstellationLayoutNode, type ConstellationLayoutScene, type ConstellationProps, type ConstellationSceneEntry, type ConstellationStoryOverlay, ConstellationTitle, type ConstellationTitleProps, CosmosSandbox, type CosmosSandboxProps, type DistributeOptions, PublishedConstellationAura, type PublishedConstellationAuraProps, PublishedDustAppearance, Star, StarBillboard, type StarBillboardProps, type StarProps, type Vec3, World, type WorldProps, computeConstellationBounds, computeConstellationScenePositions, constellationFootprintRadius, distributeConstellationAnchors, distributeStars };
|
|
@@ -37,16 +37,19 @@ function World({ children, dpr = [1, 2] }) {
|
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
|
-
function Star({ visual, onSelect, dimmed, locked }) {
|
|
40
|
+
function Star({ visual, onSelect, dimmed, locked, publishedBoost }) {
|
|
41
41
|
const ref = useRef(null);
|
|
42
42
|
useFrame(({ clock }) => {
|
|
43
43
|
if (!ref.current) return;
|
|
44
44
|
const phase = visual.position[0] * 0.7 + visual.position[2] * 0.3;
|
|
45
|
-
const
|
|
45
|
+
const pulseAmp = publishedBoost ? 0.08 : 0.05;
|
|
46
|
+
const pulse = 1 + Math.sin(clock.elapsedTime * 0.8 + phase) * pulseAmp;
|
|
46
47
|
ref.current.scale.setScalar(visual.scale * pulse);
|
|
47
48
|
});
|
|
48
|
-
const
|
|
49
|
-
const
|
|
49
|
+
const boostSat = publishedBoost?.saturationBoost ?? 0;
|
|
50
|
+
const boostLight = publishedBoost?.lightnessBoost ?? 0;
|
|
51
|
+
const saturation = (dimmed || locked ? 25 : 75) + boostSat;
|
|
52
|
+
const lightness = (dimmed || locked ? 25 + visual.intensity * 10 : 50 + visual.intensity * 25) + boostLight;
|
|
50
53
|
const color = `hsl(${visual.hue}, ${saturation}%, ${lightness}%)`;
|
|
51
54
|
const handleClick = locked ? void 0 : onSelect ? (e) => {
|
|
52
55
|
e.stopPropagation();
|
|
@@ -92,13 +95,39 @@ var DEFAULT_CONSTELLATION_APPEARANCE = {
|
|
|
92
95
|
labelGap: 10,
|
|
93
96
|
controlsGridHeight: 92,
|
|
94
97
|
billboardDistanceFactor: 10,
|
|
98
|
+
showSceneLabels: false,
|
|
99
|
+
publishedEffect: {
|
|
100
|
+
enabled: true,
|
|
101
|
+
starSaturationBoost: 18,
|
|
102
|
+
starLightnessBoost: 14,
|
|
103
|
+
edgeGlowMultiplier: 1.65,
|
|
104
|
+
dust: {
|
|
105
|
+
enabled: true,
|
|
106
|
+
count: 28,
|
|
107
|
+
orbitRadius: 1.35,
|
|
108
|
+
speed: 0.42,
|
|
109
|
+
color: "#c8dce8",
|
|
110
|
+
opacity: 0.5
|
|
111
|
+
}
|
|
112
|
+
},
|
|
95
113
|
cameraDefaultOffset: [0, 4, 12],
|
|
96
114
|
cameraTargetOffset: [0, 0, 0],
|
|
97
115
|
cameraSlideLerp: 0.035,
|
|
98
116
|
cameraArrivalThreshold: 0.08
|
|
99
117
|
};
|
|
100
118
|
function mergeConstellationAppearance(overrides) {
|
|
101
|
-
|
|
119
|
+
const base = { ...DEFAULT_CONSTELLATION_APPEARANCE, ...overrides };
|
|
120
|
+
if (overrides?.publishedEffect) {
|
|
121
|
+
base.publishedEffect = {
|
|
122
|
+
...DEFAULT_CONSTELLATION_APPEARANCE.publishedEffect,
|
|
123
|
+
...overrides.publishedEffect,
|
|
124
|
+
dust: {
|
|
125
|
+
...DEFAULT_CONSTELLATION_APPEARANCE.publishedEffect.dust,
|
|
126
|
+
...overrides.publishedEffect.dust
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
return base;
|
|
102
131
|
}
|
|
103
132
|
function ConstellationEdge({
|
|
104
133
|
from,
|
|
@@ -108,7 +137,8 @@ function ConstellationEdge({
|
|
|
108
137
|
gap = 0.55,
|
|
109
138
|
intensityA = 0.5,
|
|
110
139
|
intensityB = 0.5,
|
|
111
|
-
dimmed
|
|
140
|
+
dimmed,
|
|
141
|
+
glowMultiplier = 1
|
|
112
142
|
}) {
|
|
113
143
|
const { points, colorA, colorB, glowA, glowB } = useMemo(() => {
|
|
114
144
|
const a = new THREE.Vector3(...from);
|
|
@@ -136,8 +166,8 @@ function ConstellationEdge({
|
|
|
136
166
|
};
|
|
137
167
|
}, [from, to, hueA, hueB, gap, intensityA, intensityB]);
|
|
138
168
|
if (!points || !colorA || !colorB || !glowA || !glowB) return null;
|
|
139
|
-
const glowOpacity = dimmed ? 0.04 : 0.12;
|
|
140
|
-
const coreOpacity = dimmed ? 0.15 : 0.6;
|
|
169
|
+
const glowOpacity = (dimmed ? 0.04 : 0.12) * glowMultiplier;
|
|
170
|
+
const coreOpacity = (dimmed ? 0.15 : 0.6) * glowMultiplier;
|
|
141
171
|
return /* @__PURE__ */ jsxs("group", { children: [
|
|
142
172
|
/* @__PURE__ */ jsx(
|
|
143
173
|
Line,
|
|
@@ -573,7 +603,7 @@ function StarBillboard({
|
|
|
573
603
|
children: controlsSlot
|
|
574
604
|
}
|
|
575
605
|
) : null,
|
|
576
|
-
/* @__PURE__ */ jsx(
|
|
606
|
+
appearance.showSceneLabels && label ? /* @__PURE__ */ jsx(
|
|
577
607
|
"div",
|
|
578
608
|
{
|
|
579
609
|
style: {
|
|
@@ -595,7 +625,7 @@ function StarBillboard({
|
|
|
595
625
|
},
|
|
596
626
|
children: label
|
|
597
627
|
}
|
|
598
|
-
)
|
|
628
|
+
) : null
|
|
599
629
|
]
|
|
600
630
|
}
|
|
601
631
|
)
|
|
@@ -603,6 +633,55 @@ function StarBillboard({
|
|
|
603
633
|
}
|
|
604
634
|
);
|
|
605
635
|
}
|
|
636
|
+
function PublishedConstellationAura({
|
|
637
|
+
bounds,
|
|
638
|
+
dust
|
|
639
|
+
}) {
|
|
640
|
+
const groupRef = useRef(null);
|
|
641
|
+
const particles = useMemo(() => {
|
|
642
|
+
const items = [];
|
|
643
|
+
for (let i = 0; i < dust.count; i++) {
|
|
644
|
+
items.push({
|
|
645
|
+
angle: i / dust.count * Math.PI * 2,
|
|
646
|
+
radius: dust.orbitRadius * (0.65 + i % 5 * 0.08),
|
|
647
|
+
yOffset: (i % 7 - 3) * 0.35,
|
|
648
|
+
phase: i * 0.73 % (Math.PI * 2),
|
|
649
|
+
size: 0.035 + i % 4 * 0.015,
|
|
650
|
+
drift: 0.6 + i % 3 * 0.25
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
return items;
|
|
654
|
+
}, [dust.count, dust.orbitRadius]);
|
|
655
|
+
useFrame(({ clock }) => {
|
|
656
|
+
if (!groupRef.current) return;
|
|
657
|
+
const t = clock.elapsedTime * dust.speed;
|
|
658
|
+
const rx = bounds.spanX * 0.5;
|
|
659
|
+
const rz = bounds.spanZ * 0.5;
|
|
660
|
+
groupRef.current.children.forEach((child, i) => {
|
|
661
|
+
const p = particles[i];
|
|
662
|
+
if (!p) return;
|
|
663
|
+
const a = p.angle + t * p.drift + p.phase;
|
|
664
|
+
child.position.set(
|
|
665
|
+
Math.cos(a) * rx * p.radius,
|
|
666
|
+
p.yOffset + Math.sin(t * 1.4 + p.phase) * 0.45,
|
|
667
|
+
Math.sin(a) * rz * p.radius
|
|
668
|
+
);
|
|
669
|
+
});
|
|
670
|
+
});
|
|
671
|
+
return /* @__PURE__ */ jsx("group", { ref: groupRef, position: bounds.center, children: particles.map((p, i) => /* @__PURE__ */ jsxs("mesh", { children: [
|
|
672
|
+
/* @__PURE__ */ jsx("sphereGeometry", { args: [p.size, 6, 6] }),
|
|
673
|
+
/* @__PURE__ */ jsx(
|
|
674
|
+
"meshBasicMaterial",
|
|
675
|
+
{
|
|
676
|
+
color: dust.color,
|
|
677
|
+
transparent: true,
|
|
678
|
+
opacity: dust.opacity,
|
|
679
|
+
toneMapped: false,
|
|
680
|
+
depthWrite: false
|
|
681
|
+
}
|
|
682
|
+
)
|
|
683
|
+
] }, i)) });
|
|
684
|
+
}
|
|
606
685
|
function Constellation({
|
|
607
686
|
scenes,
|
|
608
687
|
storyTitle,
|
|
@@ -610,9 +689,16 @@ function Constellation({
|
|
|
610
689
|
edges = [],
|
|
611
690
|
appearance: appearanceOverrides,
|
|
612
691
|
showOverlays = true,
|
|
692
|
+
published = false,
|
|
613
693
|
onSceneSelect
|
|
614
694
|
}) {
|
|
615
695
|
const appearance = mergeConstellationAppearance(appearanceOverrides);
|
|
696
|
+
const publishedActive = published && appearance.publishedEffect.enabled;
|
|
697
|
+
const publishedBoost = publishedActive ? {
|
|
698
|
+
saturationBoost: appearance.publishedEffect.starSaturationBoost,
|
|
699
|
+
lightnessBoost: appearance.publishedEffect.starLightnessBoost
|
|
700
|
+
} : void 0;
|
|
701
|
+
const edgeGlowMultiplier = publishedActive ? appearance.publishedEffect.edgeGlowMultiplier : 1;
|
|
616
702
|
const sceneMap = new Map(scenes.map((s, i) => [s.id, { entry: s, index: i }]));
|
|
617
703
|
const bounds = computeConstellationBounds(
|
|
618
704
|
scenes.map((s) => s.visual.position)
|
|
@@ -628,6 +714,13 @@ function Constellation({
|
|
|
628
714
|
}
|
|
629
715
|
}
|
|
630
716
|
return /* @__PURE__ */ jsxs("group", { children: [
|
|
717
|
+
publishedActive && appearance.publishedEffect.dust.enabled && bounds ? /* @__PURE__ */ jsx(
|
|
718
|
+
PublishedConstellationAura,
|
|
719
|
+
{
|
|
720
|
+
bounds,
|
|
721
|
+
dust: appearance.publishedEffect.dust
|
|
722
|
+
}
|
|
723
|
+
) : null,
|
|
631
724
|
showOverlays && storyTitle && bounds ? /* @__PURE__ */ jsx(
|
|
632
725
|
ConstellationTitle,
|
|
633
726
|
{
|
|
@@ -646,6 +739,7 @@ function Constellation({
|
|
|
646
739
|
visual: { ...entry.visual, position: [0, 0, 0] },
|
|
647
740
|
dimmed: entry.dimmed,
|
|
648
741
|
locked: entry.locked,
|
|
742
|
+
publishedBoost,
|
|
649
743
|
onSelect: onSceneSelect ? () => onSceneSelect(i) : void 0
|
|
650
744
|
}
|
|
651
745
|
),
|
|
@@ -674,7 +768,8 @@ function Constellation({
|
|
|
674
768
|
hueB: to.visual.hue,
|
|
675
769
|
intensityA: from.visual.intensity,
|
|
676
770
|
intensityB: to.visual.intensity,
|
|
677
|
-
dimmed: edgeDimmed
|
|
771
|
+
dimmed: edgeDimmed,
|
|
772
|
+
glowMultiplier: edgeGlowMultiplier
|
|
678
773
|
},
|
|
679
774
|
`edge-${from.id}-${to.id}-${type}`
|
|
680
775
|
);
|
|
@@ -1202,6 +1297,6 @@ function CosmosSandbox({
|
|
|
1202
1297
|
)) });
|
|
1203
1298
|
}
|
|
1204
1299
|
|
|
1205
|
-
export { COSMOS_BRANCH_SIBLING_SPACING, COSMOS_CONSTELLATION_GAP_SCENES, COSMOS_CONSTELLATION_VISUAL_PADDING, COSMOS_DEFAULT_FOOTPRINT_RADIUS, COSMOS_MAX_SCENE_EDGE_LENGTH, COSMOS_MIN_EDGE_CLEARANCE, COSMOS_MIN_NODE_CLEARANCE, COSMOS_SCENE_BRANCH_SPACING, COSMOS_SCENE_LEVEL_SPACING, Constellation, ConstellationEdge, ConstellationTitle, CosmosSandbox, DEFAULT_CONSTELLATION_APPEARANCE, Star, StarBillboard, World, computeConstellationBounds, computeConstellationScenePositions, constellationFootprintRadius, distributeConstellationAnchors, distributeStars, mergeConstellationAppearance };
|
|
1300
|
+
export { COSMOS_BRANCH_SIBLING_SPACING, COSMOS_CONSTELLATION_GAP_SCENES, COSMOS_CONSTELLATION_VISUAL_PADDING, COSMOS_DEFAULT_FOOTPRINT_RADIUS, COSMOS_MAX_SCENE_EDGE_LENGTH, COSMOS_MIN_EDGE_CLEARANCE, COSMOS_MIN_NODE_CLEARANCE, COSMOS_SCENE_BRANCH_SPACING, COSMOS_SCENE_LEVEL_SPACING, Constellation, ConstellationEdge, ConstellationTitle, CosmosSandbox, DEFAULT_CONSTELLATION_APPEARANCE, PublishedConstellationAura, Star, StarBillboard, World, computeConstellationBounds, computeConstellationScenePositions, constellationFootprintRadius, distributeConstellationAnchors, distributeStars, mergeConstellationAppearance };
|
|
1206
1301
|
//# sourceMappingURL=index.js.map
|
|
1207
1302
|
//# sourceMappingURL=index.js.map
|