@four-leaf-studios/rl-overlay 1.0.0
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/index.cjs.js +10718 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm.js +10691 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/types/Overlay.d.ts +19 -0
- package/dist/types/Player.d.ts +7 -0
- package/dist/types/PlayerBoost.d.ts +8 -0
- package/dist/types/Replay.d.ts +3 -0
- package/dist/types/Scoreboard.d.ts +3 -0
- package/dist/types/ScoreboardGameBox.d.ts +7 -0
- package/dist/types/ScoreboardSeriesBox.d.ts +7 -0
- package/dist/types/ScoreboardTeam.d.ts +7 -0
- package/dist/types/StatItem.d.ts +13 -0
- package/dist/types/TargetBoost.d.ts +3 -0
- package/dist/types/TargetPlayer.d.ts +3 -0
- package/dist/types/TargetPlayerLocation.d.ts +7 -0
- package/dist/types/TargetPlayerStats.d.ts +7 -0
- package/dist/types/Team.d.ts +8 -0
- package/dist/types/Teams.d.ts +3 -0
- package/dist/types/Timer.d.ts +3 -0
- package/dist/types/context/BroadcastContext.d.ts +7 -0
- package/dist/types/hooks/index.d.ts +4 -0
- package/dist/types/hooks/useOverlayStyles.d.ts +12 -0
- package/dist/types/hooks/useReplay.d.ts +7 -0
- package/dist/types/hooks/useShowGameComponents.d.ts +2 -0
- package/dist/types/hooks/useTargetPlayer.d.ts +2 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/mockBroadcast.d.ts +18 -0
- package/package.json +50 -0
- package/rollup.config.js +55 -0
- package/src/Overlay.tsx +100 -0
- package/src/Player.tsx +31 -0
- package/src/PlayerBoost.tsx +26 -0
- package/src/Replay.tsx +18 -0
- package/src/Scoreboard.tsx +58 -0
- package/src/ScoreboardGameBox.tsx +25 -0
- package/src/ScoreboardSeriesBox.tsx +44 -0
- package/src/ScoreboardTeam.tsx +39 -0
- package/src/StatItem.tsx +31 -0
- package/src/TargetBoost.tsx +63 -0
- package/src/TargetPlayer.tsx +56 -0
- package/src/TargetPlayerLocation.tsx +27 -0
- package/src/TargetPlayerStats.tsx +25 -0
- package/src/Team.tsx +45 -0
- package/src/Teams.tsx +13 -0
- package/src/Timer.tsx +24 -0
- package/src/assets/overlay-testing-background.png +0 -0
- package/src/context/BroadcastContext.tsx +21 -0
- package/src/css/reset.css +280 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useOverlayStyles.ts +107 -0
- package/src/hooks/useReplay.ts +21 -0
- package/src/hooks/useShowGameComponents.ts +14 -0
- package/src/hooks/useTargetPlayer.ts +21 -0
- package/src/index.ts +3 -0
- package/src/types.d.ts +59 -0
- package/test-overlay/README.md +12 -0
- package/test-overlay/eslint.config.js +33 -0
- package/test-overlay/index.html +13 -0
- package/test-overlay/package.json +27 -0
- package/test-overlay/public/mock-css.css +733 -0
- package/test-overlay/public/vite.svg +1 -0
- package/test-overlay/src/App.jsx +28 -0
- package/test-overlay/src/index.css +0 -0
- package/test-overlay/src/main.jsx +10 -0
- package/test-overlay/src/mockBroadcast.js +33 -0
- package/test-overlay/vite.config.js +7 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import { Overlay } from "@four-leaf-studios/rl-overlay";
|
|
3
|
+
import { mockBroadcastData } from "./mockBroadcast";
|
|
4
|
+
|
|
5
|
+
export default function App() {
|
|
6
|
+
const [cssText, setCssText] = useState("");
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
fetch("/mock-css.css") // make sure mock-css.css lives in your public/ folder
|
|
10
|
+
.then((res) => {
|
|
11
|
+
if (!res.ok) throw new Error("Failed to load CSS");
|
|
12
|
+
return res.text();
|
|
13
|
+
})
|
|
14
|
+
.then(setCssText)
|
|
15
|
+
.catch((err) => {
|
|
16
|
+
console.error(err);
|
|
17
|
+
setCssText("");
|
|
18
|
+
});
|
|
19
|
+
}, [setCssText]);
|
|
20
|
+
|
|
21
|
+
if (!cssText) {
|
|
22
|
+
return <div>Loading styles…</div>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Overlay broadcast={mockBroadcastData} styles={cssText} preview={true} />
|
|
27
|
+
);
|
|
28
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const mockBroadcastData = {
|
|
2
|
+
id: "mock-broadcast-id",
|
|
3
|
+
name: "Mock Broadcast",
|
|
4
|
+
slug: "mock-broadcast",
|
|
5
|
+
teams: [
|
|
6
|
+
{
|
|
7
|
+
id: "0",
|
|
8
|
+
name: "Blue Team",
|
|
9
|
+
series_score: 2,
|
|
10
|
+
side: "blue",
|
|
11
|
+
logo: "https://dxbhsrqyrr690.cloudfront.net/sidearm.nextgen.sites/fit.sidearmsports.com/images/responsive_2021/logo-main.svg",
|
|
12
|
+
color: {
|
|
13
|
+
primary_color: "#910000",
|
|
14
|
+
secondary_color: "#ffffff",
|
|
15
|
+
mutual_color: "#000000",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "1",
|
|
20
|
+
name: "Orange Team",
|
|
21
|
+
series_score: 1,
|
|
22
|
+
side: "orange",
|
|
23
|
+
logo: "https://pbs.twimg.com/profile_images/1807909929921269760/wnTKfFoo_400x400.jpg",
|
|
24
|
+
color: {
|
|
25
|
+
primary_color: "#106600",
|
|
26
|
+
secondary_color: "#ffffff",
|
|
27
|
+
mutual_color: "#000000",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
series_number: 5,
|
|
32
|
+
top_info_text: "RLCS Season X - Regional 1",
|
|
33
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES5", // still emit ES5-compatible code
|
|
4
|
+
"lib": [
|
|
5
|
+
"DOM", // if you’re targeting browsers
|
|
6
|
+
"ES2015", // includes Array.from, Map, Set, etc
|
|
7
|
+
"ES2016",
|
|
8
|
+
"ES2017"
|
|
9
|
+
],
|
|
10
|
+
"module": "ESNext",
|
|
11
|
+
"jsx": "react",
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationDir": "dist/types",
|
|
14
|
+
"outDir": "dist",
|
|
15
|
+
"strict": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"skipLibCheck": true,
|
|
18
|
+
"moduleResolution": "node"
|
|
19
|
+
},
|
|
20
|
+
"include": ["src", "test-overlay/src/mockBroadcast.js"]
|
|
21
|
+
}
|