@lynx-js/luna-stage 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 +415 -5
- package/dist/components/context/create-context.d.ts +55 -0
- package/dist/components/context/create-context.d.ts.map +1 -0
- package/dist/components/context/create-context.js +32 -0
- package/dist/components/context/create-context.js.map +1 -0
- package/dist/components/context/index.d.ts +2 -0
- package/dist/components/context/index.d.ts.map +1 -0
- package/dist/components/context/index.js +1 -0
- package/dist/components/stage/index.d.ts +2 -0
- package/dist/components/stage/index.d.ts.map +1 -0
- package/dist/components/stage/index.js +1 -0
- package/dist/components/stage/stage.d.ts +10 -0
- package/dist/components/stage/stage.d.ts.map +1 -0
- package/dist/components/stage/stage.js +185 -0
- package/dist/components/stage/stage.js.map +1 -0
- package/dist/constants/stage.d.ts +4 -0
- package/dist/constants/stage.d.ts.map +1 -0
- package/dist/constants/stage.js +6 -0
- package/dist/constants/stage.js.map +1 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/use-container-resize.d.ts +30 -0
- package/dist/hooks/use-container-resize.d.ts.map +1 -0
- package/dist/hooks/use-container-resize.js +63 -0
- package/dist/hooks/use-container-resize.js.map +1 -0
- package/dist/hooks/use-event-callback.d.ts +36 -0
- package/dist/hooks/use-event-callback.d.ts.map +1 -0
- package/dist/hooks/use-event-callback.js +18 -0
- package/dist/hooks/use-event-callback.js.map +1 -0
- package/dist/hooks/use-is-client.d.ts +2 -0
- package/dist/hooks/use-is-client.d.ts.map +1 -0
- package/dist/hooks/use-is-client.js +16 -0
- package/dist/hooks/use-is-client.js.map +1 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +4 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts.map +1 -0
- package/dist/hooks/use-isomorphic-layout-effect.js +6 -0
- package/dist/hooks/use-isomorphic-layout-effect.js.map +1 -0
- package/dist/hooks/use-merged-refs.d.ts +5 -0
- package/dist/hooks/use-merged-refs.d.ts.map +1 -0
- package/dist/hooks/use-merged-refs.js +18 -0
- package/dist/hooks/use-merged-refs.js.map +1 -0
- package/dist/hooks/use-raf-clock.d.ts +17 -0
- package/dist/hooks/use-raf-clock.d.ts.map +1 -0
- package/dist/hooks/use-raf-clock.js +22 -0
- package/dist/hooks/use-raf-clock.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/lynx/index.d.ts +7 -0
- package/dist/lynx/index.d.ts.map +1 -0
- package/dist/lynx/index.js +3 -0
- package/dist/lynx/luna-lynx-stage.d.ts +32 -0
- package/dist/lynx/luna-lynx-stage.d.ts.map +1 -0
- package/dist/lynx/luna-lynx-stage.js +45 -0
- package/dist/lynx/luna-lynx-stage.js.map +1 -0
- package/dist/lynx/lynx-stage-constants.d.ts +8 -0
- package/dist/lynx/lynx-stage-constants.d.ts.map +1 -0
- package/dist/lynx/lynx-stage-constants.js +26 -0
- package/dist/lynx/lynx-stage-constants.js.map +1 -0
- package/dist/lynx/lynx-stage.d.ts +25 -0
- package/dist/lynx/lynx-stage.d.ts.map +1 -0
- package/dist/lynx/lynx-stage.js +33 -0
- package/dist/lynx/lynx-stage.js.map +1 -0
- package/dist/lynx/types.d.ts +77 -0
- package/dist/lynx/types.d.ts.map +1 -0
- package/dist/lynx/types.js +0 -0
- package/dist/lynx/use-lynx-stage.d.ts +5 -0
- package/dist/lynx/use-lynx-stage.d.ts.map +1 -0
- package/dist/lynx/use-lynx-stage.js +130 -0
- package/dist/lynx/use-lynx-stage.js.map +1 -0
- package/dist/motion/context/index.d.ts +6 -0
- package/dist/motion/context/index.d.ts.map +1 -0
- package/dist/motion/context/index.js +3 -0
- package/dist/motion/context/use-visual-size.d.ts +8 -0
- package/dist/motion/context/use-visual-size.d.ts.map +1 -0
- package/dist/motion/context/use-visual-size.js +8 -0
- package/dist/motion/context/use-visual-size.js.map +1 -0
- package/dist/motion/context/visual-size-context.d.ts +10 -0
- package/dist/motion/context/visual-size-context.d.ts.map +1 -0
- package/dist/motion/context/visual-size-context.js +5 -0
- package/dist/motion/context/visual-size-context.js.map +1 -0
- package/dist/motion/context/visual-size-provider.d.ts +9 -0
- package/dist/motion/context/visual-size-provider.d.ts.map +1 -0
- package/dist/motion/context/visual-size-provider.js +19 -0
- package/dist/motion/context/visual-size-provider.js.map +1 -0
- package/dist/motion/index.d.ts +5 -0
- package/dist/motion/index.d.ts.map +1 -0
- package/dist/motion/index.js +2 -0
- package/dist/motion/stage/container-motion.d.ts +25 -0
- package/dist/motion/stage/container-motion.d.ts.map +1 -0
- package/dist/motion/stage/container-motion.js +111 -0
- package/dist/motion/stage/container-motion.js.map +1 -0
- package/dist/motion/stage/index.d.ts +5 -0
- package/dist/motion/stage/index.d.ts.map +1 -0
- package/dist/motion/stage/index.js +3 -0
- package/dist/motion/stage/presentation-motion.d.ts +17 -0
- package/dist/motion/stage/presentation-motion.d.ts.map +1 -0
- package/dist/motion/stage/presentation-motion.js +33 -0
- package/dist/motion/stage/presentation-motion.js.map +1 -0
- package/dist/motion/stage/stage-motion.d.ts +5 -0
- package/dist/motion/stage/stage-motion.d.ts.map +1 -0
- package/dist/motion/stage/stage-motion.js +184 -0
- package/dist/motion/stage/stage-motion.js.map +1 -0
- package/dist/motion/stage/transform-utils.d.ts +9 -0
- package/dist/motion/stage/transform-utils.d.ts.map +1 -0
- package/dist/motion/stage/transform-utils.js +20 -0
- package/dist/motion/stage/transform-utils.js.map +1 -0
- package/dist/motion/stage/types.d.ts +85 -0
- package/dist/motion/stage/types.d.ts.map +1 -0
- package/dist/motion/stage/types.js +0 -0
- package/dist/motion/stage/use-container-resize-mv.d.ts +13 -0
- package/dist/motion/stage/use-container-resize-mv.d.ts.map +1 -0
- package/dist/motion/stage/use-container-resize-mv.js +64 -0
- package/dist/motion/stage/use-container-resize-mv.js.map +1 -0
- package/dist/types/align.d.ts +3 -0
- package/dist/types/align.d.ts.map +1 -0
- package/dist/types/align.js +0 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +0 -0
- package/dist/types/lynx-view.d.ts +18 -0
- package/dist/types/lynx-view.d.ts.map +1 -0
- package/dist/types/lynx-view.js +0 -0
- package/dist/types/stage-props.d.ts +94 -0
- package/dist/types/stage-props.d.ts.map +1 -0
- package/dist/types/stage-props.js +0 -0
- package/dist/utils/align.d.ts +3 -0
- package/dist/utils/align.d.ts.map +1 -0
- package/dist/utils/align.js +15 -0
- package/dist/utils/align.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/transform.d.ts +121 -0
- package/dist/utils/transform.d.ts.map +1 -0
- package/dist/utils/transform.js +37 -0
- package/dist/utils/transform.js.map +1 -0
- package/package.json +73 -5
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useMotionValue } from "motion/react";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { useEventCallback } from "../../hooks/index.js";
|
|
4
|
+
function useContainerResizeMV(ref, opts) {
|
|
5
|
+
const { ResizeObserverImpl, onResize: onResizeProp } = opts ?? {};
|
|
6
|
+
const width = useMotionValue(0);
|
|
7
|
+
const height = useMotionValue(0);
|
|
8
|
+
const prevW = useRef(-1);
|
|
9
|
+
const prevH = useRef(-1);
|
|
10
|
+
const hasOnResize = void 0 !== onResizeProp;
|
|
11
|
+
const onResize = useEventCallback(onResizeProp);
|
|
12
|
+
useEffect(()=>{
|
|
13
|
+
const el = ref.current;
|
|
14
|
+
if (!el) return;
|
|
15
|
+
const RO = ResizeObserverImpl ?? ("u" > typeof window && 'ResizeObserver' in window ? window.ResizeObserver : void 0);
|
|
16
|
+
if (!RO) return;
|
|
17
|
+
const obs = new RO((entries)=>{
|
|
18
|
+
const entry = entries[0];
|
|
19
|
+
if (!entry) return;
|
|
20
|
+
let w = 0;
|
|
21
|
+
let h = 0;
|
|
22
|
+
const cbs = entry.contentBoxSize;
|
|
23
|
+
if (Array.isArray(cbs)) {
|
|
24
|
+
const first = entry.contentBoxSize[0];
|
|
25
|
+
if (first) {
|
|
26
|
+
w = first.inlineSize;
|
|
27
|
+
h = first.blockSize;
|
|
28
|
+
}
|
|
29
|
+
} else if (isContentBoxSizeSingleItem(cbs)) {
|
|
30
|
+
w = cbs.inlineSize;
|
|
31
|
+
h = cbs.blockSize;
|
|
32
|
+
} else {
|
|
33
|
+
w = entry.contentRect.width;
|
|
34
|
+
h = entry.contentRect.height;
|
|
35
|
+
}
|
|
36
|
+
if (w !== prevW.current || h !== prevH.current) {
|
|
37
|
+
prevW.current = w;
|
|
38
|
+
prevH.current = h;
|
|
39
|
+
width.set(w);
|
|
40
|
+
height.set(h);
|
|
41
|
+
if (hasOnResize) onResize?.(w, h);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
obs.observe(el);
|
|
45
|
+
return ()=>obs.disconnect();
|
|
46
|
+
}, [
|
|
47
|
+
ref,
|
|
48
|
+
ResizeObserverImpl,
|
|
49
|
+
onResize,
|
|
50
|
+
hasOnResize,
|
|
51
|
+
width,
|
|
52
|
+
height
|
|
53
|
+
]);
|
|
54
|
+
return {
|
|
55
|
+
width,
|
|
56
|
+
height
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function isContentBoxSizeSingleItem(v) {
|
|
60
|
+
return 'object' == typeof v && null !== v && 'number' == typeof v.inlineSize && 'number' == typeof v.blockSize;
|
|
61
|
+
}
|
|
62
|
+
export { useContainerResizeMV };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=use-container-resize-mv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion/stage/use-container-resize-mv.js","sources":["../../../src/motion/stage/use-container-resize-mv.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 { useMotionValue } from 'motion/react'\nimport type { MotionValue } from 'motion/react'\nimport { useEffect, useRef } from 'react'\nimport type { RefObject } from 'react'\n\nimport { useEventCallback } from '../../hooks'\n\ninterface SizeMV {\n width: MotionValue<number>\n height: MotionValue<number>\n}\n\ntype ResizeObserverCtor = new(cb: ResizeObserverCallback) => ResizeObserver\n\nexport function useContainerResizeMV<T extends HTMLElement = HTMLElement>(\n ref: RefObject<T | null>,\n opts?: {\n ResizeObserverImpl?: ResizeObserverCtor\n onResize?: (w: number, h: number) => void\n },\n): SizeMV {\n const { ResizeObserverImpl, onResize: onResizeProp } = opts ?? {}\n\n const width = useMotionValue(0)\n const height = useMotionValue(0)\n const prevW = useRef<number>(-1)\n const prevH = useRef<number>(-1)\n const hasOnResize = onResizeProp !== undefined\n\n // Stable callback — avoids stale closure\n const onResize = useEventCallback(onResizeProp)\n\n useEffect(() => {\n const el = ref.current\n if (!el) return\n\n const RO: ResizeObserverCtor | undefined = ResizeObserverImpl\n ?? ((typeof window !== 'undefined' && 'ResizeObserver' in window)\n ? window.ResizeObserver\n : undefined)\n if (!RO) return\n\n const obs = new RO(entries => {\n const entry = entries[0]\n if (!entry) return\n let w = 0\n let h = 0\n\n const cbs = entry.contentBoxSize as unknown\n\n if (Array.isArray(cbs)) {\n // The standard makes contentBoxSize an array...\n const first = entry.contentBoxSize[0]\n if (first) {\n w = first.inlineSize\n h = first.blockSize\n }\n } else if (isContentBoxSizeSingleItem(cbs)) {\n // ... but old versions of Firefox treat it as a single item\n w = cbs.inlineSize\n h = cbs.blockSize\n } else {\n // fallback to legacy API\n w = entry.contentRect.width\n h = entry.contentRect.height\n }\n\n if (w !== prevW.current || h !== prevH.current) {\n prevW.current = w\n prevH.current = h\n width.set(w)\n height.set(h)\n if (hasOnResize) {\n onResize?.(w, h)\n }\n }\n })\n\n obs.observe(el)\n return () => obs.disconnect()\n }, [ref, ResizeObserverImpl, onResize, hasOnResize, width, height])\n\n return { width, height }\n}\n\nfunction isContentBoxSizeSingleItem(\n v: unknown,\n): v is { inlineSize: number, blockSize: number } {\n return (\n typeof v === 'object'\n && v !== null\n && typeof (v as { inlineSize?: unknown }).inlineSize === 'number'\n && typeof (v as { blockSize?: unknown }).blockSize === 'number'\n )\n}\n"],"names":["useContainerResizeMV","ref","opts","ResizeObserverImpl","onResizeProp","width","useMotionValue","height","prevW","useRef","prevH","hasOnResize","undefined","onResize","useEventCallback","useEffect","el","RO","window","obs","entries","entry","w","h","cbs","Array","first","isContentBoxSizeSingleItem","v"],"mappings":";;;AAkBO,SAASA,qBACdC,GAAwB,EACxBC,IAGC;IAED,MAAM,EAAEC,kBAAkB,EAAE,UAAUC,YAAY,EAAE,GAAGF,QAAQ,CAAC;IAEhE,MAAMG,QAAQC,eAAe;IAC7B,MAAMC,SAASD,eAAe;IAC9B,MAAME,QAAQC,OAAe;IAC7B,MAAMC,QAAQD,OAAe;IAC7B,MAAME,cAAcP,AAAiBQ,WAAjBR;IAGpB,MAAMS,WAAWC,iBAAiBV;IAElCW,UAAU;QACR,MAAMC,KAAKf,IAAI,OAAO;QACtB,IAAI,CAACe,IAAI;QAET,MAAMC,KAAqCd,sBACpC,CAAkB,MAAlB,OAAOe,UAA0B,oBAAoBA,SACtDA,OAAO,cAAc,GACrBN,MAAQ;QACd,IAAI,CAACK,IAAI;QAET,MAAME,MAAM,IAAIF,GAAGG,CAAAA;YACjB,MAAMC,QAAQD,OAAO,CAAC,EAAE;YACxB,IAAI,CAACC,OAAO;YACZ,IAAIC,IAAI;YACR,IAAIC,IAAI;YAER,MAAMC,MAAMH,MAAM,cAAc;YAEhC,IAAII,MAAM,OAAO,CAACD,MAAM;gBAEtB,MAAME,QAAQL,MAAM,cAAc,CAAC,EAAE;gBACrC,IAAIK,OAAO;oBACTJ,IAAII,MAAM,UAAU;oBACpBH,IAAIG,MAAM,SAAS;gBACrB;YACF,OAAO,IAAIC,2BAA2BH,MAAM;gBAE1CF,IAAIE,IAAI,UAAU;gBAClBD,IAAIC,IAAI,SAAS;YACnB,OAAO;gBAELF,IAAID,MAAM,WAAW,CAAC,KAAK;gBAC3BE,IAAIF,MAAM,WAAW,CAAC,MAAM;YAC9B;YAEA,IAAIC,MAAMd,MAAM,OAAO,IAAIe,MAAMb,MAAM,OAAO,EAAE;gBAC9CF,MAAM,OAAO,GAAGc;gBAChBZ,MAAM,OAAO,GAAGa;gBAChBlB,MAAM,GAAG,CAACiB;gBACVf,OAAO,GAAG,CAACgB;gBACX,IAAIZ,aACFE,WAAWS,GAAGC;YAElB;QACF;QAEAJ,IAAI,OAAO,CAACH;QACZ,OAAO,IAAMG,IAAI,UAAU;IAC7B,GAAG;QAAClB;QAAKE;QAAoBU;QAAUF;QAAaN;QAAOE;KAAO;IAElE,OAAO;QAAEF;QAAOE;IAAO;AACzB;AAEA,SAASoB,2BACPC,CAAU;IAEV,OACE,AAAa,YAAb,OAAOA,KACJA,AAAM,SAANA,KACA,AAAsD,YAAtD,OAAQA,EAA+B,UAAU,IACjD,AAAoD,YAApD,OAAQA,EAA8B,SAAS;AAEtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"align.d.ts","sourceRoot":"","sources":["../../src/types/align.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;AAChD,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAC7C,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
2
|
+
type LynxViewAttributes = HTMLAttributes<HTMLElement> & {
|
|
3
|
+
url?: string;
|
|
4
|
+
'lynx-group-id'?: number;
|
|
5
|
+
'transform-vh'?: boolean;
|
|
6
|
+
'transform-vw'?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare global {
|
|
9
|
+
namespace JSX {
|
|
10
|
+
interface IntrinsicElements {
|
|
11
|
+
'lynx-view': DetailedHTMLProps<LynxViewAttributes, HTMLElement>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export type CSSVarProperties = Record<`--${string}`, string | number>;
|
|
16
|
+
export type LynxGlobalProps = Record<string, unknown>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=lynx-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lynx-view.d.ts","sourceRoot":"","sources":["../../src/types/lynx-view.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE9D,KAAK,kBAAkB,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACtD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,WAAW,EAAE,iBAAiB,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAA;SAChE;KACF;CACF;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;AACrE,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { AlignX, AlignY } from './align.js';
|
|
3
|
+
export interface StageBaseProps {
|
|
4
|
+
/**
|
|
5
|
+
* Base (design) width of the device frame in pixels.
|
|
6
|
+
*/
|
|
7
|
+
baseWidth?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Base (design) height of the device frame in pixels.
|
|
10
|
+
*/
|
|
11
|
+
baseHeight?: number;
|
|
12
|
+
/**
|
|
13
|
+
* How the base device frame fits into the target viewport.
|
|
14
|
+
*
|
|
15
|
+
* - `contain`: scales down to fully fit inside the viewport
|
|
16
|
+
* - `cover`: scales up to fully cover the viewport (may crop)
|
|
17
|
+
*/
|
|
18
|
+
fit?: 'contain' | 'cover';
|
|
19
|
+
/**
|
|
20
|
+
* Anchor point for fitting and cropping.
|
|
21
|
+
*
|
|
22
|
+
* Horizontal alignment of the cropped content.
|
|
23
|
+
* `left`/`right` are physical directions.
|
|
24
|
+
*
|
|
25
|
+
* Defaults to `center`.
|
|
26
|
+
*/
|
|
27
|
+
alignX?: AlignX;
|
|
28
|
+
/**
|
|
29
|
+
* Anchor point for fitting and cropping.
|
|
30
|
+
*
|
|
31
|
+
* Vertical alignment of the cropped content.
|
|
32
|
+
* `top`/`bottom` are physical directions.
|
|
33
|
+
*
|
|
34
|
+
* Defaults to `center`.
|
|
35
|
+
*/
|
|
36
|
+
alignY?: AlignY;
|
|
37
|
+
/**
|
|
38
|
+
* Additional class name applied to the device outline layer.
|
|
39
|
+
*/
|
|
40
|
+
className?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Inline style applied to the device outline layer.
|
|
43
|
+
*/
|
|
44
|
+
style?: CSSProperties;
|
|
45
|
+
/**
|
|
46
|
+
* Content rendered inside the device frame.
|
|
47
|
+
*/
|
|
48
|
+
children?: ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Additional zoom factor.
|
|
51
|
+
*
|
|
52
|
+
* - `1`: no change
|
|
53
|
+
* - `> 1`: zoom in
|
|
54
|
+
* - `< 1`: zoom out
|
|
55
|
+
*/
|
|
56
|
+
zoom?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Additional translation applied along the X axis in screen space (pixels).
|
|
59
|
+
*/
|
|
60
|
+
panX?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Additional translation applied along the Y axis in screen space (pixels).
|
|
63
|
+
*/
|
|
64
|
+
panY?: number;
|
|
65
|
+
}
|
|
66
|
+
export type StageProps = StageBaseProps & {
|
|
67
|
+
/**
|
|
68
|
+
* Target viewport width in pixels.
|
|
69
|
+
*
|
|
70
|
+
* When omitted, it uses the measured size from `StageContainer` if present,
|
|
71
|
+
* otherwise falls back to `baseWidth`.
|
|
72
|
+
*/
|
|
73
|
+
width?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Target viewport height in pixels.
|
|
76
|
+
*
|
|
77
|
+
* When omitted, it uses the measured size from `StageContainer` if present,
|
|
78
|
+
* otherwise falls back to `baseHeight`.
|
|
79
|
+
*/
|
|
80
|
+
height?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Horizontal placement of the internal anchor within the viewport.
|
|
83
|
+
*
|
|
84
|
+
* Defaults to `alignX` (object-position semantics).
|
|
85
|
+
*/
|
|
86
|
+
placeX?: AlignX;
|
|
87
|
+
/**
|
|
88
|
+
* Vertical placement of the internal anchor within the viewport.
|
|
89
|
+
*
|
|
90
|
+
* Defaults to `alignY` (object-position semantics).
|
|
91
|
+
*/
|
|
92
|
+
placeY?: AlignY;
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=stage-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-props.d.ts","sourceRoot":"","sources":["../../src/types/stage-props.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEhD,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO,CAAA;IACzB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,UAAU,GAClB,cAAc,GACd;IACA;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"align.d.ts","sourceRoot":"","sources":["../../src/utils/align.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAE9C,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAWjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/align.js","sources":["../../src/utils/align.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 { AlignX, AlignY } from '../types'\n\nexport function toAlignFactor(alignment?: AlignX | AlignY): number {\n switch (alignment) {\n case 'left':\n case 'top':\n return 0\n case 'right':\n case 'bottom':\n return 1\n default:\n return 0.5\n }\n}\n"],"names":["toAlignFactor","alignment"],"mappings":"AAMO,SAASA,cAAcC,SAA2B;IACvD,OAAQA;QACN,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;YACH,OAAO;QACT;YACE,OAAO;IACX;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dimensions of the container and the base frame.
|
|
3
|
+
*/
|
|
4
|
+
export interface FitInput {
|
|
5
|
+
/** Container width in pixels */
|
|
6
|
+
containerWidth: number;
|
|
7
|
+
/** Container height in pixels */
|
|
8
|
+
containerHeight: number;
|
|
9
|
+
/** Base frame width in pixels */
|
|
10
|
+
baseWidth: number;
|
|
11
|
+
/** Base frame height in pixels */
|
|
12
|
+
baseHeight: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Contain and cover scale factors for a base frame fitted into a container.
|
|
16
|
+
* The two values bracket the valid scale range.
|
|
17
|
+
*
|
|
18
|
+
* - `contain`: the base frame is fully visible inside the container
|
|
19
|
+
* - `cover`: the container is fully filled, base frame may be cropped
|
|
20
|
+
*/
|
|
21
|
+
export interface ScaleRange {
|
|
22
|
+
contain: number;
|
|
23
|
+
cover: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Pre-computed alignment factors along each axis.
|
|
27
|
+
* Each value is in [0, 1]: 0 = start, 0.5 = center, 1 = end.
|
|
28
|
+
*/
|
|
29
|
+
export interface AlignFactors {
|
|
30
|
+
ax: number;
|
|
31
|
+
ay: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Input for computing the frame's transform offset.
|
|
35
|
+
*/
|
|
36
|
+
export type FrameOffsetInput = {
|
|
37
|
+
baseWidth: number;
|
|
38
|
+
baseHeight: number;
|
|
39
|
+
scale: number;
|
|
40
|
+
} & AlignFactors;
|
|
41
|
+
/**
|
|
42
|
+
* 2D translation offset for a frame transform.
|
|
43
|
+
*/
|
|
44
|
+
export interface FrameOffset {
|
|
45
|
+
offsetX: number;
|
|
46
|
+
offsetY: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Compute the contain and cover scale factors for a base frame
|
|
50
|
+
* fitted into a container.
|
|
51
|
+
*/
|
|
52
|
+
export declare function computeScaleRange(input: FitInput): ScaleRange;
|
|
53
|
+
/**
|
|
54
|
+
* Interpolate between contain and cover scale using a 0–1 progress value.
|
|
55
|
+
*
|
|
56
|
+
* - `t = 0`: behaves like contain
|
|
57
|
+
* - `t = 1`: behaves like cover
|
|
58
|
+
*/
|
|
59
|
+
export declare function lerpFitScale({ contain, cover }: ScaleRange, t: number): number;
|
|
60
|
+
/**
|
|
61
|
+
* Compute the transform offset for a scaled frame,
|
|
62
|
+
* given pre-computed scale and alignment factors.
|
|
63
|
+
*
|
|
64
|
+
* ax / ay are the normalized coordinates of the anchor point within the frame;
|
|
65
|
+
* the returned offset is applied to a top-left-origin transform.
|
|
66
|
+
*/
|
|
67
|
+
export declare function computeFrameOffset(input: FrameOffsetInput): FrameOffset;
|
|
68
|
+
export interface DepthScaleOptions {
|
|
69
|
+
/**
|
|
70
|
+
* Optional upper bound for the returned scale.
|
|
71
|
+
* When omitted, no clamping is applied and the raw value (or `Infinity`
|
|
72
|
+
* at the singularity) is returned. Pass a finite value to guard against
|
|
73
|
+
* extreme scales in rendering contexts that cannot handle `Infinity`.
|
|
74
|
+
*/
|
|
75
|
+
maxScale?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Compute the perspective depth scale for a given world-space Z position.
|
|
79
|
+
*
|
|
80
|
+
* Follows the CSS / OpenGL convention: +Z points toward the viewer.
|
|
81
|
+
* Equivalent to the perspective divide in a pinhole camera model:
|
|
82
|
+
* `w = f / (f - z)`, where `f` is the focal length.
|
|
83
|
+
*
|
|
84
|
+
* - `z > 0`: object is closer to the viewer, scale > 1 (appears larger)
|
|
85
|
+
* - `z < 0`: object is further from the viewer, scale < 1 (appears smaller)
|
|
86
|
+
* - `z = 0`: no perspective effect, scale = 1
|
|
87
|
+
* - `z >= f`: object is at or behind the camera optical center —
|
|
88
|
+
* physically undefined (singularity). Returns `options.maxScale` if
|
|
89
|
+
* provided, otherwise `Infinity`.
|
|
90
|
+
* - Returns `1` (orthographic) when `focalLength` is absent or `<= 0`.
|
|
91
|
+
*/
|
|
92
|
+
export declare function computeDepthScale(focalLength: number | undefined, worldZ: number, options?: DepthScaleOptions): number;
|
|
93
|
+
export interface ScreenTranslation {
|
|
94
|
+
/** Final screen-space translation along X, in pixels */
|
|
95
|
+
x: number;
|
|
96
|
+
/** Final screen-space translation along Y, in pixels */
|
|
97
|
+
y: number;
|
|
98
|
+
}
|
|
99
|
+
export interface ScreenTranslationInput {
|
|
100
|
+
/** World-space X position of the frame */
|
|
101
|
+
worldX: number;
|
|
102
|
+
/** World-space Y position of the frame */
|
|
103
|
+
worldY: number;
|
|
104
|
+
/** Perspective depth scale — output of `computeDepthScale` */
|
|
105
|
+
depthScale: number;
|
|
106
|
+
/** Direct screen-space pan offset along X, in pixels */
|
|
107
|
+
screenPanX: number;
|
|
108
|
+
/** Direct screen-space pan offset along Y, in pixels */
|
|
109
|
+
screenPanY: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Compute the final screen-space translation by projecting world-space
|
|
113
|
+
* XY coordinates into screen space via the perspective depth scale,
|
|
114
|
+
* then adding direct screen-space pan offsets.
|
|
115
|
+
*
|
|
116
|
+
* This compensates for the principal-point shift that occurs when an
|
|
117
|
+
* object moves in Z — without this, a depth change would also cause
|
|
118
|
+
* an unwanted lateral drift on screen.
|
|
119
|
+
*/
|
|
120
|
+
export declare function computeScreenTranslation(input: ScreenTranslationInput): ScreenTranslation;
|
|
121
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/utils/transform.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,gCAAgC;IAChC,cAAc,EAAE,MAAM,CAAA;IACtB,iCAAiC;IACjC,eAAe,EAAE,MAAM,CAAA;IACvB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;CACX;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,GAAG,YAAY,CAAA;AAEhB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,CAgB7D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAC9B,CAAC,EAAE,MAAM,GACR,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,GAAG,WAAW,CAMvE;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,iBAAiB,GAC1B,MAAM,CAQR;AAED,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,CAAC,EAAE,MAAM,CAAA;IACT,wDAAwD;IACxD,CAAC,EAAE,MAAM,CAAA;CACV;AAED,MAAM,WAAW,sBAAsB;IACrC,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAA;IACd,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAA;IACd,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAA;IAClB,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAA;IAClB,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,sBAAsB,GAC5B,iBAAiB,CAMnB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
function computeScaleRange(input) {
|
|
2
|
+
const { containerWidth, containerHeight, baseWidth, baseHeight } = input;
|
|
3
|
+
if (!Number.isFinite(baseWidth) || baseWidth <= 0 || !Number.isFinite(baseHeight) || baseHeight <= 0) throw new RangeError(`computeScaleRange: baseWidth and baseHeight must be finite and > 0, got ${baseWidth}x${baseHeight}`);
|
|
4
|
+
const ratioW = containerWidth / baseWidth;
|
|
5
|
+
const ratioH = containerHeight / baseHeight;
|
|
6
|
+
return {
|
|
7
|
+
contain: Math.min(ratioW, ratioH),
|
|
8
|
+
cover: Math.max(ratioW, ratioH)
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function lerpFitScale({ contain, cover }, t) {
|
|
12
|
+
return contain + (cover - contain) * t;
|
|
13
|
+
}
|
|
14
|
+
function computeFrameOffset(input) {
|
|
15
|
+
const { baseWidth, baseHeight, scale, ax, ay } = input;
|
|
16
|
+
return {
|
|
17
|
+
offsetX: -(baseWidth * scale) * ax,
|
|
18
|
+
offsetY: -(baseHeight * scale) * ay
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function computeDepthScale(focalLength, worldZ, options) {
|
|
22
|
+
if (!focalLength || focalLength <= 0) return 1;
|
|
23
|
+
const denom = focalLength - worldZ;
|
|
24
|
+
if (denom <= 0) return options?.maxScale ?? 1 / 0;
|
|
25
|
+
const scale = focalLength / denom;
|
|
26
|
+
return options?.maxScale === void 0 ? scale : Math.min(scale, options.maxScale);
|
|
27
|
+
}
|
|
28
|
+
function computeScreenTranslation(input) {
|
|
29
|
+
const { worldX, worldY, depthScale, screenPanX, screenPanY } = input;
|
|
30
|
+
return {
|
|
31
|
+
x: worldX * depthScale + screenPanX,
|
|
32
|
+
y: worldY * depthScale + screenPanY
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export { computeDepthScale, computeFrameOffset, computeScaleRange, computeScreenTranslation, lerpFitScale };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/transform.js","sources":["../../src/utils/transform.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\n/**\n * Dimensions of the container and the base frame.\n */\nexport interface FitInput {\n /** Container width in pixels */\n containerWidth: number\n /** Container height in pixels */\n containerHeight: number\n /** Base frame width in pixels */\n baseWidth: number\n /** Base frame height in pixels */\n baseHeight: number\n}\n\n/**\n * Contain and cover scale factors for a base frame fitted into a container.\n * The two values bracket the valid scale range.\n *\n * - `contain`: the base frame is fully visible inside the container\n * - `cover`: the container is fully filled, base frame may be cropped\n */\nexport interface ScaleRange {\n contain: number\n cover: number\n}\n\n/**\n * Pre-computed alignment factors along each axis.\n * Each value is in [0, 1]: 0 = start, 0.5 = center, 1 = end.\n */\nexport interface AlignFactors {\n ax: number\n ay: number\n}\n\n/**\n * Input for computing the frame's transform offset.\n */\nexport type FrameOffsetInput = {\n baseWidth: number\n baseHeight: number\n scale: number\n} & AlignFactors\n\n/**\n * 2D translation offset for a frame transform.\n */\nexport interface FrameOffset {\n offsetX: number\n offsetY: number\n}\n\n/**\n * Compute the contain and cover scale factors for a base frame\n * fitted into a container.\n */\nexport function computeScaleRange(input: FitInput): ScaleRange {\n const { containerWidth, containerHeight, baseWidth, baseHeight } = input\n if (\n !Number.isFinite(baseWidth) || baseWidth <= 0\n || !Number.isFinite(baseHeight) || baseHeight <= 0\n ) {\n throw new RangeError(\n `computeScaleRange: baseWidth and baseHeight must be finite and > 0, got ${baseWidth}x${baseHeight}`,\n )\n }\n const ratioW = containerWidth / baseWidth\n const ratioH = containerHeight / baseHeight\n return {\n contain: Math.min(ratioW, ratioH),\n cover: Math.max(ratioW, ratioH),\n }\n}\n\n/**\n * Interpolate between contain and cover scale using a 0–1 progress value.\n *\n * - `t = 0`: behaves like contain\n * - `t = 1`: behaves like cover\n */\nexport function lerpFitScale(\n { contain, cover }: ScaleRange,\n t: number,\n): number {\n return contain + (cover - contain) * t\n}\n\n/**\n * Compute the transform offset for a scaled frame,\n * given pre-computed scale and alignment factors.\n *\n * ax / ay are the normalized coordinates of the anchor point within the frame;\n * the returned offset is applied to a top-left-origin transform.\n */\nexport function computeFrameOffset(input: FrameOffsetInput): FrameOffset {\n const { baseWidth, baseHeight, scale, ax, ay } = input\n return {\n offsetX: -(baseWidth * scale) * ax,\n offsetY: -(baseHeight * scale) * ay,\n }\n}\n\nexport interface DepthScaleOptions {\n /**\n * Optional upper bound for the returned scale.\n * When omitted, no clamping is applied and the raw value (or `Infinity`\n * at the singularity) is returned. Pass a finite value to guard against\n * extreme scales in rendering contexts that cannot handle `Infinity`.\n */\n maxScale?: number\n}\n\n/**\n * Compute the perspective depth scale for a given world-space Z position.\n *\n * Follows the CSS / OpenGL convention: +Z points toward the viewer.\n * Equivalent to the perspective divide in a pinhole camera model:\n * `w = f / (f - z)`, where `f` is the focal length.\n *\n * - `z > 0`: object is closer to the viewer, scale > 1 (appears larger)\n * - `z < 0`: object is further from the viewer, scale < 1 (appears smaller)\n * - `z = 0`: no perspective effect, scale = 1\n * - `z >= f`: object is at or behind the camera optical center —\n * physically undefined (singularity). Returns `options.maxScale` if\n * provided, otherwise `Infinity`.\n * - Returns `1` (orthographic) when `focalLength` is absent or `<= 0`.\n */\nexport function computeDepthScale(\n focalLength: number | undefined,\n worldZ: number,\n options?: DepthScaleOptions,\n): number {\n if (!focalLength || focalLength <= 0) return 1\n const denom = focalLength - worldZ\n if (denom <= 0) return options?.maxScale ?? Number.POSITIVE_INFINITY\n const scale = focalLength / denom\n return options?.maxScale === undefined\n ? scale\n : Math.min(scale, options.maxScale)\n}\n\nexport interface ScreenTranslation {\n /** Final screen-space translation along X, in pixels */\n x: number\n /** Final screen-space translation along Y, in pixels */\n y: number\n}\n\nexport interface ScreenTranslationInput {\n /** World-space X position of the frame */\n worldX: number\n /** World-space Y position of the frame */\n worldY: number\n /** Perspective depth scale — output of `computeDepthScale` */\n depthScale: number\n /** Direct screen-space pan offset along X, in pixels */\n screenPanX: number\n /** Direct screen-space pan offset along Y, in pixels */\n screenPanY: number\n}\n\n/**\n * Compute the final screen-space translation by projecting world-space\n * XY coordinates into screen space via the perspective depth scale,\n * then adding direct screen-space pan offsets.\n *\n * This compensates for the principal-point shift that occurs when an\n * object moves in Z — without this, a depth change would also cause\n * an unwanted lateral drift on screen.\n */\nexport function computeScreenTranslation(\n input: ScreenTranslationInput,\n): ScreenTranslation {\n const { worldX, worldY, depthScale, screenPanX, screenPanY } = input\n return {\n x: worldX * depthScale + screenPanX,\n y: worldY * depthScale + screenPanY,\n }\n}\n"],"names":["computeScaleRange","input","containerWidth","containerHeight","baseWidth","baseHeight","Number","RangeError","ratioW","ratioH","Math","lerpFitScale","contain","cover","t","computeFrameOffset","scale","ax","ay","computeDepthScale","focalLength","worldZ","options","denom","undefined","computeScreenTranslation","worldX","worldY","depthScale","screenPanX","screenPanY"],"mappings":"AA4DO,SAASA,kBAAkBC,KAAe;IAC/C,MAAM,EAAEC,cAAc,EAAEC,eAAe,EAAEC,SAAS,EAAEC,UAAU,EAAE,GAAGJ;IACnE,IACE,CAACK,OAAO,QAAQ,CAACF,cAAcA,aAAa,KACzC,CAACE,OAAO,QAAQ,CAACD,eAAeA,cAAc,GAEjD,MAAM,IAAIE,WACR,CAAC,wEAAwE,EAAEH,UAAU,CAAC,EAAEC,YAAY;IAGxG,MAAMG,SAASN,iBAAiBE;IAChC,MAAMK,SAASN,kBAAkBE;IACjC,OAAO;QACL,SAASK,KAAK,GAAG,CAACF,QAAQC;QAC1B,OAAOC,KAAK,GAAG,CAACF,QAAQC;IAC1B;AACF;AAQO,SAASE,aACd,EAAEC,OAAO,EAAEC,KAAK,EAAc,EAC9BC,CAAS;IAET,OAAOF,UAAWC,AAAAA,CAAAA,QAAQD,OAAM,IAAKE;AACvC;AASO,SAASC,mBAAmBd,KAAuB;IACxD,MAAM,EAAEG,SAAS,EAAEC,UAAU,EAAEW,KAAK,EAAEC,EAAE,EAAEC,EAAE,EAAE,GAAGjB;IACjD,OAAO;QACL,SAAS,CAAEG,CAAAA,YAAYY,KAAI,IAAKC;QAChC,SAAS,CAAEZ,CAAAA,aAAaW,KAAI,IAAKE;IACnC;AACF;AA2BO,SAASC,kBACdC,WAA+B,EAC/BC,MAAc,EACdC,OAA2B;IAE3B,IAAI,CAACF,eAAeA,eAAe,GAAG,OAAO;IAC7C,MAAMG,QAAQH,cAAcC;IAC5B,IAAIE,SAAS,GAAG,OAAOD,SAAS,YAAYhB;IAC5C,MAAMU,QAAQI,cAAcG;IAC5B,OAAOD,SAAS,aAAaE,SACzBR,QACAN,KAAK,GAAG,CAACM,OAAOM,QAAQ,QAAQ;AACtC;AA+BO,SAASG,yBACdxB,KAA6B;IAE7B,MAAM,EAAEyB,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,UAAU,EAAEC,UAAU,EAAE,GAAG7B;IAC/D,OAAO;QACL,GAAGyB,SAASE,aAAaC;QACzB,GAAGF,SAASC,aAAaE;IAC3B;AACF"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,82 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/luna-stage",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Stage system and showcase components for the L.U.N.A project
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Stage system and showcase components for the L.U.N.A project",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"luna",
|
|
7
|
+
"stage",
|
|
8
|
+
"preview",
|
|
9
|
+
"react",
|
|
10
|
+
"lynx"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/lynx-family/lynx-ui/tree/main/luna/packages/luna-stage#readme",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/lynx-family/lynx-ui.git",
|
|
16
|
+
"directory": "luna/packages/luna-stage"
|
|
17
|
+
},
|
|
5
18
|
"license": "Apache-2.0",
|
|
6
19
|
"author": "The Lynx Authors",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./motion": {
|
|
28
|
+
"types": "./dist/motion/index.d.ts",
|
|
29
|
+
"import": "./dist/motion/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./lynx": {
|
|
32
|
+
"types": "./dist/lynx/index.d.ts",
|
|
33
|
+
"import": "./dist/lynx/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"main": "./dist/index.js",
|
|
37
|
+
"module": "./dist/index.js",
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
7
39
|
"files": [
|
|
8
|
-
"
|
|
9
|
-
"LICENSE"
|
|
40
|
+
"dist",
|
|
41
|
+
"LICENSE",
|
|
42
|
+
"README.md"
|
|
10
43
|
],
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@lynx-js/luna-core": "0.2.2"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@lynx-js/web-core": "0.23.0",
|
|
49
|
+
"@rsbuild/plugin-react": "2.1.0",
|
|
50
|
+
"@rslib/core": "0.23.2",
|
|
51
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
52
|
+
"@testing-library/react": "16.3.2",
|
|
53
|
+
"@types/react": "^18.3.8",
|
|
54
|
+
"@types/react-dom": "^18.3.5",
|
|
55
|
+
"jsdom": "^25.0.1",
|
|
56
|
+
"motion": "12.42.2",
|
|
57
|
+
"react": "^18.3.1",
|
|
58
|
+
"react-dom": "^18.3.1",
|
|
59
|
+
"typescript": "^5.8.0",
|
|
60
|
+
"vitest": "2.1.9"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@lynx-js/web-core": ">=0.20.0",
|
|
64
|
+
"motion": ">=12.23.16",
|
|
65
|
+
"react": ">=18.0.0"
|
|
66
|
+
},
|
|
67
|
+
"peerDependenciesMeta": {
|
|
68
|
+
"@lynx-js/web-core": {
|
|
69
|
+
"optional": true
|
|
70
|
+
},
|
|
71
|
+
"motion": {
|
|
72
|
+
"optional": true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
11
75
|
"publishConfig": {
|
|
12
76
|
"access": "public"
|
|
77
|
+
},
|
|
78
|
+
"scripts": {
|
|
79
|
+
"build": "rslib build",
|
|
80
|
+
"test": "vitest run"
|
|
13
81
|
}
|
|
14
|
-
}
|
|
82
|
+
}
|