nucleus-core-ts 0.10.251 → 0.10.252
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.build-ok +1 -1
- package/dist/fe/components/Replay/_components/ReplayStage/index.d.ts +2 -1
- package/dist/fe/components/Replay/_components/ReplayStage/index.js +4 -2
- package/dist/fe/components/Replay/_hooks/useStageScale.js +2 -1
- package/dist/fe/components/Replay/_utils/index.d.ts +1 -0
- package/dist/fe/components/Replay/_utils/index.js +1 -0
- package/dist/fe/components/Replay/_utils/replayLayout.d.ts +5 -2
- package/dist/fe/components/Replay/_utils/replayLayout.js +7 -5
- package/dist/fe/components/Replay/_utils/stageViewport.d.ts +17 -0
- package/dist/fe/components/Replay/_utils/stageViewport.js +17 -0
- package/package.json +1 -1
package/dist/.build-ok
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.10.
|
|
1
|
+
0.10.252
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReplayStageProps } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* The product in a same-origin iframe
|
|
3
|
+
* The product in a same-origin iframe laid out at a virtual desktop viewport (see stageViewport) and scaled uniformly to
|
|
4
|
+
* the width of the box it sits in, so it always keeps its desktop layout. The
|
|
4
5
|
* frame takes no pointer events: the visitor watches, the cursor and highlight layers above it show what happens.
|
|
5
6
|
*/
|
|
6
7
|
export declare function ReplayStage(props: ReplayStageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,14 +3,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useStageScale } from '../../_hooks/useStageScale';
|
|
4
4
|
import { REPLAY_COPY } from '../../_utils/copy';
|
|
5
5
|
import { pickLocalized } from '../../_utils/frameUrl';
|
|
6
|
+
import { stageViewport } from '../../_utils/stageViewport';
|
|
6
7
|
import { ReplayCursorLayer } from '../ReplayCursor';
|
|
7
8
|
import { ReplayVeil } from './ReplayVeil';
|
|
8
9
|
/**
|
|
9
|
-
* The product in a same-origin iframe
|
|
10
|
+
* The product in a same-origin iframe laid out at a virtual desktop viewport (see stageViewport) and scaled uniformly to
|
|
11
|
+
* the width of the box it sits in, so it always keeps its desktop layout. The
|
|
10
12
|
* frame takes no pointer events: the visitor watches, the cursor and highlight layers above it show what happens.
|
|
11
13
|
*/ export function ReplayStage(props) {
|
|
12
14
|
const { manifest, locale, frameSrc, frameRef, cursor, rate, onArrive, loading, children } = props;
|
|
13
|
-
const { width, height } = manifest.viewport;
|
|
15
|
+
const { width, height } = stageViewport(manifest.viewport);
|
|
14
16
|
const { boxRef, scale } = useStageScale(width);
|
|
15
17
|
const title = pickLocalized(manifest.title, locale);
|
|
16
18
|
return /*#__PURE__*/ _jsxs("div", {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useEffect, useEffectEvent, useRef, useState } from 'react';
|
|
3
|
+
import { fitScale } from '../_utils/stageViewport';
|
|
3
4
|
/** The scale that fits a stage of `viewportWidth` px into the width of the element the returned ref points at. */ export function useStageScale(viewportWidth) {
|
|
4
5
|
const boxRef = useRef(null);
|
|
5
6
|
const [width, setWidth] = useState(0);
|
|
@@ -16,7 +17,7 @@ import { useEffect, useEffectEvent, useRef, useState } from 'react';
|
|
|
16
17
|
observer.observe(box);
|
|
17
18
|
return ()=>observer.disconnect();
|
|
18
19
|
}, []);
|
|
19
|
-
const scale = width
|
|
20
|
+
const scale = fitScale(width, viewportWidth);
|
|
20
21
|
return {
|
|
21
22
|
boxRef,
|
|
22
23
|
scale
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Mobile-first layout: base is a small phone; each breakpoint (480, 640, 768, 1024, 1280) only overrides upward.
|
|
3
|
+
* The stage always takes the full width of the player; the caption, the controls and the chapter list sit below it.
|
|
4
|
+
*/
|
|
5
|
+
export declare const REPLAY_LAYOUT_CSS = "\n.nc-replay{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;padding:12px;box-sizing:border-box;width:100%;max-width:100%;\n background:var(--rp-bg);color:var(--rp-ink);font-family:var(--rp-sans);\n grid-template-areas:\"stage\" \"caption\" \"controls\" \"chapters\"}\n.nc-replay *,.nc-replay *::before,.nc-replay *::after{box-sizing:border-box}\n.nc-replay__stage{grid-area:stage}\n.nc-replay__caption{grid-area:caption}\n.nc-replay__controls{grid-area:controls}\n.nc-replay__chapters{grid-area:chapters}\n.nc-replay__chapter-list{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;margin:0;padding:0;list-style:none}\n@media (min-width:480px){.nc-replay{gap:14px;padding:16px}}\n@media (min-width:640px){.nc-replay__chapter-list{grid-template-columns:repeat(2,minmax(0,1fr))}}\n@media (min-width:768px){.nc-replay{gap:16px;padding:20px;grid-template-columns:minmax(0,1fr) auto;\n grid-template-areas:\"stage stage\" \"caption controls\" \"chapters chapters\"}\n .nc-replay__chapter-list{grid-template-columns:repeat(3,minmax(0,1fr))}}\n@media (min-width:1024px){.nc-replay__chapter-list{grid-template-columns:repeat(4,minmax(0,1fr))}}\n@media (min-width:1280px){.nc-replay{gap:20px;padding:28px}\n .nc-replay__chapter-list{grid-template-columns:repeat(5,minmax(0,1fr))}}\n";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Mobile-first layout: base is a small phone; each breakpoint (480, 640, 768, 1024, 1280) only overrides upward.
|
|
3
|
+
* The stage always takes the full width of the player; the caption, the controls and the chapter list sit below it.
|
|
4
|
+
*/ export const REPLAY_LAYOUT_CSS = `
|
|
2
5
|
.nc-replay{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;padding:12px;box-sizing:border-box;width:100%;max-width:100%;
|
|
3
6
|
background:var(--rp-bg);color:var(--rp-ink);font-family:var(--rp-sans);
|
|
4
7
|
grid-template-areas:"stage" "caption" "controls" "chapters"}
|
|
@@ -13,8 +16,7 @@
|
|
|
13
16
|
@media (min-width:768px){.nc-replay{gap:16px;padding:20px;grid-template-columns:minmax(0,1fr) auto;
|
|
14
17
|
grid-template-areas:"stage stage" "caption controls" "chapters chapters"}
|
|
15
18
|
.nc-replay__chapter-list{grid-template-columns:repeat(3,minmax(0,1fr))}}
|
|
16
|
-
@media (min-width:1024px){.nc-
|
|
17
|
-
|
|
18
|
-
.nc-replay__chapter-list{grid-template-columns:minmax(0,1fr)}}
|
|
19
|
-
@media (min-width:1280px){.nc-replay{gap:20px;padding:28px;grid-template-columns:minmax(0,1fr) 380px}}
|
|
19
|
+
@media (min-width:1024px){.nc-replay__chapter-list{grid-template-columns:repeat(4,minmax(0,1fr))}}
|
|
20
|
+
@media (min-width:1280px){.nc-replay{gap:20px;padding:28px}
|
|
21
|
+
.nc-replay__chapter-list{grid-template-columns:repeat(5,minmax(0,1fr))}}
|
|
20
22
|
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The virtual desktop viewport the product is rendered at: the recording is shown on its desktop layout. */
|
|
2
|
+
export declare const MIN_STAGE_VIEWPORT: {
|
|
3
|
+
readonly width: 1440;
|
|
4
|
+
readonly height: 900;
|
|
5
|
+
};
|
|
6
|
+
export interface StageViewport {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The size the frame is laid out at. A recording made in a narrow window (a phone layout, a half-screen) is still
|
|
12
|
+
* shown on the desktop layout, so each side is at least the virtual desktop; a recording taken on a bigger screen keeps
|
|
13
|
+
* its own size.
|
|
14
|
+
*/
|
|
15
|
+
export declare function stageViewport(recorded: StageViewport): StageViewport;
|
|
16
|
+
/** The uniform scale that fits a frame of `frameWidth` px into a box `boxWidth` px wide; 1 until the box is measured. */
|
|
17
|
+
export declare function fitScale(boxWidth: number, frameWidth: number): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The virtual desktop viewport the product is rendered at: the recording is shown on its desktop layout. */ export const MIN_STAGE_VIEWPORT = {
|
|
2
|
+
width: 1440,
|
|
3
|
+
height: 900
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* The size the frame is laid out at. A recording made in a narrow window (a phone layout, a half-screen) is still
|
|
7
|
+
* shown on the desktop layout, so each side is at least the virtual desktop; a recording taken on a bigger screen keeps
|
|
8
|
+
* its own size.
|
|
9
|
+
*/ export function stageViewport(recorded) {
|
|
10
|
+
return {
|
|
11
|
+
width: Math.max(MIN_STAGE_VIEWPORT.width, Math.round(recorded.width)),
|
|
12
|
+
height: Math.max(MIN_STAGE_VIEWPORT.height, Math.round(recorded.height))
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** The uniform scale that fits a frame of `frameWidth` px into a box `boxWidth` px wide; 1 until the box is measured. */ export function fitScale(boxWidth, frameWidth) {
|
|
16
|
+
return boxWidth > 0 && frameWidth > 0 ? boxWidth / frameWidth : 1;
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nucleus-core-ts",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.252",
|
|
4
4
|
"description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
|
|
5
5
|
"author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|