@lynx-js/luna-studio 0.0.0-oidc-bootstrap.0 → 0.1.1
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/LICENSE +1 -1
- package/README.md +416 -5
- package/dist/choreography/choreography-view.d.ts +9 -0
- package/dist/choreography/choreography-view.d.ts.map +1 -0
- package/dist/choreography/choreography-view.js +256 -0
- package/dist/choreography/choreography-view.js.map +1 -0
- package/dist/choreography/choreography.d.ts +10 -0
- package/dist/choreography/choreography.d.ts.map +1 -0
- package/dist/choreography/choreography.js +17 -0
- package/dist/choreography/choreography.js.map +1 -0
- package/dist/choreography/index.d.ts +3 -0
- package/dist/choreography/index.d.ts.map +1 -0
- package/dist/choreography/index.js +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/lynx-stage/index.d.ts +3 -0
- package/dist/lynx-stage/index.d.ts.map +1 -0
- package/dist/lynx-stage/index.js +1 -0
- package/dist/lynx-stage/studio-lynx-stage.d.ts +5 -0
- package/dist/lynx-stage/studio-lynx-stage.d.ts.map +1 -0
- package/dist/lynx-stage/studio-lynx-stage.js +26 -0
- package/dist/lynx-stage/studio-lynx-stage.js.map +1 -0
- package/dist/types/choreography.d.ts +106 -0
- package/dist/types/choreography.d.ts.map +1 -0
- package/dist/types/choreography.js +9 -0
- package/dist/types/choreography.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +0 -0
- package/dist/types/lynx-stage.d.ts +20 -0
- package/dist/types/lynx-stage.d.ts.map +1 -0
- package/dist/types/lynx-stage.js +0 -0
- package/dist/types/studio.d.ts +115 -0
- package/dist/types/studio.d.ts.map +1 -0
- package/dist/types/studio.js +60 -0
- package/dist/types/studio.js.map +1 -0
- package/dist/types/utils.d.ts +4 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/utils.js +0 -0
- package/dist/utils/world.d.ts +28 -0
- package/dist/utils/world.d.ts.map +1 -0
- package/dist/utils/world.js +32 -0
- package/dist/utils/world.js.map +1 -0
- package/package.json +55 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choreography/choreography-view.js","sources":["../../src/choreography/choreography-view.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { inferThemeMode } from '@lynx-js/luna-core'\nimport { useEventCallback } from '@lynx-js/luna-stage'\nimport {\n MotionPresentation,\n MotionStage,\n MotionStageContainer,\n} from '@lynx-js/luna-stage/motion'\nimport { AnimatePresence } from 'motion/react'\nimport type { SpringOptions, Transition } from 'motion/react'\nimport type {\n CSSProperties,\n JSX,\n MouseEvent as ReactMouseEvent,\n PointerEvent as ReactPointerEvent,\n} from 'react'\nimport { useMemo, useState } from 'react'\n\nimport { StudioLynxStage } from '../lynx-stage'\nimport type {\n ChoreographyViewProps,\n InteractionParams,\n LynxRuntimeCall,\n StudioResolvedStage,\n} from '../types'\nimport { getStageWorldState, isForegroundStage } from '../utils/world'\n\ntype RenderData = StudioResolvedStage & {\n world: { x: number, y: number, z: number }\n zIndex: number\n maskOpacity: number\n // Pre-resolved props for StudioLynxStage. Optional so that omitting them\n // matches `exactOptionalPropertyTypes` semantics on the consuming side.\n resolvedBundleRoot?: string\n extraGlobalProps?: Record<string, unknown>\n}\n\ntype FocusableStudioStage = StudioResolvedStage & {\n focusKey: string\n}\n\nconst slidingVariants = {\n initial: { opacity: 0, x: -300 },\n animate: { opacity: 1, x: 0 },\n exit: { opacity: 0, x: 300 },\n}\n\nconst presentationTransition: Transition = {\n type: 'spring',\n visualDuration: 0.3,\n bounce: 0.3,\n}\n\nconst fitTransition: SpringOptions = { visualDuration: 0.8, bounce: 0.1 }\n\nconst BASE_STYLE: CSSProperties = {\n width: '100%',\n height: '100%',\n pointerEvents: 'none',\n position: 'relative',\n}\n\nconst DEFAULT_STAGE_APPEARANCE_BY_MODE = {\n light: {\n outlineColor: 'rgb(0 0 0 / 0.04)',\n maskColor: '#f5f5f5',\n },\n dark: {\n outlineColor: 'rgb(255 255 255 / 0.10)',\n maskColor: '#00000080',\n },\n} as const\n\nfunction hasFocusKey(\n stage: StudioResolvedStage,\n): stage is FocusableStudioStage {\n return stage.focusKey !== undefined\n}\n\nfunction createStageInteraction(\n stage: StudioResolvedStage,\n containerEvent: MouseEvent | PointerEvent,\n): InteractionParams {\n return {\n target: 'stage',\n stageId: stage.id,\n entry: stage.entry,\n containerEvent,\n }\n}\n\nfunction createContentInteraction(\n stage: StudioResolvedStage,\n call: LynxRuntimeCall,\n): InteractionParams {\n return {\n target: 'content',\n stageId: stage.id,\n entry: stage.entry,\n runtimeCall: call,\n ...(call.data === undefined ? {} : { payload: call.data }),\n }\n}\n\n/**\n * Internal choreography renderer that resolves layout, focus state, interaction\n * normalization, and Lynx-stage wiring for the active presentation mode.\n */\nfunction ChoreographyView({\n layout,\n modeGrid,\n mode = 'compare',\n defaultFocusKey,\n className,\n style,\n bundleRoot,\n resolveFocusKey,\n buildStageGlobalProps,\n themeKey,\n stageAppearance,\n interactionTarget = 'content',\n onLynxRuntimeCall,\n onInteraction,\n}: ChoreographyViewProps): JSX.Element {\n const [activeFocusKey, setActiveFocusKey] = useState<string | undefined>(\n defaultFocusKey,\n )\n const containerInteractive = interactionTarget === 'stage'\n const contentInteractive = interactionTarget === 'content'\n const containerGrid = modeGrid?.[mode]\n\n // Stable proxies that always invoke the latest props. Safe to call from\n // event handlers.\n const resolveFocusKeyEvent = useEventCallback(resolveFocusKey)\n const onInteractionEvent = useEventCallback(onInteraction)\n const onLynxRuntimeCallEvent = useEventCallback(onLynxRuntimeCall)\n\n const dispatchInteractionEvent = useEventCallback((\n interaction: InteractionParams,\n ): void => {\n const nextActiveFocusKey = resolveFocusKeyEvent(interaction)\n if (nextActiveFocusKey !== undefined) {\n setActiveFocusKey(nextActiveFocusKey)\n }\n onInteractionEvent(interaction)\n })\n\n const stageContainerEventHandlers = useMemo(() => {\n const handlers = new Map<\n string,\n {\n onClick: (e: ReactMouseEvent | ReactPointerEvent) => void\n onPointerCancel: (e: ReactMouseEvent | ReactPointerEvent) => void\n onPointerDown: (e: ReactMouseEvent | ReactPointerEvent) => void\n onPointerUp: (e: ReactMouseEvent | ReactPointerEvent) => void\n }\n >()\n\n for (const stage of layout[mode]) {\n const dispatch = (e: ReactMouseEvent | ReactPointerEvent) => {\n dispatchInteractionEvent(createStageInteraction(stage, e.nativeEvent))\n }\n handlers.set(stage.id, {\n onClick: dispatch,\n onPointerCancel: dispatch,\n onPointerDown: dispatch,\n onPointerUp: dispatch,\n })\n }\n return handlers\n }, [dispatchInteractionEvent, layout, mode])\n\n const stageRuntimeCallHandlers = useMemo(() => {\n const handlers = new Map<string, (call: LynxRuntimeCall) => unknown>()\n\n for (const stage of layout[mode]) {\n handlers.set(stage.id, (call: LynxRuntimeCall) => {\n dispatchInteractionEvent(createContentInteraction(stage, call))\n return onLynxRuntimeCallEvent(call)\n })\n }\n return handlers\n }, [dispatchInteractionEvent, layout, mode, onLynxRuntimeCallEvent])\n\n const resolvedActiveFocusKey = useMemo(() => {\n const focusableStages = layout[mode].filter(stage => hasFocusKey(stage))\n\n if (\n activeFocusKey !== undefined\n && focusableStages.some(stage => stage.focusKey === activeFocusKey)\n ) {\n return activeFocusKey\n }\n\n return focusableStages[0]?.focusKey ?? ''\n }, [activeFocusKey, layout, mode])\n\n const rendered: RenderData[] = useMemo(() => {\n const stages = layout[mode]\n\n // Only stages with a focus key participate in focus selection and the\n // surrounding 3D fan. Stages without one remain persistent foreground\n // content, such as controls shared by every focused stage.\n const focusableStages = stages.filter(stage => hasFocusKey(stage))\n\n // The active focus stage escapes the fan, so only the remaining focusable\n // stages contribute to its ordering and midpoint.\n const focusableBackgroundStages = focusableStages.filter(\n stage => stage.focusKey !== resolvedActiveFocusKey,\n )\n\n const backgroundMidpoint = (focusableBackgroundStages.length - 1) / 2\n const activeFocusIndex = Math.max(\n 0,\n focusableStages.findIndex(\n stage => stage.focusKey === resolvedActiveFocusKey,\n ),\n )\n\n return stages.map((stage) => {\n // Foreground stages intentionally resolve to -1 here. Their world state\n // ignores the background index while `escape` is true.\n const backgroundIndex = focusableBackgroundStages.findIndex(\n backgroundStage => backgroundStage.id === stage.id,\n )\n\n // Both persistent non-focusable content and the active focus stage stay\n // centered, elevated, and unmasked.\n const escape = isForegroundStage(\n stage.focusKey,\n resolvedActiveFocusKey,\n )\n const { world, zIndex, maskOpacity } = getStageWorldState({\n mode,\n backgroundIndex,\n backgroundMidpoint,\n activeFocusIndex,\n escape,\n })\n\n const resolvedBundleRoot = stage.bundleRoot ?? bundleRoot\n const extraGlobalProps = buildStageGlobalProps?.({\n stage,\n viewMode: mode,\n activeFocusKey: resolvedActiveFocusKey,\n focusKey: stage.focusKey,\n })\n\n return {\n ...stage,\n world,\n zIndex,\n maskOpacity,\n ...(resolvedBundleRoot === undefined ? {} : { resolvedBundleRoot }),\n ...(extraGlobalProps === undefined ? {} : { extraGlobalProps }),\n }\n })\n }, [bundleRoot, buildStageGlobalProps, layout, mode, resolvedActiveFocusKey])\n\n const mergedContainerStyle: CSSProperties = useMemo(() => {\n const gridStyle: CSSProperties | undefined = containerGrid && {\n display: 'grid',\n gridTemplateColumns: `repeat(${containerGrid.cols}, minmax(0, 1fr))`,\n gridTemplateRows: `repeat(${containerGrid.rows}, minmax(0, 1fr))`,\n alignItems: 'stretch',\n }\n return {\n ...BASE_STYLE,\n ...gridStyle,\n ...style,\n }\n }, [containerGrid, style])\n\n const resolvedThemeKey = themeKey ?? 'lunaris-dark'\n const resolvedThemeMode = inferThemeMode(resolvedThemeKey) ?? 'dark'\n\n const resolvedStageAppearance = useMemo(() => {\n const fallback = DEFAULT_STAGE_APPEARANCE_BY_MODE[resolvedThemeMode]\n const fromDefault = stageAppearance?.default\n const fromMode = stageAppearance?.[resolvedThemeMode]\n\n return {\n outlineColor: fromMode?.outlineColor ?? fromDefault?.outlineColor\n ?? fallback.outlineColor,\n maskColor: fromMode?.maskColor ?? fromDefault?.maskColor\n ?? fallback.maskColor,\n } as const\n }, [resolvedThemeMode, stageAppearance])\n\n const stageOutlineStyle: CSSProperties = useMemo(\n () => ({\n backgroundColor: resolvedStageAppearance.outlineColor,\n }),\n [resolvedStageAppearance.outlineColor],\n )\n\n const maskColor = resolvedStageAppearance.maskColor\n\n return (\n <div className={className} style={mergedContainerStyle}>\n <AnimatePresence mode='popLayout'>\n {rendered.map((stage) => {\n const stageRuntimeCallHandler = stageRuntimeCallHandlers.get(stage.id)\n\n return (\n <MotionStageContainer\n layoutId={stage.id}\n key={stage.id}\n className={stage.className}\n {...(containerInteractive\n ? stageContainerEventHandlers.get(stage.id)\n : undefined)}\n style={{\n ...stage.style,\n zIndex: stage.zIndex,\n pointerEvents: containerInteractive ? 'auto' : 'none',\n }}\n >\n <MotionPresentation\n variants={slidingVariants}\n initial='initial'\n animate='animate'\n exit='exit'\n transition={presentationTransition}\n >\n <MotionStage\n fitProgress={0}\n fitTransition={fitTransition}\n world={stage.world}\n focalLength={mode === 'focus' ? 500 : 0}\n style={stageOutlineStyle}\n contentInteractive={contentInteractive}\n maskColor={maskColor}\n maskOpacity={stage.maskOpacity}\n >\n <StudioLynxStage\n entry={stage.entry}\n lunaTheme={mode === 'compare'\n ? stage.theme\n : resolvedThemeKey}\n {...(stageRuntimeCallHandler === undefined\n ? {}\n : { onLynxRuntimeCall: stageRuntimeCallHandler })}\n {...(stage.resolvedBundleRoot === undefined\n ? {}\n : { bundleRoot: stage.resolvedBundleRoot })}\n {...(stage.extraGlobalProps === undefined\n ? {}\n : { extraGlobalProps: stage.extraGlobalProps })}\n />\n </MotionStage>\n </MotionPresentation>\n </MotionStageContainer>\n )\n })}\n </AnimatePresence>\n </div>\n )\n}\n\nexport { ChoreographyView }\n"],"names":["slidingVariants","presentationTransition","fitTransition","BASE_STYLE","DEFAULT_STAGE_APPEARANCE_BY_MODE","hasFocusKey","stage","undefined","createStageInteraction","containerEvent","createContentInteraction","call","ChoreographyView","layout","modeGrid","mode","defaultFocusKey","className","style","bundleRoot","resolveFocusKey","buildStageGlobalProps","themeKey","stageAppearance","interactionTarget","onLynxRuntimeCall","onInteraction","activeFocusKey","setActiveFocusKey","useState","containerInteractive","contentInteractive","containerGrid","resolveFocusKeyEvent","useEventCallback","onInteractionEvent","onLynxRuntimeCallEvent","dispatchInteractionEvent","interaction","nextActiveFocusKey","stageContainerEventHandlers","useMemo","handlers","Map","dispatch","e","stageRuntimeCallHandlers","resolvedActiveFocusKey","focusableStages","rendered","stages","focusableBackgroundStages","backgroundMidpoint","activeFocusIndex","Math","backgroundIndex","backgroundStage","escape","isForegroundStage","world","zIndex","maskOpacity","getStageWorldState","resolvedBundleRoot","extraGlobalProps","mergedContainerStyle","gridStyle","resolvedThemeKey","resolvedThemeMode","inferThemeMode","resolvedStageAppearance","fallback","fromDefault","fromMode","stageOutlineStyle","maskColor","AnimatePresence","stageRuntimeCallHandler","MotionStageContainer","MotionPresentation","MotionStage","StudioLynxStage"],"mappings":";;;;;;;;AA4CA,MAAMA,kBAAkB;IACtB,SAAS;QAAE,SAAS;QAAG,GAAG;IAAK;IAC/B,SAAS;QAAE,SAAS;QAAG,GAAG;IAAE;IAC5B,MAAM;QAAE,SAAS;QAAG,GAAG;IAAI;AAC7B;AAEA,MAAMC,yBAAqC;IACzC,MAAM;IACN,gBAAgB;IAChB,QAAQ;AACV;AAEA,MAAMC,gBAA+B;IAAE,gBAAgB;IAAK,QAAQ;AAAI;AAExE,MAAMC,aAA4B;IAChC,OAAO;IACP,QAAQ;IACR,eAAe;IACf,UAAU;AACZ;AAEA,MAAMC,mCAAmC;IACvC,OAAO;QACL,cAAc;QACd,WAAW;IACb;IACA,MAAM;QACJ,cAAc;QACd,WAAW;IACb;AACF;AAEA,SAASC,YACPC,KAA0B;IAE1B,OAAOA,AAAmBC,WAAnBD,MAAM,QAAQ;AACvB;AAEA,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,IACD;oCAAE,YAAYA,MAAM,kBAAkB;gCAAC,CAAC;gCAC3C,GAAIA,AAA2BC,WAA3BD,MAAM,gBAAgB,GACvB,CAAC,IACD;oCAAE,kBAAkBA,MAAM,gBAAgB;gCAAC,CAAC;;;;mBAzCjDA,MAAM,EAAE;YA+CnB;;;AAIR"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { ChoreographyProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Public choreography wrapper that provides a stable entry point over `ChoreographyView`.
|
|
5
|
+
* It adapts `viewMode` to the internal `mode` prop and scopes Motion layout
|
|
6
|
+
* coordination with a dedicated `LayoutGroup`.
|
|
7
|
+
*/
|
|
8
|
+
declare function Choreography({ viewMode, ...choreographyViewProps }: ChoreographyProps): JSX.Element;
|
|
9
|
+
export { Choreography };
|
|
10
|
+
//# sourceMappingURL=choreography.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choreography.d.ts","sourceRoot":"","sources":["../../src/choreography/choreography.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGhC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAEjD;;;;GAIG;AACH,iBAAS,YAAY,CAAC,EACpB,QAAoB,EACpB,GAAG,qBAAqB,EACzB,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAUjC;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { LayoutGroup } from "motion/react";
|
|
4
|
+
import { ChoreographyView } from "./choreography-view.js";
|
|
5
|
+
function Choreography({ viewMode = 'compare', ...choreographyViewProps }) {
|
|
6
|
+
return /*#__PURE__*/ jsx(LayoutGroup, {
|
|
7
|
+
id: "luna-studio",
|
|
8
|
+
children: /*#__PURE__*/ createElement(ChoreographyView, {
|
|
9
|
+
...choreographyViewProps,
|
|
10
|
+
mode: viewMode,
|
|
11
|
+
key: "luna-studio-choreography-view"
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export { Choreography };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=choreography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choreography/choreography.js","sources":["../../src/choreography/choreography.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { LayoutGroup } from 'motion/react'\nimport type { JSX } from 'react'\n\nimport { ChoreographyView } from './choreography-view'\nimport type { ChoreographyProps } from '../types'\n\n/**\n * Public choreography wrapper that provides a stable entry point over `ChoreographyView`.\n * It adapts `viewMode` to the internal `mode` prop and scopes Motion layout\n * coordination with a dedicated `LayoutGroup`.\n */\nfunction Choreography({\n viewMode = 'compare',\n ...choreographyViewProps\n}: ChoreographyProps): JSX.Element {\n return (\n <LayoutGroup id='luna-studio'>\n <ChoreographyView\n {...choreographyViewProps}\n mode={viewMode}\n key='luna-studio-choreography-view'\n />\n </LayoutGroup>\n )\n}\n\nexport { Choreography }\n"],"names":["Choreography","viewMode","choreographyViewProps","LayoutGroup","ChoreographyView"],"mappings":";;;;AAeA,SAASA,aAAa,EACpBC,WAAW,SAAS,EACpB,GAAGC,uBACe;IAClB,OAAO,WAAP,GACE,IAACC,aAAWA;QAAC,IAAG;kBACd,4BAACC,kBAAgBA;YACd,GAAGF,qBAAqB;YACzB,MAAMD;YACN,KAAI;;;AAIZ"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Choreography } from './choreography';
|
|
2
|
+
export type { ChoreographyBaseProps, ChoreographyInteractionProps, ChoreographyProps, ChoreographyViewProps, FocusKeyResolver, InteractionParams, InteractionTarget, StageAppearance, } from '../types';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/choreography/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EACV,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Choreography } from "./choreography.js";
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { LunaThemeKey, LunaThemeMode, LunaThemeVariant, ResolveStudioLayoutParams, StageGlobalPropsBuilder, StudioGridSpec, StudioLayout, StudioResolvedLayout, StudioModeGrid, StudioResolvedStage, StudioStageSlice, StudioStage, StudioViewMode, } from './types';
|
|
2
|
+
export { indexResolvedLayout, resolveStudioLayout } from './types/studio';
|
|
3
|
+
export { getPayloadString } from './types/choreography';
|
|
4
|
+
export { Choreography } from './choreography';
|
|
5
|
+
export type { ChoreographyBaseProps, ChoreographyInteractionProps, ChoreographyProps, ChoreographyViewProps, FocusKeyResolver, InteractionParams, InteractionTarget, StageAppearance, } from './choreography';
|
|
6
|
+
export type { LynxRuntimeCall } from './lynx-stage';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,yBAAyB,EACzB,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,GACf,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EACV,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,gBAAgB,CAAA;AAGvB,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lynx-stage/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StudioLynxStage } from "./studio-lynx-stage.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { StudioLynxStageProps } from '../types';
|
|
3
|
+
declare function StudioLynxStage({ entry, onLynxRuntimeCall, extraGlobalProps, ...restProps }: StudioLynxStageProps): JSX.Element;
|
|
4
|
+
export { StudioLynxStage };
|
|
5
|
+
//# sourceMappingURL=studio-lynx-stage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studio-lynx-stage.d.ts","sourceRoot":"","sources":["../../src/lynx-stage/studio-lynx-stage.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAIpD,iBAAS,eAAe,CAAC,EACvB,KAAK,EACL,iBAAiB,EACjB,gBAAgB,EAChB,GAAG,SAAS,EACb,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,CA0BpC;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { LunaLynxStage } from "@lynx-js/luna-stage/lynx";
|
|
3
|
+
import { useCallback, useMemo } from "react";
|
|
4
|
+
function StudioLynxStage({ entry, onLynxRuntimeCall, extraGlobalProps, ...restProps }) {
|
|
5
|
+
const mergedGlobalProps = useMemo(()=>extraGlobalProps ?? {}, [
|
|
6
|
+
extraGlobalProps
|
|
7
|
+
]);
|
|
8
|
+
const handleNativeModulesCall = useCallback((name, data, channel)=>onLynxRuntimeCall?.({
|
|
9
|
+
entry,
|
|
10
|
+
channel,
|
|
11
|
+
name,
|
|
12
|
+
data
|
|
13
|
+
}), [
|
|
14
|
+
entry,
|
|
15
|
+
onLynxRuntimeCall
|
|
16
|
+
]);
|
|
17
|
+
return /*#__PURE__*/ jsx(LunaLynxStage, {
|
|
18
|
+
...restProps,
|
|
19
|
+
entry: entry,
|
|
20
|
+
extraGlobalProps: mergedGlobalProps,
|
|
21
|
+
onNativeModulesCall: handleNativeModulesCall
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export { StudioLynxStage };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=studio-lynx-stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lynx-stage/studio-lynx-stage.js","sources":["../../src/lynx-stage/studio-lynx-stage.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { LunaLynxStage } from '@lynx-js/luna-stage/lynx'\nimport { useCallback, useMemo } from 'react'\nimport type { JSX } from 'react'\n\nimport type { StudioLynxStageProps } from '../types'\n\ntype LynxStageGlobalProps = Record<string, unknown>\n\nfunction StudioLynxStage({\n entry,\n onLynxRuntimeCall,\n extraGlobalProps,\n ...restProps\n}: StudioLynxStageProps): JSX.Element {\n const mergedGlobalProps = useMemo<LynxStageGlobalProps>(() => (\n extraGlobalProps ?? {}\n ), [extraGlobalProps])\n\n const handleNativeModulesCall = useCallback((\n name: string,\n data: unknown,\n channel: string,\n ) => {\n return onLynxRuntimeCall?.({\n entry,\n channel,\n name,\n data,\n })\n }, [entry, onLynxRuntimeCall])\n\n return (\n <LunaLynxStage\n {...restProps}\n entry={entry}\n extraGlobalProps={mergedGlobalProps}\n onNativeModulesCall={handleNativeModulesCall}\n />\n )\n}\n\nexport { StudioLynxStage }\n"],"names":["StudioLynxStage","entry","onLynxRuntimeCall","extraGlobalProps","restProps","mergedGlobalProps","useMemo","handleNativeModulesCall","useCallback","name","data","channel","LunaLynxStage"],"mappings":";;;AAYA,SAASA,gBAAgB,EACvBC,KAAK,EACLC,iBAAiB,EACjBC,gBAAgB,EAChB,GAAGC,WACkB;IACrB,MAAMC,oBAAoBC,QAA8B,IACtDH,oBAAoB,CAAC,GACpB;QAACA;KAAiB;IAErB,MAAMI,0BAA0BC,YAAY,CAC1CC,MACAC,MACAC,UAEOT,oBAAoB;YACzBD;YACAU;YACAF;YACAC;QACF,IACC;QAACT;QAAOC;KAAkB;IAE7B,OAAO,WAAP,GACE,IAACU,eAAaA;QACX,GAAGR,SAAS;QACb,OAAOH;QACP,kBAAkBI;QAClB,qBAAqBE;;AAG3B"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { LynxRuntimeCall } from './lynx-stage';
|
|
3
|
+
import type { LunaThemeKey, LunaThemeMode, StageGlobalPropsBuilder, StudioModeGrid, StudioResolvedLayout, StudioViewMode } from './studio';
|
|
4
|
+
import type { Prettify } from './utils';
|
|
5
|
+
export type InteractionTarget = 'stage' | 'content';
|
|
6
|
+
interface BaseInteractionParams {
|
|
7
|
+
/** Stage instance identity used by the choreography layer to correlate interactions. */
|
|
8
|
+
stageId: string;
|
|
9
|
+
/** Lynx entry rendered inside the stage associated with this interaction. */
|
|
10
|
+
entry: string;
|
|
11
|
+
/** Optional app-defined payload forwarded from the interaction source. */
|
|
12
|
+
payload?: unknown;
|
|
13
|
+
}
|
|
14
|
+
type StageInteractionParams = BaseInteractionParams & {
|
|
15
|
+
/**
|
|
16
|
+
* Interaction is attributed to the host-side stage layer.
|
|
17
|
+
* The original browser event payload is exposed separately as `containerEvent`.
|
|
18
|
+
*/
|
|
19
|
+
target: 'stage';
|
|
20
|
+
/**
|
|
21
|
+
* Original browser event captured from the stage container.
|
|
22
|
+
* Currently this is sourced from the host-side `onClick`, `onPointerCancel`,
|
|
23
|
+
* `onPointerDown`, and `onPointerUp` handlers; inspect `containerEvent.type`
|
|
24
|
+
* for the concrete event kind.
|
|
25
|
+
*/
|
|
26
|
+
containerEvent: MouseEvent | PointerEvent;
|
|
27
|
+
};
|
|
28
|
+
type ContentInteractionParams = BaseInteractionParams & {
|
|
29
|
+
/** Interaction originated from the embedded Lynx content layer. */
|
|
30
|
+
target: 'content';
|
|
31
|
+
/**
|
|
32
|
+
* Original runtime callback emitted from the embedded Lynx content.
|
|
33
|
+
* Currently this is sourced from `onNativeModulesCall`; inspect
|
|
34
|
+
* `runtimeCall.name` for the concrete content-side interaction kind.
|
|
35
|
+
*/
|
|
36
|
+
runtimeCall: LynxRuntimeCall;
|
|
37
|
+
};
|
|
38
|
+
export type InteractionParams = StageInteractionParams | ContentInteractionParams;
|
|
39
|
+
export type FocusKeyResolver = (interaction: InteractionParams) => string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Visual appearance of the host-side stage chrome (outline + mask).
|
|
42
|
+
* These values are forwarded to the underlying MotionStage props.
|
|
43
|
+
*/
|
|
44
|
+
export interface StageAppearance {
|
|
45
|
+
/** Color of the overlay mask above the device frame. */
|
|
46
|
+
maskColor?: string;
|
|
47
|
+
/** Color of the visible device outline (implemented as outline-layer background). */
|
|
48
|
+
outlineColor?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ChoreographyBaseProps {
|
|
51
|
+
/** Optional class name applied to the outer choreography container. */
|
|
52
|
+
className?: string;
|
|
53
|
+
/** Optional inline style merged onto the outer choreography container. */
|
|
54
|
+
style?: CSSProperties;
|
|
55
|
+
/**
|
|
56
|
+
* Optional host-level default resource root used when a stage does not define
|
|
57
|
+
* its own `bundleRoot`.
|
|
58
|
+
*/
|
|
59
|
+
bundleRoot?: string;
|
|
60
|
+
/** Fully resolved stage layout used by the choreography layer. */
|
|
61
|
+
layout: StudioResolvedLayout;
|
|
62
|
+
/** Optional grid config that drives the container layout for each mode. */
|
|
63
|
+
modeGrid?: StudioModeGrid;
|
|
64
|
+
/** Optional initial focus key used when no runtime selection has been made yet. */
|
|
65
|
+
defaultFocusKey?: string;
|
|
66
|
+
/** Optional builder for app-specific Lynx global props derived from stage + focus state. */
|
|
67
|
+
buildStageGlobalProps?: StageGlobalPropsBuilder;
|
|
68
|
+
/** Shared theme key applied to all stages in focus/lineup modes. */
|
|
69
|
+
themeKey?: LunaThemeKey;
|
|
70
|
+
/** Per-theme-mode stage chrome configuration (falls back to built-in defaults). */
|
|
71
|
+
stageAppearance?: Partial<Record<LunaThemeMode, StageAppearance>> & {
|
|
72
|
+
/** Fallback appearance used when the current theme mode is not configured. */
|
|
73
|
+
default?: StageAppearance;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export interface ChoreographyInteractionProps {
|
|
77
|
+
/** Optional resolver that maps a generic interaction to a choreography focus key. */
|
|
78
|
+
resolveFocusKey?: FocusKeyResolver;
|
|
79
|
+
/** Chooses whether pointer interaction is handled by stage container or embedded content. */
|
|
80
|
+
interactionTarget?: InteractionTarget;
|
|
81
|
+
/**
|
|
82
|
+
* Receives normalized stage/content interaction events.
|
|
83
|
+
* This is the primary high-level callback for choreography consumers: when
|
|
84
|
+
* `interaction.target === 'stage'`, the payload includes `containerEvent`;
|
|
85
|
+
* when `interaction.target === 'content'`, it includes `runtimeCall`.
|
|
86
|
+
*/
|
|
87
|
+
onInteraction?: (interaction: InteractionParams) => unknown;
|
|
88
|
+
/**
|
|
89
|
+
* Receives raw runtime calls emitted from the embedded Lynx content.
|
|
90
|
+
* This is a lower-level escape hatch for consumers that need to inspect or
|
|
91
|
+
* handle the original Lynx bridge callback directly, rather than the
|
|
92
|
+
* normalized `onInteraction` abstraction.
|
|
93
|
+
*/
|
|
94
|
+
onLynxRuntimeCall?: (call: LynxRuntimeCall) => unknown;
|
|
95
|
+
}
|
|
96
|
+
export type ChoreographyViewProps = ChoreographyBaseProps & ChoreographyInteractionProps & {
|
|
97
|
+
/** Active mode selecting which layout slice to render. */
|
|
98
|
+
mode?: StudioViewMode;
|
|
99
|
+
};
|
|
100
|
+
export type ChoreographyProps = Prettify<Omit<ChoreographyViewProps, 'mode'> & {
|
|
101
|
+
/** Active presentation mode for the current choreography render. */
|
|
102
|
+
viewMode?: StudioViewMode;
|
|
103
|
+
}>;
|
|
104
|
+
export declare function getPayloadString(data: unknown, field?: string): string | undefined;
|
|
105
|
+
export {};
|
|
106
|
+
//# sourceMappingURL=choreography.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choreography.d.ts","sourceRoot":"","sources":["../../src/types/choreography.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,uBAAuB,EACvB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACf,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,SAAS,CAAA;AAEnD,UAAU,qBAAqB;IAC7B,wFAAwF;IACxF,OAAO,EAAE,MAAM,CAA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G;QAClE,8EAA8E;QAC9E,OAAO,CAAC,EAAE,eAAe,CAAA;KAC1B,CAAA;CACF;AAED,MAAM,WAAW,4BAA4B;IAC3C,qFAAqF;IACrF,eAAe,CAAC,EAAE,gBAAgB,CAAA;IAClC,6FAA6F;IAC7F,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,iBAAiB,KAAK,OAAO,CAAA;IAC3D;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAA;CACvD;AAED,MAAM,MAAM,qBAAqB,GAC7B,qBAAqB,GACrB,4BAA4B,GAC5B;IACA,0DAA0D;IAC1D,IAAI,CAAC,EAAE,cAAc,CAAA;CACtB,CAAA;AAEH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CACpC,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GACnC;IACA,oEAAoE;IACpE,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B,CACF,CAAA;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,OAAO,EACb,KAAK,SAAO,GACX,MAAM,GAAG,SAAS,CAMpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function getPayloadString(data, field = 'id') {
|
|
2
|
+
if ('string' == typeof data) return data;
|
|
3
|
+
if (null === data || 'object' != typeof data) return;
|
|
4
|
+
const value = data[field];
|
|
5
|
+
return 'string' == typeof value ? value : void 0;
|
|
6
|
+
}
|
|
7
|
+
export { getPayloadString };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=choreography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types/choreography.js","sources":["../../src/types/choreography.ts"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type { CSSProperties } from 'react'\n\nimport type { LynxRuntimeCall } from './lynx-stage'\nimport type {\n LunaThemeKey,\n LunaThemeMode,\n StageGlobalPropsBuilder,\n StudioModeGrid,\n StudioResolvedLayout,\n StudioViewMode,\n} from './studio'\nimport type { Prettify } from './utils'\n\nexport type InteractionTarget = 'stage' | 'content'\n\ninterface BaseInteractionParams {\n /** Stage instance identity used by the choreography layer to correlate interactions. */\n stageId: string\n /** Lynx entry rendered inside the stage associated with this interaction. */\n entry: string\n /** Optional app-defined payload forwarded from the interaction source. */\n payload?: unknown\n}\n\ntype StageInteractionParams = BaseInteractionParams & {\n /**\n * Interaction is attributed to the host-side stage layer.\n * The original browser event payload is exposed separately as `containerEvent`.\n */\n target: 'stage'\n /**\n * Original browser event captured from the stage container.\n * Currently this is sourced from the host-side `onClick`, `onPointerCancel`,\n * `onPointerDown`, and `onPointerUp` handlers; inspect `containerEvent.type`\n * for the concrete event kind.\n */\n containerEvent: MouseEvent | PointerEvent\n}\n\ntype ContentInteractionParams = BaseInteractionParams & {\n /** Interaction originated from the embedded Lynx content layer. */\n target: 'content'\n /**\n * Original runtime callback emitted from the embedded Lynx content.\n * Currently this is sourced from `onNativeModulesCall`; inspect\n * `runtimeCall.name` for the concrete content-side interaction kind.\n */\n runtimeCall: LynxRuntimeCall\n}\n\nexport type InteractionParams =\n | StageInteractionParams\n | ContentInteractionParams\n\nexport type FocusKeyResolver = (\n interaction: InteractionParams,\n) => string | undefined\n\n/**\n * Visual appearance of the host-side stage chrome (outline + mask).\n * These values are forwarded to the underlying MotionStage props.\n */\nexport interface StageAppearance {\n /** Color of the overlay mask above the device frame. */\n maskColor?: string\n /** Color of the visible device outline (implemented as outline-layer background). */\n outlineColor?: string\n}\n\nexport interface ChoreographyBaseProps {\n /** Optional class name applied to the outer choreography container. */\n className?: string\n /** Optional inline style merged onto the outer choreography container. */\n style?: CSSProperties\n /**\n * Optional host-level default resource root used when a stage does not define\n * its own `bundleRoot`.\n */\n bundleRoot?: string\n /** Fully resolved stage layout used by the choreography layer. */\n layout: StudioResolvedLayout\n /** Optional grid config that drives the container layout for each mode. */\n modeGrid?: StudioModeGrid\n /** Optional initial focus key used when no runtime selection has been made yet. */\n defaultFocusKey?: string\n /** Optional builder for app-specific Lynx global props derived from stage + focus state. */\n buildStageGlobalProps?: StageGlobalPropsBuilder\n /** Shared theme key applied to all stages in focus/lineup modes. */\n themeKey?: LunaThemeKey\n /** Per-theme-mode stage chrome configuration (falls back to built-in defaults). */\n stageAppearance?: Partial<Record<LunaThemeMode, StageAppearance>> & {\n /** Fallback appearance used when the current theme mode is not configured. */\n default?: StageAppearance\n }\n}\n\nexport interface ChoreographyInteractionProps {\n /** Optional resolver that maps a generic interaction to a choreography focus key. */\n resolveFocusKey?: FocusKeyResolver\n /** Chooses whether pointer interaction is handled by stage container or embedded content. */\n interactionTarget?: InteractionTarget\n /**\n * Receives normalized stage/content interaction events.\n * This is the primary high-level callback for choreography consumers: when\n * `interaction.target === 'stage'`, the payload includes `containerEvent`;\n * when `interaction.target === 'content'`, it includes `runtimeCall`.\n */\n onInteraction?: (interaction: InteractionParams) => unknown\n /**\n * Receives raw runtime calls emitted from the embedded Lynx content.\n * This is a lower-level escape hatch for consumers that need to inspect or\n * handle the original Lynx bridge callback directly, rather than the\n * normalized `onInteraction` abstraction.\n */\n onLynxRuntimeCall?: (call: LynxRuntimeCall) => unknown\n}\n\nexport type ChoreographyViewProps =\n & ChoreographyBaseProps\n & ChoreographyInteractionProps\n & {\n /** Active mode selecting which layout slice to render. */\n mode?: StudioViewMode\n }\n\nexport type ChoreographyProps = Prettify<\n & Omit<ChoreographyViewProps, 'mode'>\n & {\n /** Active presentation mode for the current choreography render. */\n viewMode?: StudioViewMode\n }\n>\n\nexport function getPayloadString(\n data: unknown,\n field = 'id',\n): string | undefined {\n if (typeof data === 'string') return data\n if (data === null || typeof data !== 'object') return undefined\n\n const value = (data as Record<string, unknown>)[field]\n return typeof value === 'string' ? value : undefined\n}\n"],"names":["getPayloadString","data","field","value","undefined"],"mappings":"AAyIO,SAASA,iBACdC,IAAa,EACbC,QAAQ,IAAI;IAEZ,IAAI,AAAgB,YAAhB,OAAOD,MAAmB,OAAOA;IACrC,IAAIA,AAAS,SAATA,QAAiB,AAAgB,YAAhB,OAAOA,MAAmB;IAE/C,MAAME,QAASF,IAAgC,CAACC,MAAM;IACtD,OAAO,AAAiB,YAAjB,OAAOC,QAAqBA,QAAQC;AAC7C"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { ChoreographyBaseProps, ChoreographyInteractionProps, ChoreographyProps, ChoreographyViewProps, FocusKeyResolver, InteractionParams, InteractionTarget, StageAppearance, } from './choreography';
|
|
2
|
+
export type { LynxRuntimeCall, StudioLynxStageProps } from './lynx-stage';
|
|
3
|
+
export type { LunaThemeKey, LunaThemeMode, LunaThemeVariant, ResolveStudioLayoutParams, StageGlobalPropsBuilder, StudioGridSpec, StudioLayout, StudioResolvedLayout, StudioModeGrid, StudioResolvedStage, StudioStageSlice, StudioStage, StudioViewMode, } from './studio';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAIA,YAAY,EACV,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACzE,YAAY,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,yBAAyB,EACzB,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,GACf,MAAM,UAAU,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { LunaLynxStageProps } from '@lynx-js/luna-stage/lynx';
|
|
2
|
+
import type { Prettify } from './utils';
|
|
3
|
+
/**
|
|
4
|
+
* Generic runtime callback payload emitted from Lynx back into the host Web app.
|
|
5
|
+
*/
|
|
6
|
+
export interface LynxRuntimeCall {
|
|
7
|
+
/** Lynx bundle entry that emitted the runtime call. */
|
|
8
|
+
entry: string;
|
|
9
|
+
/** Runtime channel name, derived from the low-level native-module source. */
|
|
10
|
+
channel: string;
|
|
11
|
+
/** Runtime event name within the channel. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Opaque payload forwarded from the Lynx runtime. */
|
|
14
|
+
data: unknown;
|
|
15
|
+
}
|
|
16
|
+
export type StudioLynxStageProps = Prettify<Omit<LunaLynxStageProps, 'onNativeModulesCall'> & {
|
|
17
|
+
/** Receives runtime calls emitted from the embedded Lynx content. */
|
|
18
|
+
onLynxRuntimeCall?: (call: LynxRuntimeCall) => unknown;
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=lynx-stage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lynx-stage.d.ts","sourceRoot":"","sources":["../../src/types/lynx-stage.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAA;IACb,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAA;IACf,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAA;IACZ,sDAAsD;IACtD,IAAI,EAAE,OAAO,CAAA;CACd;AAED,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CACvC,IAAI,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAC/C;IACA,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAA;CACvD,CACF,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { LunaThemeKey, LunaThemeMode, LunaThemeVariant } from '@lynx-js/luna-core';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
3
|
+
import type { Prettify } from './utils';
|
|
4
|
+
export type { LunaThemeKey, LunaThemeMode, LunaThemeVariant };
|
|
5
|
+
/**
|
|
6
|
+
* Built-in studio presentation modes.
|
|
7
|
+
* `compare` allows each stage to render with its own theme for side-by-side comparison,
|
|
8
|
+
* `focus` renders all stages under a single shared theme and applies 3D focal emphasis,
|
|
9
|
+
* while `lineup` renders all stages under a single shared theme without that focus treatment.
|
|
10
|
+
*/
|
|
11
|
+
export type StudioViewMode = 'compare' | 'focus' | 'lineup';
|
|
12
|
+
export interface StudioGridSpec {
|
|
13
|
+
cols: number;
|
|
14
|
+
rows: number;
|
|
15
|
+
}
|
|
16
|
+
export interface StudioStage {
|
|
17
|
+
/** Stable stage identifier used for pool lookup, layout references, and event correlation. */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Lynx bundle entry rendered by this stage. */
|
|
20
|
+
entry: string;
|
|
21
|
+
/**
|
|
22
|
+
* Optional resource root used together with `entry` to locate the Lynx bundle.
|
|
23
|
+
* When omitted, `Choreography` may provide a host-level fallback via `bundleRoot`.
|
|
24
|
+
*/
|
|
25
|
+
bundleRoot?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Stage-scoped theme key used when the active presentation mode allows
|
|
28
|
+
* per-stage theming.
|
|
29
|
+
*/
|
|
30
|
+
theme: LunaThemeKey;
|
|
31
|
+
/** Optional stage-level focus key used by choreography focus ordering and selection. */
|
|
32
|
+
focusKey?: string;
|
|
33
|
+
}
|
|
34
|
+
export type StudioResolvedStage = Prettify<StudioStage & {
|
|
35
|
+
/** Optional layout className applied to the stage container. */
|
|
36
|
+
className?: string;
|
|
37
|
+
/** Optional inline layout style applied to the stage container. */
|
|
38
|
+
style?: CSSProperties;
|
|
39
|
+
}>;
|
|
40
|
+
/** Layout data for the three built-in studio presentation modes. */
|
|
41
|
+
export type StudioResolvedLayout = Record<StudioViewMode, StudioResolvedStage[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Stage slice in an authoring `StudioLayout`.
|
|
44
|
+
*
|
|
45
|
+
* This type intentionally excludes resource-locator fields such as `entry` and `bundleRoot`.
|
|
46
|
+
* Instead, it references a pool stage by `id` and provides per-mode overrides like
|
|
47
|
+
* `className/style` and optional semantic overrides like `theme/focusKey`.
|
|
48
|
+
*
|
|
49
|
+
* Slice ids must be unique within a single view mode. The resolved `stage.id` is used
|
|
50
|
+
* as the render identity (React key, Motion layout id, and emitted `interaction.stageId`).
|
|
51
|
+
*/
|
|
52
|
+
export type StudioStageSlice = Prettify<Pick<StudioResolvedStage, 'id' | 'className' | 'style' | 'focusKey'> & Partial<Pick<StudioResolvedStage, 'theme'>>>;
|
|
53
|
+
/**
|
|
54
|
+
* Authoring layout specification keyed by `StudioViewMode`.
|
|
55
|
+
* Each mode contains an ordered list of `StudioStageSlice` items.
|
|
56
|
+
*/
|
|
57
|
+
export type StudioLayout = Record<StudioViewMode, StudioStageSlice[]>;
|
|
58
|
+
export interface ResolveStudioLayoutParams {
|
|
59
|
+
/**
|
|
60
|
+
* Resource pool keyed by stage id. Each pool item defines the stage's
|
|
61
|
+
* resource locator (`entry`, optional `bundleRoot`) and its default semantics
|
|
62
|
+
* (`theme`, optional `focusKey`).
|
|
63
|
+
*/
|
|
64
|
+
stagePool: Record<string, StudioStage>;
|
|
65
|
+
/**
|
|
66
|
+
* Layout specification keyed by view mode. Each item references a pool entry
|
|
67
|
+
* by `id` and carries host-side projection overrides (e.g. `style`, `className`).
|
|
68
|
+
*/
|
|
69
|
+
layoutSpec: StudioLayout;
|
|
70
|
+
/**
|
|
71
|
+
* Optional host-level default bundle root used when a stage pool item does not
|
|
72
|
+
* define its own `bundleRoot`.
|
|
73
|
+
*/
|
|
74
|
+
bundleRoot?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Resolves an authoring layout specification into a fully render-ready layout for `Choreography`.
|
|
78
|
+
*
|
|
79
|
+
* This helper merges three layers of data:
|
|
80
|
+
* - `stagePool` provides the resource locator (`entry`, optional `bundleRoot`) and stage defaults.
|
|
81
|
+
* - `layoutSpec` provides per-mode stage ordering and host-side overrides (`className`, `style`, etc.).
|
|
82
|
+
* - `bundleRoot` provides an optional host-level fallback when a pool stage does not define one.
|
|
83
|
+
*
|
|
84
|
+
* Resolution rules:
|
|
85
|
+
* - `entry`: pool-only
|
|
86
|
+
* - `bundleRoot`: `pool.bundleRoot ?? params.bundleRoot ?? undefined`
|
|
87
|
+
* - `theme`: `slice.theme ?? pool.theme`
|
|
88
|
+
* - `focusKey`: `slice.focusKey ?? pool.focusKey`
|
|
89
|
+
* - `className/style`: slice-only
|
|
90
|
+
*
|
|
91
|
+
* `layoutSpec` must not contain duplicate slice ids within the same view mode.
|
|
92
|
+
* This is required because the resolved `stage.id` is used as the stable identity
|
|
93
|
+
* for React keys, Motion layout ids, and emitted `interaction.stageId`.
|
|
94
|
+
*
|
|
95
|
+
* Throws if any `layoutSpec` item references a stage id that is missing from `stagePool`.
|
|
96
|
+
*/
|
|
97
|
+
export declare function resolveStudioLayout(params: ResolveStudioLayoutParams): StudioResolvedLayout;
|
|
98
|
+
export declare function indexResolvedLayout(layout: StudioResolvedLayout): {
|
|
99
|
+
focusKeys: Set<string>;
|
|
100
|
+
stageIdToFocusKey: Map<string, string>;
|
|
101
|
+
};
|
|
102
|
+
/** Optional mode-to-grid mapping used by grid-driven choreography containers. */
|
|
103
|
+
export type StudioModeGrid = Record<StudioViewMode, StudioGridSpec>;
|
|
104
|
+
/** Optional builder that derives Lynx global props for a stage render. */
|
|
105
|
+
export type StageGlobalPropsBuilder = (params: {
|
|
106
|
+
/** Current stage being rendered. */
|
|
107
|
+
stage: StudioResolvedStage;
|
|
108
|
+
/** Active studio presentation mode. */
|
|
109
|
+
viewMode: StudioViewMode;
|
|
110
|
+
/** Resolved active focus key for the current choreography state. */
|
|
111
|
+
activeFocusKey: string;
|
|
112
|
+
/** Stage-level focus key associated with `stage`, if any. */
|
|
113
|
+
focusKey: string | undefined;
|
|
114
|
+
}) => Record<string, unknown> | undefined;
|
|
115
|
+
//# sourceMappingURL=studio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../src/types/studio.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EACjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAA;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAA;AAE3D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,8FAA8F;IAC9F,EAAE,EAAE,MAAM,CAAA;IACV,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,KAAK,EAAE,YAAY,CAAA;IACnB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CACxC,WAAW,GAAG;IACZ,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,CACF,CAAA;AAED,oEAAoE;AACpE,MA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M,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
function resolveStudioLayout(params) {
|
|
2
|
+
const { stagePool, layoutSpec, bundleRoot } = params;
|
|
3
|
+
const resolveSlice = (slice)=>{
|
|
4
|
+
const pool = stagePool[slice.id];
|
|
5
|
+
if (!pool) throw new Error(`Missing stagePool item for id: ${slice.id}`);
|
|
6
|
+
const resolved = {
|
|
7
|
+
id: slice.id,
|
|
8
|
+
entry: pool.entry,
|
|
9
|
+
theme: slice.theme ?? pool.theme
|
|
10
|
+
};
|
|
11
|
+
const resolvedBundleRoot = pool.bundleRoot ?? bundleRoot;
|
|
12
|
+
if (void 0 !== resolvedBundleRoot) resolved.bundleRoot = resolvedBundleRoot;
|
|
13
|
+
const resolvedFocusKey = slice.focusKey ?? pool.focusKey;
|
|
14
|
+
if (void 0 !== resolvedFocusKey) resolved.focusKey = resolvedFocusKey;
|
|
15
|
+
if (void 0 !== slice.className) resolved.className = slice.className;
|
|
16
|
+
if (void 0 !== slice.style) resolved.style = slice.style;
|
|
17
|
+
return resolved;
|
|
18
|
+
};
|
|
19
|
+
const MODES = [
|
|
20
|
+
'compare',
|
|
21
|
+
'focus',
|
|
22
|
+
'lineup'
|
|
23
|
+
];
|
|
24
|
+
for (const mode of MODES){
|
|
25
|
+
const slices = layoutSpec[mode];
|
|
26
|
+
if (void 0 === slices) throw new Error(`Missing StudioLayout mode: ${mode}`);
|
|
27
|
+
const seen = new Set();
|
|
28
|
+
for (const slice of slices){
|
|
29
|
+
if (seen.has(slice.id)) throw new Error(`Duplicate StudioStageSlice.id in mode "${mode}": ${slice.id}. Each mode must use unique stage ids because stage.id is the render identity. To render the same entry multiple times, define multiple pool stages with different ids.`);
|
|
30
|
+
seen.add(slice.id);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const resolved = {};
|
|
34
|
+
for (const mode of MODES)resolved[mode] = layoutSpec[mode].map((slice)=>resolveSlice(slice));
|
|
35
|
+
return resolved;
|
|
36
|
+
}
|
|
37
|
+
function indexResolvedLayout(layout) {
|
|
38
|
+
const focusKeys = new Set();
|
|
39
|
+
const stageIdToFocusKey = new Map();
|
|
40
|
+
const focusKeyToStageId = new Map();
|
|
41
|
+
const modes = Object.keys(layout);
|
|
42
|
+
for (const mode of modes)for (const stage of layout[mode]){
|
|
43
|
+
const focusKey = stage.focusKey;
|
|
44
|
+
if (void 0 === focusKey) continue;
|
|
45
|
+
const focusKeyOwner = focusKeyToStageId.get(focusKey);
|
|
46
|
+
if (void 0 !== focusKeyOwner && focusKeyOwner !== stage.id) throw new Error(`Duplicate focusKey "${focusKey}" found for stages "${focusKeyOwner}" and "${stage.id}".`);
|
|
47
|
+
focusKeyToStageId.set(focusKey, stage.id);
|
|
48
|
+
focusKeys.add(focusKey);
|
|
49
|
+
const prevFocusKey = stageIdToFocusKey.get(stage.id);
|
|
50
|
+
if (void 0 !== prevFocusKey && prevFocusKey !== focusKey) throw new Error(`Conflicting focusKey for stage "${stage.id}": "${prevFocusKey}" vs "${focusKey}".`);
|
|
51
|
+
stageIdToFocusKey.set(stage.id, focusKey);
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
focusKeys,
|
|
55
|
+
stageIdToFocusKey
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export { indexResolvedLayout, resolveStudioLayout };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=studio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types/studio.js","sources":["../../src/types/studio.ts"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type {\n LunaThemeKey,\n LunaThemeMode,\n LunaThemeVariant,\n} from '@lynx-js/luna-core'\nimport type { CSSProperties } from 'react'\n\nimport type { Prettify } from './utils'\n\nexport type { LunaThemeKey, LunaThemeMode, LunaThemeVariant }\n\n/**\n * Built-in studio presentation modes.\n * `compare` allows each stage to render with its own theme for side-by-side comparison,\n * `focus` renders all stages under a single shared theme and applies 3D focal emphasis,\n * while `lineup` renders all stages under a single shared theme without that focus treatment.\n */\nexport type StudioViewMode = 'compare' | 'focus' | 'lineup'\n\nexport interface StudioGridSpec {\n cols: number\n rows: number\n}\n\nexport interface StudioStage {\n /** Stable stage identifier used for pool lookup, layout references, and event correlation. */\n id: string\n /** Lynx bundle entry rendered by this stage. */\n entry: string\n /**\n * Optional resource root used together with `entry` to locate the Lynx bundle.\n * When omitted, `Choreography` may provide a host-level fallback via `bundleRoot`.\n */\n bundleRoot?: string\n /**\n * Stage-scoped theme key used when the active presentation mode allows\n * per-stage theming.\n */\n theme: LunaThemeKey\n /** Optional stage-level focus key used by choreography focus ordering and selection. */\n focusKey?: string\n}\n\nexport type StudioResolvedStage = Prettify<\n StudioStage & {\n /** Optional layout className applied to the stage container. */\n className?: string\n /** Optional inline layout style applied to the stage container. */\n style?: CSSProperties\n }\n>\n\n/** Layout data for the three built-in studio presentation modes. */\nexport type StudioResolvedLayout = Record<\n StudioViewMode,\n StudioResolvedStage[]\n>\n\n/**\n * Stage slice in an authoring `StudioLayout`.\n *\n * This type intentionally excludes resource-locator fields such as `entry` and `bundleRoot`.\n * Instead, it references a pool stage by `id` and provides per-mode overrides like\n * `className/style` and optional semantic overrides like `theme/focusKey`.\n *\n * Slice ids must be unique within a single view mode. The resolved `stage.id` is used\n * as the render identity (React key, Motion layout id, and emitted `interaction.stageId`).\n */\nexport type StudioStageSlice = Prettify<\n & Pick<StudioResolvedStage, 'id' | 'className' | 'style' | 'focusKey'>\n & Partial<Pick<StudioResolvedStage, 'theme'>>\n>\n\n/**\n * Authoring layout specification keyed by `StudioViewMode`.\n * Each mode contains an ordered list of `StudioStageSlice` items.\n */\nexport type StudioLayout = Record<StudioViewMode, StudioStageSlice[]>\n\nexport interface ResolveStudioLayoutParams {\n /**\n * Resource pool keyed by stage id. Each pool item defines the stage's\n * resource locator (`entry`, optional `bundleRoot`) and its default semantics\n * (`theme`, optional `focusKey`).\n */\n stagePool: Record<string, StudioStage>\n /**\n * Layout specification keyed by view mode. Each item references a pool entry\n * by `id` and carries host-side projection overrides (e.g. `style`, `className`).\n */\n layoutSpec: StudioLayout\n /**\n * Optional host-level default bundle root used when a stage pool item does not\n * define its own `bundleRoot`.\n */\n bundleRoot?: string\n}\n\n/**\n * Resolves an authoring layout specification into a fully render-ready layout for `Choreography`.\n *\n * This helper merges three layers of data:\n * - `stagePool` provides the resource locator (`entry`, optional `bundleRoot`) and stage defaults.\n * - `layoutSpec` provides per-mode stage ordering and host-side overrides (`className`, `style`, etc.).\n * - `bundleRoot` provides an optional host-level fallback when a pool stage does not define one.\n *\n * Resolution rules:\n * - `entry`: pool-only\n * - `bundleRoot`: `pool.bundleRoot ?? params.bundleRoot ?? undefined`\n * - `theme`: `slice.theme ?? pool.theme`\n * - `focusKey`: `slice.focusKey ?? pool.focusKey`\n * - `className/style`: slice-only\n *\n * `layoutSpec` must not contain duplicate slice ids within the same view mode.\n * This is required because the resolved `stage.id` is used as the stable identity\n * for React keys, Motion layout ids, and emitted `interaction.stageId`.\n *\n * Throws if any `layoutSpec` item references a stage id that is missing from `stagePool`.\n */\nexport function resolveStudioLayout(\n params: ResolveStudioLayoutParams,\n): StudioResolvedLayout {\n const { stagePool, layoutSpec, bundleRoot } = params\n\n const resolveSlice = (slice: StudioStageSlice): StudioResolvedStage => {\n const pool = stagePool[slice.id]\n if (!pool) {\n throw new Error(`Missing stagePool item for id: ${slice.id}`)\n }\n\n const resolved: StudioResolvedStage = {\n id: slice.id,\n entry: pool.entry,\n theme: slice.theme ?? pool.theme,\n }\n\n const resolvedBundleRoot = pool.bundleRoot ?? bundleRoot\n if (resolvedBundleRoot !== undefined) {\n resolved.bundleRoot = resolvedBundleRoot\n }\n\n const resolvedFocusKey = slice.focusKey ?? pool.focusKey\n if (resolvedFocusKey !== undefined) {\n resolved.focusKey = resolvedFocusKey\n }\n\n if (slice.className !== undefined) {\n resolved.className = slice.className\n }\n\n if (slice.style !== undefined) {\n resolved.style = slice.style\n }\n\n return resolved\n }\n\n const MODES: StudioViewMode[] = ['compare', 'focus', 'lineup']\n\n for (const mode of MODES) {\n const slices = (layoutSpec as Partial<StudioLayout>)[mode]\n if (slices === undefined) {\n throw new Error(`Missing StudioLayout mode: ${mode}`)\n }\n\n const seen = new Set<string>()\n for (const slice of slices) {\n if (seen.has(slice.id)) {\n throw new Error(\n `Duplicate StudioStageSlice.id in mode \"${mode}\": ${slice.id}. `\n + 'Each mode must use unique stage ids because stage.id is the render identity. '\n + 'To render the same entry multiple times, define multiple pool stages with different ids.',\n )\n }\n seen.add(slice.id)\n }\n }\n\n const resolved = {} as StudioResolvedLayout\n for (const mode of MODES) {\n resolved[mode] = layoutSpec[mode].map((slice) => resolveSlice(slice))\n }\n return resolved\n}\n\nexport function indexResolvedLayout(layout: StudioResolvedLayout): {\n focusKeys: Set<string>\n stageIdToFocusKey: Map<string, string>\n} {\n const focusKeys = new Set<string>()\n const stageIdToFocusKey = new Map<string, string>()\n const focusKeyToStageId = new Map<string, string>()\n\n const modes = Object.keys(layout) as (keyof StudioResolvedLayout)[]\n for (const mode of modes) {\n for (const stage of layout[mode]) {\n const focusKey = stage.focusKey\n if (focusKey === undefined) continue\n\n const focusKeyOwner = focusKeyToStageId.get(focusKey)\n if (focusKeyOwner !== undefined && focusKeyOwner !== stage.id) {\n throw new Error(\n `Duplicate focusKey \"${focusKey}\" found for stages \"${focusKeyOwner}\" and \"${stage.id}\".`,\n )\n }\n focusKeyToStageId.set(focusKey, stage.id)\n focusKeys.add(focusKey)\n\n const prevFocusKey = stageIdToFocusKey.get(stage.id)\n if (prevFocusKey !== undefined && prevFocusKey !== focusKey) {\n throw new Error(\n `Conflicting focusKey for stage \"${stage.id}\": \"${prevFocusKey}\" vs \"${focusKey}\".`,\n )\n }\n stageIdToFocusKey.set(stage.id, focusKey)\n }\n }\n\n return { focusKeys, stageIdToFocusKey }\n}\n\n/** Optional mode-to-grid mapping used by grid-driven choreography containers. */\nexport type StudioModeGrid = Record<StudioViewMode, StudioGridSpec>\n\n/** Optional builder that derives Lynx global props for a stage render. */\nexport type StageGlobalPropsBuilder = (params: {\n /** Current stage being rendered. */\n stage: StudioResolvedStage\n /** Active studio presentation mode. */\n viewMode: StudioViewMode\n /** Resolved active focus key for the current choreography state. */\n activeFocusKey: string\n /** Stage-level focus key associated with `stage`, if any. */\n focusKey: string | undefined\n}) => Record<string, unknown> | undefined\n"],"names":["resolveStudioLayout","params","stagePool","layoutSpec","bundleRoot","resolveSlice","slice","pool","Error","resolved","resolvedBundleRoot","undefined","resolvedFocusKey","MODES","mode","slices","seen","Set","indexResolvedLayout","layout","focusKeys","stageIdToFocusKey","Map","focusKeyToStageId","modes","Object","stage","focusKey","focusKeyOwner","prevFocusKey"],"mappings":"AA2HO,SAASA,oBACdC,MAAiC;IAEjC,MAAM,EAAEC,SAAS,EAAEC,UAAU,EAAEC,UAAU,EAAE,GAAGH;IAE9C,MAAMI,eAAe,CAACC;QACpB,MAAMC,OAAOL,SAAS,CAACI,MAAM,EAAE,CAAC;QAChC,IAAI,CAACC,MACH,MAAM,IAAIC,MAAM,CAAC,+BAA+B,EAAEF,MAAM,EAAE,EAAE;QAG9D,MAAMG,WAAgC;YACpC,IAAIH,MAAM,EAAE;YACZ,OAAOC,KAAK,KAAK;YACjB,OAAOD,MAAM,KAAK,IAAIC,KAAK,KAAK;QAClC;QAEA,MAAMG,qBAAqBH,KAAK,UAAU,IAAIH;QAC9C,IAAIM,AAAuBC,WAAvBD,oBACFD,SAAS,UAAU,GAAGC;QAGxB,MAAME,mBAAmBN,MAAM,QAAQ,IAAIC,KAAK,QAAQ;QACxD,IAAIK,AAAqBD,WAArBC,kBACFH,SAAS,QAAQ,GAAGG;QAGtB,IAAIN,AAAoBK,WAApBL,MAAM,SAAS,EACjBG,SAAS,SAAS,GAAGH,MAAM,SAAS;QAGtC,I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G7FH,kBAAkB,GAAG,CAACI,UAAUD,MAAM,EAAE;QACxCN,UAAU,GAAG,CAACO;QAEd,MAAME,eAAeR,kBAAkB,GAAG,CAACK,MAAM,EAAE;QACnD,IAAIG,AAAiBlB,WAAjBkB,gBAA8BA,iBAAiBF,UACjD,MAAM,IAAInB,MACR,CAAC,gCAAgC,EAAEkB,MAAM,EAAE,CAAC,IAAI,EAAEG,aAAa,MAAM,EAAEF,SAAS,EAAE,CAAC;QAGvFN,kBAAkB,GAAG,CAACK,MAAM,EAAE,EAAEC;IAClC;IAGF,OAAO;QAAEP;QAAWC;IAAkB;AACxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/types/utils.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAClB;KACC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,GACC,EAAE,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { StudioViewMode } from '../types';
|
|
2
|
+
export interface WorldPos {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
z: number;
|
|
6
|
+
}
|
|
7
|
+
export interface StageWorldState {
|
|
8
|
+
world: WorldPos;
|
|
9
|
+
zIndex: number;
|
|
10
|
+
maskOpacity: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function isForegroundStage(focusKey: string | undefined, activeFocusKey: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Resolves the presentation transform for a stage.
|
|
15
|
+
*
|
|
16
|
+
* In focus mode, `escape` marks foreground stages, which stay centered,
|
|
17
|
+
* elevated, and unmasked. Focusable background stages use `backgroundIndex`
|
|
18
|
+
* to fan out around the foreground, while `activeFocusIndex` adds a small
|
|
19
|
+
* rotation offset so focus transitions preserve a sense of direction.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getStageWorldState({ mode, backgroundIndex, backgroundMidpoint, activeFocusIndex, escape, }: {
|
|
22
|
+
mode: StudioViewMode;
|
|
23
|
+
backgroundIndex: number;
|
|
24
|
+
backgroundMidpoint: number;
|
|
25
|
+
activeFocusIndex: number;
|
|
26
|
+
escape: boolean;
|
|
27
|
+
}): StageWorldState;
|
|
28
|
+
//# sourceMappingURL=world.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world.d.ts","sourceRoot":"","sources":["../../src/utils/world.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,QAAQ,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;CACpB;AAID,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,cAAc,EAAE,MAAM,GACrB,OAAO,CAET;AAQD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,MAAM,GACP,EAAE;IACD,IAAI,EAAE,cAAc,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,gBAAgB,EAAE,MAAM,CAAA;IACxB,MAAM,EAAE,OAAO,CAAA;CAChB,GAAG,eAAe,CAoClB"}
|