nucleus-core-ts 0.10.184 → 0.10.185

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.
Files changed (105) hide show
  1. package/dist/.build-ok +1 -1
  2. package/dist/fe/components/DemoFilm/_components/Caption/index.d.ts +11 -0
  3. package/dist/fe/components/DemoFilm/_components/Caption/index.js +42 -0
  4. package/dist/fe/components/DemoFilm/_components/DemoFilmRoot/index.d.ts +15 -0
  5. package/dist/fe/components/DemoFilm/_components/DemoFilmRoot/index.js +26 -0
  6. package/dist/fe/components/DemoFilm/_components/DeviceFrame/BrowserBar.d.ts +8 -0
  7. package/dist/fe/components/DemoFilm/_components/DeviceFrame/BrowserBar.js +50 -0
  8. package/dist/fe/components/DemoFilm/_components/DeviceFrame/Island.d.ts +5 -0
  9. package/dist/fe/components/DemoFilm/_components/DeviceFrame/Island.js +16 -0
  10. package/dist/fe/components/DemoFilm/_components/DeviceFrame/index.d.ts +11 -0
  11. package/dist/fe/components/DemoFilm/_components/DeviceFrame/index.js +46 -0
  12. package/dist/fe/components/DemoFilm/_components/FilmImage/index.d.ts +11 -0
  13. package/dist/fe/components/DemoFilm/_components/FilmImage/index.js +14 -0
  14. package/dist/fe/components/DemoFilm/_components/FilmPlayer/index.d.ts +25 -0
  15. package/dist/fe/components/DemoFilm/_components/FilmPlayer/index.js +86 -0
  16. package/dist/fe/components/DemoFilm/_components/Highlight/index.d.ts +13 -0
  17. package/dist/fe/components/DemoFilm/_components/Highlight/index.js +62 -0
  18. package/dist/fe/components/DemoFilm/_components/RoleStage/Body.d.ts +14 -0
  19. package/dist/fe/components/DemoFilm/_components/RoleStage/Body.js +67 -0
  20. package/dist/fe/components/DemoFilm/_components/RoleStage/RoleLabel.d.ts +10 -0
  21. package/dist/fe/components/DemoFilm/_components/RoleStage/RoleLabel.js +30 -0
  22. package/dist/fe/components/DemoFilm/_components/RoleStage/index.d.ts +8 -0
  23. package/dist/fe/components/DemoFilm/_components/RoleStage/index.js +36 -0
  24. package/dist/fe/components/DemoFilm/_components/ScreenImage/index.d.ts +11 -0
  25. package/dist/fe/components/DemoFilm/_components/ScreenImage/index.js +58 -0
  26. package/dist/fe/components/DemoFilm/_components/index.d.ts +8 -0
  27. package/dist/fe/components/DemoFilm/_components/index.js +8 -0
  28. package/dist/fe/components/DemoFilm/_hooks/index.d.ts +5 -0
  29. package/dist/fe/components/DemoFilm/_hooks/index.js +5 -0
  30. package/dist/fe/components/DemoFilm/_hooks/useDemoBeat.d.ts +3 -0
  31. package/dist/fe/components/DemoFilm/_hooks/useDemoBeat.js +24 -0
  32. package/dist/fe/components/DemoFilm/_hooks/useDemoFilm.d.ts +4 -0
  33. package/dist/fe/components/DemoFilm/_hooks/useDemoFilm.js +7 -0
  34. package/dist/fe/components/DemoFilm/_hooks/useFilmClock.d.ts +4 -0
  35. package/dist/fe/components/DemoFilm/_hooks/useFilmClock.js +7 -0
  36. package/dist/fe/components/DemoFilm/_hooks/usePlayback.d.ts +25 -0
  37. package/dist/fe/components/DemoFilm/_hooks/usePlayback.js +102 -0
  38. package/dist/fe/components/DemoFilm/_hooks/useReducedMotion.d.ts +2 -0
  39. package/dist/fe/components/DemoFilm/_hooks/useReducedMotion.js +14 -0
  40. package/dist/fe/components/DemoFilm/_host/index.d.ts +2 -0
  41. package/dist/fe/components/DemoFilm/_host/index.js +2 -0
  42. package/dist/fe/components/DemoFilm/_host/mountDemoFilmHost.d.ts +9 -0
  43. package/dist/fe/components/DemoFilm/_host/mountDemoFilmHost.js +60 -0
  44. package/dist/fe/components/DemoFilm/_host/types.d.ts +35 -0
  45. package/dist/fe/components/DemoFilm/_host/types.js +1 -0
  46. package/dist/fe/components/DemoFilm/_types/clock.d.ts +31 -0
  47. package/dist/fe/components/DemoFilm/_types/clock.js +1 -0
  48. package/dist/fe/components/DemoFilm/_types/device.d.ts +18 -0
  49. package/dist/fe/components/DemoFilm/_types/device.js +1 -0
  50. package/dist/fe/components/DemoFilm/_types/index.d.ts +6 -0
  51. package/dist/fe/components/DemoFilm/_types/index.js +6 -0
  52. package/dist/fe/components/DemoFilm/_types/player.d.ts +25 -0
  53. package/dist/fe/components/DemoFilm/_types/player.js +1 -0
  54. package/dist/fe/components/DemoFilm/_types/stage.d.ts +28 -0
  55. package/dist/fe/components/DemoFilm/_types/stage.js +1 -0
  56. package/dist/fe/components/DemoFilm/_types/theme.d.ts +38 -0
  57. package/dist/fe/components/DemoFilm/_types/theme.js +1 -0
  58. package/dist/fe/components/DemoFilm/_types/timeline.d.ts +49 -0
  59. package/dist/fe/components/DemoFilm/_types/timeline.js +5 -0
  60. package/dist/fe/components/DemoFilm/_utils/demoAssetUrl.d.ts +5 -0
  61. package/dist/fe/components/DemoFilm/_utils/demoAssetUrl.js +6 -0
  62. package/dist/fe/components/DemoFilm/_utils/device.d.ts +7 -0
  63. package/dist/fe/components/DemoFilm/_utils/device.js +50 -0
  64. package/dist/fe/components/DemoFilm/_utils/easing.d.ts +6 -0
  65. package/dist/fe/components/DemoFilm/_utils/easing.js +71 -0
  66. package/dist/fe/components/DemoFilm/_utils/index.d.ts +10 -0
  67. package/dist/fe/components/DemoFilm/_utils/index.js +10 -0
  68. package/dist/fe/components/DemoFilm/_utils/interpolate.d.ts +14 -0
  69. package/dist/fe/components/DemoFilm/_utils/interpolate.js +46 -0
  70. package/dist/fe/components/DemoFilm/_utils/motion.d.ts +6 -0
  71. package/dist/fe/components/DemoFilm/_utils/motion.js +19 -0
  72. package/dist/fe/components/DemoFilm/_utils/spring.d.ts +24 -0
  73. package/dist/fe/components/DemoFilm/_utils/spring.js +73 -0
  74. package/dist/fe/components/DemoFilm/_utils/stageSize.d.ts +9 -0
  75. package/dist/fe/components/DemoFilm/_utils/stageSize.js +19 -0
  76. package/dist/fe/components/DemoFilm/_utils/text.d.ts +3 -0
  77. package/dist/fe/components/DemoFilm/_utils/text.js +3 -0
  78. package/dist/fe/components/DemoFilm/_utils/theme.d.ts +7 -0
  79. package/dist/fe/components/DemoFilm/_utils/theme.js +137 -0
  80. package/dist/fe/components/DemoFilm/_utils/timeline.d.ts +13 -0
  81. package/dist/fe/components/DemoFilm/_utils/timeline.js +32 -0
  82. package/dist/fe/components/DemoFilm/index.d.ts +4 -0
  83. package/dist/fe/components/DemoFilm/index.js +4 -0
  84. package/dist/fe/index.d.ts +1 -0
  85. package/dist/fe/index.js +1 -0
  86. package/dist/index.js +6 -6
  87. package/dist/server.js +3 -3
  88. package/dist/src/Nucleus/routes/auth/sessionPools.d.ts +16 -0
  89. package/dist/src/Nucleus/routes/tenant/selfSignupRateLimit.d.ts +19 -0
  90. package/dist/src/Nucleus/routes/tenant/types.d.ts +3 -0
  91. package/dist/src/types.d.ts +2 -0
  92. package/package.json +21 -3
  93. package/scripts/demo-film/chrome.ts +75 -0
  94. package/scripts/demo-film/encoder.ts +99 -0
  95. package/scripts/demo-film/film.testkit.tsx +23 -0
  96. package/scripts/demo-film/frames.ts +47 -0
  97. package/scripts/demo-film/index.ts +17 -0
  98. package/scripts/demo-film/mp4.ts +62 -0
  99. package/scripts/demo-film/pageGlobals.d.ts +21 -0
  100. package/scripts/demo-film/render.test.ts +133 -0
  101. package/scripts/demo-film/renderFilm.ts +53 -0
  102. package/scripts/demo-film/renderStill.ts +30 -0
  103. package/scripts/demo-film/session.ts +66 -0
  104. package/scripts/demo-film/site.ts +97 -0
  105. package/scripts/demo-film/types.ts +63 -0
