@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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/realms/cosmos/appearance.ts","../../../src/realms/cosmos/index.ts"],"names":[],"mappings":";AAuCO,IAAM,gCAAA,GAA4D;AAAA,EACvE,aAAA,EAAe,EAAA;AAAA,EACf,YAAA,EAAc,IAAA;AAAA,EACd,UAAA,EAAY,SAAA;AAAA,EACZ,kBAAA,EAAoB,CAAA;AAAA,EACpB,YAAA,EAAc,EAAA;AAAA,EACd,mBAAA,EAAqB,EAAA;AAAA,EACrB,eAAA,EAAiB,CAAC,CAAA,EAAG,CAAC,CAAA;AAAA,EAEtB,YAAA,EAAc,GAAA;AAAA,EACd,aAAA,EAAe,EAAA;AAAA,EACf,cAAA,EAAgB,GAAA;AAAA,EAChB,aAAA,EAAe,EAAA;AAAA,EACf,kBAAA,EAAoB,GAAA;AAAA,EACpB,aAAA,EAAe,GAAA;AAAA,EACf,QAAA,EAAU,EAAA;AAAA,EACV,kBAAA,EAAoB,EAAA;AAAA,EACpB,uBAAA,EAAyB,EAAA;AAAA,EAEzB,mBAAA,EAAqB,CAAC,CAAA,EAAG,CAAA,EAAG,EAAE,CAAA;AAAA,EAC9B,kBAAA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AAa,+BAAA;AAAA,EACb,UAAA,EAAY,gCAAA;AAAA,EACZ,YAAA,EAAc,2BAAA;AAAA,EACd,UAAA,EAAY;AACd","file":"index.js","sourcesContent":["/**\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 /** Max width for scene labels beneath preview cards (px). */\n labelMaxWidth: 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 labelMaxWidth: 240,\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 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"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/realms/cosmos/appearance.ts","../../../src/realms/cosmos/index.ts"],"names":[],"mappings":";AAoEO,IAAM,gCAAA,GAA4D;AAAA,EACvE,aAAA,EAAe,EAAA;AAAA,EACf,YAAA,EAAc,IAAA;AAAA,EACd,UAAA,EAAY,SAAA;AAAA,EACZ,kBAAA,EAAoB,CAAA;AAAA,EACpB,YAAA,EAAc,EAAA;AAAA,EACd,mBAAA,EAAqB,EAAA;AAAA,EACrB,eAAA,EAAiB,CAAC,CAAA,EAAG,CAAC,CAAA;AAA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aAAY,CAAE,OAAA,CAAQ,WAAW,EAAE,CAAA;AACvE,EAAA,MAAM,OAAA,GAAU,EAAA;AAChB,EAAA,MAAM,OAAA,GAAU,SAAS,OAAO,CAAA;AAChC,EAAA,MAAM,WAAA,GAAc,iBAAiB,QAAQ,CAAA;AAC7C,EAAA,IAAI,OAAA,KAAY,QAAW,OAAO,OAAA;AAClC,EAAA,IAAI,WAAA,KAAgB,QAAW,OAAO,WAAA;AACtC,EAAA,OAAO,GAAA;AACT;AAEA,SAAS,YAAY,IAAA,EAAgC;AAGnD,EAAA,OAAO,IAAA,CAAK,YAAY,SAAA,GAAY,KAAA;AACtC;AAEO,IAAM,aAAA,GAA6B,CAAC,IAAA,MAAU;AAAA,EACnD,QAAA,EAAU,CAAC,CAAA,EAAG,CAAA,EAAG,CAAC,CAAA;AAAA;AAAA,EAClB,KAAA,EAAO,YAAY,IAAI,CAAA;AAAA,EACvB,GAAA,EAAK,UAAU,IAAI,CAAA;AAAA,EACnB,SAAA,EAAW,sBAAsB,IAAI,CAAA;AAAA,EACrC,KAAA,EAAO,YAAY,IAAI,CAAA;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAO,IAAA,CAAK,KAAA;AAAA,IACZ,YAAY,IAAA,CAAK,kBAAA;AAAA,IACjB,OAAO,IAAA,CAAK;AAAA;AAEhB,CAAA;AAEO,IAAM,YAAA,GAA6B;AAAA,EACxC,kBAAA,EAAoB,EAAA;AAAA,EACpB,aAAA,EAAe,IAAA;AAAA,EACf,WAAA,EAAa,GAAA;AAAA,EACb,gBAAA,EAAkB,GAAA;AAAA,EAClB,cAAA,EAAgB;AAClB;AAYO,IAAM,WAAA,GAA4B;AAAA;AAAA;AAAA,EAGvC,WAAA,EAAa,+BAAA;AAAA,EACb,UAAA,EAAY,gCAAA;AAAA,EACZ,YAAA,EAAc,2BAAA;AAAA,EACd,UAAA,EAAY;AACd","file":"index.js","sourcesContent":["/** Swirling dust motes around a launched constellation. */\nexport interface PublishedDustAppearance {\n enabled: boolean;\n count: number;\n /** Orbit radius multiplier relative to constellation span. */\n orbitRadius: number;\n /** Angular speed of the swirl. */\n speed: number;\n color: string;\n opacity: number;\n}\n\n/** Visual treatment applied when a story is published / launched. */\nexport interface PublishedEffectAppearance {\n enabled: boolean;\n /** Extra HSL saturation added to each star (0–50). */\n starSaturationBoost: number;\n /** Extra HSL lightness added to each star (0–30). */\n starLightnessBoost: number;\n /** Multiplier on edge glow and core opacity (1 = baseline). */\n edgeGlowMultiplier: number;\n dust: PublishedDustAppearance;\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 /** Max width for scene labels beneath preview cards (px). */\n labelMaxWidth: number;\n labelGap: number;\n /** Reserved space below preview for the 2×2 HUD control grid (px). */\n controlsGridHeight: number;\n billboardDistanceFactor: number;\n /** Scene names beneath preview cards (off by default — title lives on the arc). */\n showSceneLabels: boolean;\n\n /** Launched-story shimmer: brighter stars, edges, and optional dust swirl. */\n publishedEffect: PublishedEffectAppearance;\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 labelMaxWidth: 240,\n labelGap: 10,\n controlsGridHeight: 92,\n billboardDistanceFactor: 10,\n showSceneLabels: false,\n\n publishedEffect: {\n enabled: true,\n starSaturationBoost: 18,\n starLightnessBoost: 14,\n edgeGlowMultiplier: 1.65,\n dust: {\n enabled: true,\n count: 28,\n orbitRadius: 1.35,\n speed: 0.42,\n color: \"#c8dce8\",\n opacity: 0.5,\n },\n },\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 const base = { ...DEFAULT_CONSTELLATION_APPEARANCE, ...overrides };\n if (overrides?.publishedEffect) {\n base.publishedEffect = {\n ...DEFAULT_CONSTELLATION_APPEARANCE.publishedEffect,\n ...overrides.publishedEffect,\n dust: {\n ...DEFAULT_CONSTELLATION_APPEARANCE.publishedEffect.dust,\n ...overrides.publishedEffect.dust,\n },\n };\n }\n return base;\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 {\n ConstellationAppearance,\n PublishedEffectAppearance,\n PublishedDustAppearance,\n} 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"]}
|
package/dist/ui/index.js
CHANGED
|
@@ -237,6 +237,7 @@ var REALMS = {
|
|
|
237
237
|
tags_placeholder: "Search signal tags\u2026",
|
|
238
238
|
tags_empty: "No signal tags yet",
|
|
239
239
|
tags_required: "At least one signal tag is required.",
|
|
240
|
+
error_rate_limited: "Signal congestion. Wait a moment and try again.",
|
|
240
241
|
story_picker_label: "Constellations",
|
|
241
242
|
created_by: "Directed by",
|
|
242
243
|
chosen_by: "Chosen by",
|
|
@@ -619,6 +620,7 @@ var REALMS = {
|
|
|
619
620
|
tags_placeholder: "Search root tags\u2026",
|
|
620
621
|
tags_empty: "No root tags yet",
|
|
621
622
|
tags_required: "At least one root tag is required.",
|
|
623
|
+
error_rate_limited: "The grove needs a breath. Wait a moment and try again.",
|
|
622
624
|
story_picker_label: "Groves",
|
|
623
625
|
created_by: "Tended by",
|
|
624
626
|
chosen_by: "Chosen by",
|
|
@@ -999,6 +1001,7 @@ var FALLBACK_LEXICON = {
|
|
|
999
1001
|
tags_placeholder: "Search tags\u2026",
|
|
1000
1002
|
tags_empty: "No tags yet",
|
|
1001
1003
|
tags_required: "At least one tag is required.",
|
|
1004
|
+
error_rate_limited: "Too many requests. Wait a moment and try again.",
|
|
1002
1005
|
story_picker_label: "Stories",
|
|
1003
1006
|
created_by: "Created by",
|
|
1004
1007
|
chosen_by: "Chosen by",
|