package/dist/.build-ok CHANGED
@@ -1 +1 @@
1
- 0.10.184
1
+ 0.10.185
@@ -0,0 +1,11 @@
1
+ interface DemoFilmCaptionProps {
2
+ text: string;
3
+ /** Font size in px. */
4
+ size: number;
5
+ /** Frames since the beat started. */
6
+ localFrame: number;
7
+ delay?: number;
8
+ }
9
+ /** A beat's caption: set in the display face, each word rising into place one after the other. */
10
+ export declare function DemoFilmCaption({ text, size, localFrame, delay }: DemoFilmCaptionProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { interpolate } from '../../_utils/interpolate';
3
+ import { FILM_PASS } from '../../_utils/motion';
4
+ /** A beat's caption: set in the display face, each word rising into place one after the other. */ export function DemoFilmCaption({ text, size, localFrame, delay = 6 }) {
5
+ const words = text.split(' ').map((word, i, all)=>({
6
+ word,
7
+ at: all.slice(0, i).join(' ').length
8
+ }));
9
+ return /*#__PURE__*/ _jsx("p", {
10
+ style: {
11
+ margin: 0,
12
+ fontFamily: 'var(--film-display)',
13
+ fontWeight: 500,
14
+ fontSize: size,
15
+ lineHeight: 1.14,
16
+ letterSpacing: '-0.02em',
17
+ color: 'var(--film-ink)'
18
+ },
19
+ children: words.map(({ word, at }, i)=>{
20
+ const t = interpolate(localFrame, [
21
+ delay + i * 2.5,
22
+ delay + i * 2.5 + 14
23
+ ], [
24
+ 0,
25
+ 1
26
+ ], {
27
+ extrapolateLeft: 'clamp',
28
+ extrapolateRight: 'clamp',
29
+ easing: FILM_PASS
30
+ });
31
+ return /*#__PURE__*/ _jsx("span", {
32
+ style: {
33
+ display: 'inline-block',
34
+ opacity: t,
35
+ transform: `translateY(${(1 - t) * size * 0.35}px)`,
36
+ marginRight: '0.26em'
37
+ },
38
+ children: word
39
+ }, at);
40
+ })
41
+ });
42
+ }
@@ -0,0 +1,15 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { DemoFilmThemeOverride, DemoTheme } from '../../_types';
3
+ interface DemoFilmRootProps {
4
+ theme: DemoTheme;
5
+ /** Palette and fonts to use instead of the defaults. */
6
+ config?: DemoFilmThemeOverride;
7
+ children: ReactNode;
8
+ }
9
+ /**
10
+ * The film's root: paints the palette and the three faces as `--film-*` CSS variables for the
11
+ * timeline's theme. The host loads the font files (a page through its CSS, the MP4 renderer through
12
+ * the `loadFonts` of its composition entry).
13
+ */
14
+ export declare function DemoFilmRoot({ theme, config, children }: DemoFilmRootProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { demoFilmCss, resolveDemoFilmTheme } from '../../_utils/theme';
3
+ /**
4
+ * The film's root: paints the palette and the three faces as `--film-*` CSS variables for the
5
+ * timeline's theme. The host loads the font files (a page through its CSS, the MP4 renderer through
6
+ * the `loadFonts` of its composition entry).
7
+ */ export function DemoFilmRoot({ theme, config, children }) {
8
+ return /*#__PURE__*/ _jsxs("div", {
9
+ className: "nc-demo-film",
10
+ "data-theme": theme,
11
+ style: {
12
+ position: 'absolute',
13
+ inset: 0,
14
+ overflow: 'hidden',
15
+ background: 'var(--film-bg)',
16
+ color: 'var(--film-ink)',
17
+ fontFamily: 'var(--film-sans)'
18
+ },
19
+ children: [
20
+ /*#__PURE__*/ _jsx("style", {
21
+ children: demoFilmCss(resolveDemoFilmTheme(config))
22
+ }),
23
+ children
24
+ ]
25
+ });
26
+ }
@@ -0,0 +1,8 @@
1
+ interface BrowserBarProps {
2
+ address: string;
3
+ height: number;
4
+ width: number;
5
+ }
6
+ /** A browser window's title bar: three dots and the address pill. */
7
+ export declare function BrowserBar({ address, height, width }: BrowserBarProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const DOTS = [
3
+ '#ee6a5f',
4
+ '#f4be4f',
5
+ '#61c554'
6
+ ];
7
+ /** A browser window's title bar: three dots and the address pill. */ export function BrowserBar({ address, height, width }) {
8
+ const dot = height * 0.3;
9
+ return /*#__PURE__*/ _jsxs("div", {
10
+ style: {
11
+ position: 'absolute',
12
+ left: 0,
13
+ top: 0,
14
+ width,
15
+ height,
16
+ display: 'flex',
17
+ alignItems: 'center',
18
+ gap: dot * 0.7,
19
+ paddingLeft: height * 0.4
20
+ },
21
+ children: [
22
+ DOTS.map((color)=>/*#__PURE__*/ _jsx("span", {
23
+ style: {
24
+ width: dot,
25
+ height: dot,
26
+ borderRadius: '50%',
27
+ background: color,
28
+ opacity: 0.85
29
+ }
30
+ }, color)),
31
+ address !== '' && /*#__PURE__*/ _jsx("span", {
32
+ style: {
33
+ marginLeft: height * 0.4,
34
+ height: height * 0.62,
35
+ width: Math.min(width * 0.42, height * 14),
36
+ borderRadius: height * 0.31,
37
+ background: 'var(--film-bg)',
38
+ color: 'var(--film-faint)',
39
+ fontFamily: 'var(--film-mono)',
40
+ fontSize: height * 0.36,
41
+ display: 'flex',
42
+ alignItems: 'center',
43
+ paddingLeft: height * 0.4,
44
+ whiteSpace: 'nowrap'
45
+ },
46
+ children: address
47
+ })
48
+ ]
49
+ });
50
+ }
@@ -0,0 +1,5 @@
1
+ /** The phone's camera island, sized from the screen width. */
2
+ export declare function Island({ width, pad }: {
3
+ width: number;
4
+ pad: number;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /** The phone's camera island, sized from the screen width. */ export function Island({ width, pad }) {
3
+ return /*#__PURE__*/ _jsx("div", {
4
+ style: {
5
+ position: 'absolute',
6
+ top: pad + width * 0.025,
7
+ left: '50%',
8
+ width: width * 0.26,
9
+ height: width * 0.07,
10
+ marginLeft: -width * 0.13,
11
+ borderRadius: width * 0.04,
12
+ background: 'var(--film-bezel)',
13
+ zIndex: 2
14
+ }
15
+ });
16
+ }
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { DeviceFit } from '../../_types';
3
+ interface DeviceFrameProps {
4
+ fit: DeviceFit;
5
+ /** The address shown in a browser window's bar. */
6
+ address?: string;
7
+ children: ReactNode;
8
+ }
9
+ /** Device chrome by kind: a phone, a tablet or a browser window around the screen (`children`). */
10
+ export declare function DeviceFrame({ fit, address, children }: DeviceFrameProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BrowserBar } from './BrowserBar';
3
+ import { Island } from './Island';
4
+ /** Device chrome by kind: a phone, a tablet or a browser window around the screen (`children`). */ export function DeviceFrame({ fit, address = '', children }) {
5
+ const { chrome, screenWidth, screenHeight, width, height } = fit;
6
+ const browser = chrome.kind === 'browser';
7
+ const outer = {
8
+ position: 'relative',
9
+ width,
10
+ height,
11
+ borderRadius: chrome.radius + chrome.pad * (browser ? 0 : 0.6),
12
+ boxShadow: 'var(--film-shadow)',
13
+ background: browser ? 'var(--film-surface2)' : 'var(--film-bezel)',
14
+ border: browser ? '1px solid var(--film-line)' : '1px solid var(--film-bezel-line)',
15
+ overflow: 'hidden',
16
+ flex: 'none'
17
+ };
18
+ const screen = {
19
+ position: 'absolute',
20
+ left: chrome.pad,
21
+ top: chrome.top,
22
+ width: screenWidth,
23
+ height: screenHeight,
24
+ borderRadius: browser ? 0 : chrome.radius,
25
+ overflow: 'hidden',
26
+ background: '#fff'
27
+ };
28
+ return /*#__PURE__*/ _jsxs("div", {
29
+ style: outer,
30
+ children: [
31
+ browser && /*#__PURE__*/ _jsx(BrowserBar, {
32
+ address: address,
33
+ height: chrome.top,
34
+ width: width
35
+ }),
36
+ chrome.kind === 'phone' && /*#__PURE__*/ _jsx(Island, {
37
+ width: screenWidth,
38
+ pad: chrome.pad
39
+ }),
40
+ /*#__PURE__*/ _jsx("div", {
41
+ style: screen,
42
+ children: children
43
+ })
44
+ ]
45
+ });
46
+ }
@@ -0,0 +1,11 @@
1
+ import type { CSSProperties } from 'react';
2
+ interface FilmImageProps {
3
+ src: string;
4
+ style?: CSSProperties;
5
+ }
6
+ /**
7
+ * A decorative capture. Decoded synchronously with the paint so a seek never shows a half-loaded
8
+ * picture; the renderer additionally waits for every `<img>` to decode before it grabs a frame.
9
+ */
10
+ export declare function FilmImage({ src, style }: FilmImageProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ /**
4
+ * A decorative capture. Decoded synchronously with the paint so a seek never shows a half-loaded
5
+ * picture; the renderer additionally waits for every `<img>` to decode before it grabs a frame.
6
+ */ export function FilmImage({ src, style }) {
7
+ return /*#__PURE__*/ _jsx("img", {
8
+ src: src,
9
+ alt: "",
10
+ decoding: "sync",
11
+ draggable: false,
12
+ style: style
13
+ });
14
+ }
@@ -0,0 +1,25 @@
1
+ import { type ComponentType, type CSSProperties, type Ref } from 'react';
2
+ import type { FilmPlayerHandle } from '../../_types';
3
+ export interface FilmPlayerProps<P extends object> {
4
+ ref?: Ref<FilmPlayerHandle>;
5
+ /** The composition: a component that paints a frame from the film clock and its props. */
6
+ component: ComponentType<P>;
7
+ inputProps: P;
8
+ durationInFrames: number;
9
+ fps: number;
10
+ compositionWidth: number;
11
+ compositionHeight: number;
12
+ initialFrame?: number;
13
+ /** 1 is real time. */
14
+ playbackRate?: number;
15
+ /** Starts on mount, unless the visitor prefers reduced motion. */
16
+ autoPlay?: boolean;
17
+ className?: string;
18
+ style?: CSSProperties;
19
+ }
20
+ /**
21
+ * Plays a composition in a box: the composition is laid out at its own pixel size and scaled to the
22
+ * box width (the box keeps the composition's aspect ratio). It has no controls of its own; the
23
+ * ref's handle plays, pauses and seeks, and `subscribe` reports frames and state changes.
24
+ */
25
+ export declare function FilmPlayer<P extends object>({ ref, component, inputProps, durationInFrames, fps, compositionWidth, compositionHeight, initialFrame, playbackRate, autoPlay, className, style, }: FilmPlayerProps<P>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,86 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createElement, useEffect, useEffectEvent, useImperativeHandle, useRef, useState } from 'react';
4
+ import { FilmClockContext } from '../../_hooks/useFilmClock';
5
+ import { usePlayback } from '../../_hooks/usePlayback';
6
+ import { useReducedMotion } from '../../_hooks/useReducedMotion';
7
+ /**
8
+ * Plays a composition in a box: the composition is laid out at its own pixel size and scaled to the
9
+ * box width (the box keeps the composition's aspect ratio). It has no controls of its own; the
10
+ * ref's handle plays, pauses and seeks, and `subscribe` reports frames and state changes.
11
+ */ export function FilmPlayer({ ref, component, inputProps, durationInFrames, fps, compositionWidth, compositionHeight, initialFrame = 0, playbackRate = 1, autoPlay = false, className, style }) {
12
+ const reduced = useReducedMotion();
13
+ const listeners = useRef(new Set());
14
+ const box = useRef(null);
15
+ const [scale, setScale] = useState(0);
16
+ const playback = usePlayback({
17
+ durationInFrames,
18
+ fps,
19
+ rate: playbackRate,
20
+ initialFrame,
21
+ autoPlay: autoPlay && !reduced,
22
+ emit: (event)=>{
23
+ for (const listener of listeners.current)listener(event);
24
+ }
25
+ });
26
+ useImperativeHandle(ref, ()=>({
27
+ play: playback.play,
28
+ pause: playback.pause,
29
+ seekTo: playback.seekTo,
30
+ getCurrentFrame: ()=>playback.frame,
31
+ isPlaying: playback.isPlaying,
32
+ subscribe: (listener)=>{
33
+ listeners.current.add(listener);
34
+ return ()=>{
35
+ listeners.current.delete(listener);
36
+ };
37
+ }
38
+ }));
39
+ const measure = useEffectEvent(()=>{
40
+ const element = box.current;
41
+ if (element !== null) setScale(element.clientWidth / compositionWidth);
42
+ });
43
+ useEffect(()=>{
44
+ const element = box.current;
45
+ if (element === null) return undefined;
46
+ const observer = new ResizeObserver(()=>measure());
47
+ observer.observe(element);
48
+ measure();
49
+ return ()=>observer.disconnect();
50
+ }, [
51
+ compositionWidth
52
+ ]);
53
+ const clock = {
54
+ frame: playback.frame,
55
+ fps,
56
+ durationInFrames,
57
+ width: compositionWidth,
58
+ height: compositionHeight
59
+ };
60
+ return /*#__PURE__*/ _jsx("div", {
61
+ ref: box,
62
+ className: className,
63
+ style: {
64
+ position: 'relative',
65
+ width: '100%',
66
+ aspectRatio: `${compositionWidth} / ${compositionHeight}`,
67
+ overflow: 'hidden',
68
+ ...style
69
+ },
70
+ children: scale > 0 && /*#__PURE__*/ _jsx("div", {
71
+ style: {
72
+ position: 'absolute',
73
+ left: 0,
74
+ top: 0,
75
+ width: compositionWidth,
76
+ height: compositionHeight,
77
+ transform: `scale(${scale})`,
78
+ transformOrigin: '0 0'
79
+ },
80
+ children: /*#__PURE__*/ _jsx(FilmClockContext.Provider, {
81
+ value: clock,
82
+ children: /*#__PURE__*/ createElement(component, inputProps)
83
+ })
84
+ })
85
+ });
86
+ }
@@ -0,0 +1,13 @@
1
+ import type { DemoBox } from '../../_types';
2
+ interface DemoFilmHighlightProps {
3
+ box: DemoBox;
4
+ /** Screen pixels per image CSS pixel. */
5
+ scale: number;
6
+ localFrame: number;
7
+ fps: number;
8
+ /** Dim everything around the box (the focus screen); small thumbnails only draw the ring. */
9
+ spotlight: boolean;
10
+ }
11
+ /** The beat's highlight box: an accent ring that pops in, a soft spotlight and a slow pulse. */
12
+ export declare function DemoFilmHighlight({ box, scale, localFrame, fps, spotlight, }: DemoFilmHighlightProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { interpolate } from '../../_utils/interpolate';
3
+ import { filmReveal } from '../../_utils/motion';
4
+ import { spring } from '../../_utils/spring';
5
+ const GLOW = (share)=>`color-mix(in srgb, var(--film-accent) ${share}%, transparent)`;
6
+ /** The beat's highlight box: an accent ring that pops in, a soft spotlight and a slow pulse. */ export function DemoFilmHighlight({ box, scale, localFrame, fps, spotlight }) {
7
+ const delay = 10;
8
+ const pop = spring({
9
+ frame: localFrame - delay,
10
+ fps,
11
+ config: {
12
+ damping: 16,
13
+ stiffness: 140,
14
+ mass: 0.7
15
+ }
16
+ });
17
+ const fade = filmReveal(localFrame, delay, 10);
18
+ const pulse = (localFrame - delay) % 48 / 48;
19
+ const ring = Math.max(2, 3.5 * Math.min(1, scale * 1.6));
20
+ const grow = interpolate(pop, [
21
+ 0,
22
+ 1
23
+ ], [
24
+ 14,
25
+ 0
26
+ ]);
27
+ const x = box.x * scale - grow;
28
+ const y = box.y * scale - grow;
29
+ const w = box.w * scale + grow * 2;
30
+ const h = box.h * scale + grow * 2;
31
+ return /*#__PURE__*/ _jsxs(_Fragment, {
32
+ children: [
33
+ /*#__PURE__*/ _jsx("div", {
34
+ style: {
35
+ position: 'absolute',
36
+ left: x,
37
+ top: y,
38
+ width: w,
39
+ height: h,
40
+ borderRadius: 12 * Math.min(1, scale * 1.5),
41
+ border: `${ring}px solid var(--film-accent)`,
42
+ opacity: fade,
43
+ boxShadow: spotlight ? `0 0 0 4000px rgba(12, 14, 12, ${0.42 * fade}), 0 0 ${24 * fade}px ${GLOW(55)}` : `0 0 8px ${GLOW(60)}`,
44
+ pointerEvents: 'none'
45
+ }
46
+ }),
47
+ localFrame > delay && /*#__PURE__*/ _jsx("div", {
48
+ style: {
49
+ position: 'absolute',
50
+ left: x - pulse * 16,
51
+ top: y - pulse * 16,
52
+ width: w + pulse * 32,
53
+ height: h + pulse * 32,
54
+ borderRadius: 12 + pulse * 12,
55
+ border: `${Math.max(1, ring * 0.5)}px solid var(--film-accent)`,
56
+ opacity: (1 - pulse) * 0.55 * fade,
57
+ pointerEvents: 'none'
58
+ }
59
+ })
60
+ ]
61
+ });
62
+ }
@@ -0,0 +1,14 @@
1
+ import type { DemoText, DeviceKind } from '../../_types';
2
+ interface BodyProps {
3
+ role: string;
4
+ kind: DeviceKind;
5
+ address: string;
6
+ label: DemoText | undefined;
7
+ width: number;
8
+ height: number;
9
+ compact: boolean;
10
+ embedded: boolean;
11
+ }
12
+ /** The device, its label or caption band, laid out inside the stage box. */
13
+ export declare function Body({ role, kind, address, label, width, height, compact, embedded }: BodyProps): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useDemoBeat } from '../../_hooks/useDemoBeat';
3
+ import { useDemoFilm } from '../../_hooks/useDemoFilm';
4
+ import { fitDevice } from '../../_utils/device';
5
+ import { pickDemoText } from '../../_utils/text';
6
+ import { DemoFilmCaption } from '../Caption';
7
+ import { DeviceFrame } from '../DeviceFrame';
8
+ import { DemoFilmScreen } from '../ScreenImage';
9
+ import { RoleLabel } from './RoleLabel';
10
+ /** The device, its label or caption band, laid out inside the stage box. */ export function Body({ role, kind, address, label, width, height, compact, embedded }) {
11
+ const { timeline, locale } = useDemoFilm();
12
+ const { beat, localFrame } = useDemoBeat();
13
+ const viewport = timeline.viewports[role];
14
+ if (viewport === undefined) throw new Error(`The timeline has no viewport for "${role}"`);
15
+ const captionH = compact || embedded ? 0 : Math.round(height * 0.17);
16
+ const labelH = compact ? Math.round(Math.max(18, width * 0.1)) : 0;
17
+ const gap = captionH > 0 ? 16 : 0;
18
+ const fit = fitDevice(kind, viewport, width - 8, height - captionH - labelH - gap - 8);
19
+ return /*#__PURE__*/ _jsxs("div", {
20
+ style: {
21
+ position: 'relative',
22
+ width,
23
+ height,
24
+ display: 'flex',
25
+ flexDirection: 'column',
26
+ alignItems: 'center',
27
+ justifyContent: 'center',
28
+ gap
29
+ },
30
+ children: [
31
+ /*#__PURE__*/ _jsx("div", {
32
+ style: {
33
+ flex: compact ? 1 : 'none',
34
+ display: 'flex',
35
+ alignItems: 'center'
36
+ },
37
+ children: /*#__PURE__*/ _jsx(DeviceFrame, {
38
+ fit: fit,
39
+ address: address,
40
+ children: /*#__PURE__*/ _jsx(DemoFilmScreen, {
41
+ role: role,
42
+ screenWidth: fit.screenWidth,
43
+ spotlight: !compact
44
+ })
45
+ })
46
+ }),
47
+ compact && /*#__PURE__*/ _jsx(RoleLabel, {
48
+ text: label === undefined ? role : pickDemoText(label, locale),
49
+ height: labelH,
50
+ fresh: beat.frames[role] !== undefined,
51
+ localFrame: localFrame
52
+ }),
53
+ captionH > 0 && /*#__PURE__*/ _jsx("div", {
54
+ style: {
55
+ height: captionH,
56
+ width: Math.min(width * 0.9, 1200),
57
+ textAlign: 'center'
58
+ },
59
+ children: /*#__PURE__*/ _jsx(DemoFilmCaption, {
60
+ text: pickDemoText(beat.caption, locale),
61
+ size: Math.round(captionH * 0.3),
62
+ localFrame: localFrame
63
+ })
64
+ })
65
+ ]
66
+ });
67
+ }
@@ -0,0 +1,10 @@
1
+ interface RoleLabelProps {
2
+ text: string;
3
+ height: number;
4
+ /** True in the beat that brought this role a new capture: the dot glows. */
5
+ fresh: boolean;
6
+ localFrame: number;
7
+ }
8
+ /** The name under a thumbnail, with a dot that lights up when the role's screen just changed. */
9
+ export declare function RoleLabel({ text, height, fresh, localFrame }: RoleLabelProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const GLOW_FRAMES = 36;
3
+ /** The name under a thumbnail, with a dot that lights up when the role's screen just changed. */ export function RoleLabel({ text, height, fresh, localFrame }) {
4
+ const glow = fresh ? Math.max(0, 1 - localFrame / GLOW_FRAMES) : 0;
5
+ return /*#__PURE__*/ _jsxs("div", {
6
+ style: {
7
+ height,
8
+ display: 'flex',
9
+ alignItems: 'center',
10
+ gap: height * 0.4,
11
+ fontFamily: 'var(--film-mono)',
12
+ fontSize: height * 0.62,
13
+ letterSpacing: '0.08em',
14
+ textTransform: 'uppercase',
15
+ color: 'var(--film-soft)'
16
+ },
17
+ children: [
18
+ /*#__PURE__*/ _jsx("span", {
19
+ style: {
20
+ width: height * 0.4,
21
+ height: height * 0.4,
22
+ borderRadius: '50%',
23
+ background: fresh ? 'var(--film-accent)' : 'var(--film-line)',
24
+ boxShadow: `0 0 ${height * 0.9 * glow}px color-mix(in srgb, var(--film-accent) ${Math.round(glow * 100)}%, transparent)`
25
+ }
26
+ }),
27
+ text
28
+ ]
29
+ });
30
+ }
@@ -0,0 +1,8 @@
1
+ import type { RoleStageProps } from '../../_types';
2
+ /**
3
+ * One role's screen at the current frame: its device (phone, tablet or browser window), the latest
4
+ * capture with a crossfade on change, the highlight ring with its spotlight and the beat's caption.
5
+ * Plain React on the film clock, so the MP4 render and a page's `FilmPlayer` play the same component.
6
+ * Generic over the product's role names; colours and fonts come from the `theme` prop.
7
+ */
8
+ export declare function RoleStage<Role extends string>({ timeline, role, assetBase, locale, devices, addresses, labels, theme, box, embedded, compact, }: RoleStageProps<Role>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { DemoFilmContext } from '../../_hooks/useDemoFilm';
3
+ import { useFilmClock } from '../../_hooks/useFilmClock';
4
+ import { DemoFilmRoot } from '../DemoFilmRoot';
5
+ import { Body } from './Body';
6
+ /**
7
+ * One role's screen at the current frame: its device (phone, tablet or browser window), the latest
8
+ * capture with a crossfade on change, the highlight ring with its spotlight and the beat's caption.
9
+ * Plain React on the film clock, so the MP4 render and a page's `FilmPlayer` play the same component.
10
+ * Generic over the product's role names; colours and fonts come from the `theme` prop.
11
+ */ export function RoleStage({ timeline, role, assetBase, locale, devices = {}, addresses = {}, labels = {}, theme, box, embedded = false, compact = false }) {
12
+ const video = useFilmClock();
13
+ const value = {
14
+ timeline,
15
+ assetBase,
16
+ locale: locale ?? timeline.locale
17
+ };
18
+ const body = /*#__PURE__*/ _jsx(Body, {
19
+ role: role,
20
+ kind: devices[role] ?? 'browser',
21
+ address: addresses[role] ?? '',
22
+ label: labels[role],
23
+ width: box?.width ?? video.width,
24
+ height: box?.height ?? video.height,
25
+ compact: compact,
26
+ embedded: embedded
27
+ });
28
+ return /*#__PURE__*/ _jsx(DemoFilmContext.Provider, {
29
+ value: value,
30
+ children: embedded ? body : /*#__PURE__*/ _jsx(DemoFilmRoot, {
31
+ theme: timeline.theme,
32
+ config: theme,
33
+ children: body
34
+ })
35
+ });
36
+ }
@@ -0,0 +1,11 @@
1
+ interface DemoFilmScreenProps {
2
+ role: string;
3
+ screenWidth: number;
4
+ spotlight: boolean;
5
+ }
6
+ /**
7
+ * What a role's screen shows now: its latest capture, crossfaded from the previous one when this
8
+ * beat brought a new capture, with the beat's highlight ring on top (only in the beat that captured it).
9
+ */
10
+ export declare function DemoFilmScreen({ role, screenWidth, spotlight }: DemoFilmScreenProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};