@clockworkdog/cogs-client-react 0.14.1 → 0.16.2
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/README.md +16 -3
- package/dist/components/{Background.d.ts → Images.d.ts} +5 -2
- package/dist/components/Images.js +20 -0
- package/dist/components/Images.js.map +1 -0
- package/dist/components/Timer.js +17 -26
- package/dist/components/Timer.js.map +1 -1
- package/dist/components/Video.d.ts +2 -1
- package/dist/components/Video.js +3 -2
- package/dist/components/Video.js.map +1 -1
- package/dist/hooks/useCogsConfig.js +1 -1
- package/dist/hooks/useCogsConfig.js.map +1 -1
- package/dist/hooks/useCogsInputPortValue.d.ts +1 -1
- package/dist/hooks/useCogsInputPortValue.js +2 -2
- package/dist/hooks/useCogsInputPortValue.js.map +1 -1
- package/dist/hooks/useCogsInputPortValues.js +1 -1
- package/dist/hooks/useCogsInputPortValues.js.map +1 -1
- package/dist/hooks/useCogsMessage.d.ts +1 -1
- package/dist/hooks/useCogsMessage.js.map +1 -1
- package/dist/hooks/useHint.js.map +1 -1
- package/dist/hooks/useImages.d.ts +6 -0
- package/dist/hooks/useImages.js +31 -0
- package/dist/hooks/useImages.js.map +1 -0
- package/dist/hooks/useShowPhase.d.ts +2 -0
- package/dist/hooks/{useBackground.js → useShowPhase.js} +8 -7
- package/dist/hooks/useShowPhase.js.map +1 -0
- package/dist/hooks/useWhenShowReset.d.ts +2 -0
- package/dist/hooks/useWhenShowReset.js +16 -0
- package/dist/hooks/useWhenShowReset.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +11 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/components/Background.js +0 -27
- package/dist/components/Background.js.map +0 -1
- package/dist/hooks/useBackground.d.ts +0 -2
- package/dist/hooks/useBackground.js.map +0 -1
package/README.md
CHANGED
|
@@ -22,14 +22,14 @@ Import the library
|
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
24
|
import { CogsConnection, AudioPlayer } from '@clockworkdog/cogs-client';
|
|
25
|
-
import {
|
|
25
|
+
import { Video, Timer, Hint, useIsConnected, useIsAudioPlaying } from '@clockworkdog/cogs-client-react';
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
or
|
|
29
29
|
|
|
30
30
|
```js
|
|
31
31
|
const { CogsConnection, AudioPlayer } = require('@clockworkdog/cogs-client');
|
|
32
|
-
const {
|
|
32
|
+
const { Video, Hint, Timer, useIsConnected, useIsAudioPlaying } = require('@clockworkdog/cogs-client-react');
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
then
|
|
@@ -45,7 +45,6 @@ function MyComponent() {
|
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
47
|
<div>
|
|
48
|
-
<Backgound connection={cogsConnection} />
|
|
49
48
|
<div>Connected: {isConnected}</div>
|
|
50
49
|
<div>Audio playing: {isAudioPlaying}</div>
|
|
51
50
|
<div style={{ fontSize: 100 }}>
|
|
@@ -69,6 +68,20 @@ When developing locally you should connect to COGS in "simulator" mode by append
|
|
|
69
68
|
|
|
70
69
|
For example, with your custom content hosted on port 3000, http://localhost:3000?simulator=true&t=media_master&name=Timer+screen will connect as the simulator for `Timer screen`.
|
|
71
70
|
|
|
71
|
+
#### Chrome permissions
|
|
72
|
+
|
|
73
|
+
Chrome's autoplay security settings mean that you will need to interact with the page before audio or video will play. You can disable this warning when developing by pressing `ℹ️` in Chrome's URL bar, opening `Site settings`, and setting `Sound` to `Allow`.
|
|
74
|
+
|
|
75
|
+
## Using `create-react-app`
|
|
76
|
+
|
|
77
|
+
We suggest you use [our `create-react-app` template](https://www.npmjs.com/package/@clockworkdog/cra-template-cogs-client).
|
|
78
|
+
|
|
79
|
+
Or, if you're using `create-react-app` for your project, you'll need to configure the build to work with a relative path, as when accessed by a Media Master your project will not be served from the root path. This can be achieved by adding the following to your `package.json`:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
"homepage": ".",
|
|
83
|
+
```
|
|
84
|
+
|
|
72
85
|
## Release process
|
|
73
86
|
|
|
74
87
|
1. Create a new commit with a bumped version number in `package.json`.
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { CogsConnection } from '@clockworkdog/cogs-client';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export default function
|
|
3
|
+
export default function Images({ className, style, connection, fullscreen, }: {
|
|
4
4
|
className?: string;
|
|
5
5
|
style?: React.CSSProperties;
|
|
6
6
|
connection: CogsConnection;
|
|
7
|
-
|
|
7
|
+
fullscreen?: boolean | {
|
|
8
|
+
style: React.CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
}): JSX.Element | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cogs_client_1 = require("@clockworkdog/cogs-client");
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const useImages_1 = __importDefault(require("../hooks/useImages"));
|
|
9
|
+
function Images({ className, style, connection, fullscreen, }) {
|
|
10
|
+
const images = useImages_1.default(connection);
|
|
11
|
+
const fullscreenCustomStyle = typeof fullscreen === 'object' ? fullscreen.style : undefined;
|
|
12
|
+
const imageElements = images.map((image, index) => (react_1.default.createElement("img", { className: className, key: index, src: cogs_client_1.assetUrl(image.file), alt: image.file, style: {
|
|
13
|
+
objectFit: image.fit,
|
|
14
|
+
...(fullscreen ? { width: '100%', height: '100%', position: 'absolute', top: 0, left: 0 } : {}),
|
|
15
|
+
...style,
|
|
16
|
+
} })));
|
|
17
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, fullscreen ? (react_1.default.createElement("div", { style: { position: 'absolute', zIndex: 2, top: 0, left: 0, width: '100vw', height: '100vh', ...fullscreenCustomStyle } }, imageElements)) : (imageElements)));
|
|
18
|
+
}
|
|
19
|
+
exports.default = Images;
|
|
20
|
+
//# sourceMappingURL=Images.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Images.js","sourceRoot":"","sources":["../../src/components/Images.tsx"],"names":[],"mappings":";;;;;AAAA,2DAAqE;AACrE,kDAA0B;AAC1B,mEAA2C;AAE3C,SAAwB,MAAM,CAAC,EAC7B,SAAS,EACT,KAAK,EACL,UAAU,EACV,UAAU,GAMX;IACC,MAAM,MAAM,GAAG,mBAAS,CAAC,UAAU,CAAC,CAAC;IAErC,MAAM,qBAAqB,GAAG,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAE5F,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CACjD,uCACE,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,KAAK,EACV,GAAG,EAAE,sBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EACzB,GAAG,EAAE,KAAK,CAAC,IAAI,EACf,KAAK,EAAE;YACL,SAAS,EAAE,KAAK,CAAC,GAAG;YACpB,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/F,GAAG,KAAK;SACT,GACD,CACH,CAAC,CAAC;IAEH,OAAO,CACL,8DACG,UAAU,CAAC,CAAC,CAAC,CACZ,uCAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,qBAAqB,EAAE,IACxH,aAAa,CACV,CACP,CAAC,CAAC,CAAC,CACF,aAAa,CACd,CACA,CACJ,CAAC;AACJ,CAAC;AAxCD,yBAwCC"}
|
package/dist/components/Timer.js
CHANGED
|
@@ -38,48 +38,39 @@ function formatTime(time, countingUp) {
|
|
|
38
38
|
return { minutes, seconds };
|
|
39
39
|
}
|
|
40
40
|
function Timer({ className, style, connection, separator = ':', center, }) {
|
|
41
|
+
var _a, _b, _c, _d, _e, _f;
|
|
41
42
|
const [timerElapsed, setTimerElapsed] = react_1.useState(0);
|
|
42
|
-
const [timerStartedAt, setTimerStartedAt] = react_1.useState(0);
|
|
43
|
-
const [timerTotalMillis, setTimerTotalMillis] = react_1.useState(0);
|
|
44
|
-
const [timerTicking, setTimerTicking] = react_1.useState(false);
|
|
45
|
-
const
|
|
43
|
+
const [timerStartedAt, setTimerStartedAt] = react_1.useState((_b = (_a = connection.timerState) === null || _a === void 0 ? void 0 : _a.startedAt) !== null && _b !== void 0 ? _b : 0);
|
|
44
|
+
const [timerTotalMillis, setTimerTotalMillis] = react_1.useState((_d = (_c = connection.timerState) === null || _c === void 0 ? void 0 : _c.durationMillis) !== null && _d !== void 0 ? _d : 0);
|
|
45
|
+
const [timerTicking, setTimerTicking] = react_1.useState((_f = (_e = connection.timerState) === null || _e === void 0 ? void 0 : _e.ticking) !== null && _f !== void 0 ? _f : false);
|
|
46
|
+
const updateTimerElapsed = react_1.useCallback(() => {
|
|
46
47
|
const timerElapsed = timerTicking ? Date.now() - timerStartedAt : 0;
|
|
47
48
|
setTimerElapsed(timerElapsed);
|
|
48
49
|
}, [timerTicking, timerStartedAt]);
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
react_1.useEffect(() => {
|
|
56
|
-
if (timerTicking) {
|
|
57
|
-
updateTimer();
|
|
50
|
+
const updateTimerState = react_1.useCallback((timerState) => {
|
|
51
|
+
setTimerTotalMillis(timerState.durationMillis);
|
|
52
|
+
setTimerTicking(timerState.ticking);
|
|
53
|
+
if (timerState.ticking) {
|
|
54
|
+
setTimerStartedAt(timerState.startedAt);
|
|
55
|
+
setTimerElapsed(0);
|
|
58
56
|
}
|
|
59
|
-
}, [timerTicking, updateTimer]);
|
|
60
|
-
const stopTimer = react_1.useCallback((durationMillis) => {
|
|
61
|
-
setTimerTotalMillis(durationMillis);
|
|
62
|
-
setTimerTicking(false);
|
|
63
57
|
}, []);
|
|
58
|
+
// Deal with starting/stopping the visual ticking of the timer
|
|
64
59
|
react_1.useEffect(() => {
|
|
65
60
|
if (timerTicking) {
|
|
66
|
-
|
|
61
|
+
updateTimerElapsed();
|
|
62
|
+
const ticker = setInterval(updateTimerElapsed, 100);
|
|
67
63
|
return () => {
|
|
68
64
|
clearInterval(ticker);
|
|
69
65
|
};
|
|
70
66
|
}
|
|
71
67
|
return;
|
|
72
|
-
}, [timerTicking,
|
|
68
|
+
}, [timerTicking, updateTimerElapsed]);
|
|
73
69
|
useCogsMessage_1.default(connection, react_1.useCallback((message) => {
|
|
74
70
|
if (message.type === 'adjustable_timer_update') {
|
|
75
|
-
|
|
76
|
-
startTimer(message.durationMillis);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
stopTimer(message.durationMillis);
|
|
80
|
-
}
|
|
71
|
+
updateTimerState({ startedAt: Date.now(), ticking: message.ticking, durationMillis: message.durationMillis });
|
|
81
72
|
}
|
|
82
|
-
}, [
|
|
73
|
+
}, [updateTimerState]));
|
|
83
74
|
const time = timerTicking ? timerTotalMillis - timerElapsed : timerTotalMillis;
|
|
84
75
|
const { minutes, seconds } = formatTime(time, false);
|
|
85
76
|
return (react_1.default.createElement("div", { className: className, style: center ? { display: 'flex', justifyContent: 'center', ...style } : style },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timer.js","sourceRoot":"","sources":["../../src/components/Timer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,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
|
10
10
|
}
|
|
11
|
-
export default function Video({ className, style, connection, fullscreen, onStopped, }: {
|
|
11
|
+
export default function Video({ className, style, connection, fullscreen, onStopped, getCachedAsset }: {
|
|
12
12
|
className?: string;
|
|
13
13
|
style?: React.CSSProperties;
|
|
14
14
|
connection: CogsConnection;
|
|
@@ -16,4 +16,5 @@ export default function Video({ className, style, connection, fullscreen, onStop
|
|
|
16
16
|
style: React.CSSProperties;
|
|
17
17
|
};
|
|
18
18
|
onStopped?: () => void;
|
|
19
|
+
getCachedAsset?: (assetUrl: string) => string | undefined;
|
|
19
20
|
}): JSX.Element | null;
|
package/dist/components/Video.js
CHANGED
|
@@ -26,7 +26,8 @@ const cogs_client_1 = require("@clockworkdog/cogs-client");
|
|
|
26
26
|
const react_1 = __importStar(require("react"));
|
|
27
27
|
const useCogsMessage_1 = __importDefault(require("../hooks/useCogsMessage"));
|
|
28
28
|
const VideoClipState_1 = __importDefault(require("../types/VideoClipState"));
|
|
29
|
-
function Video({ className, style, connection, fullscreen, onStopped, }) {
|
|
29
|
+
function Video({ className, style, connection, fullscreen, onStopped, getCachedAsset }) {
|
|
30
|
+
var _a;
|
|
30
31
|
const [globalVolume, setGlobalVolume] = react_1.useState(1);
|
|
31
32
|
const [videoClip, setVideoClip] = react_1.useState(null);
|
|
32
33
|
useCogsMessage_1.default(connection, react_1.useCallback((message) => {
|
|
@@ -96,7 +97,7 @@ function Video({ className, style, connection, fullscreen, onStopped, }) {
|
|
|
96
97
|
objectFit: videoClip.fit,
|
|
97
98
|
...(fullscreen ? { width: '100%', height: '100%' } : {}),
|
|
98
99
|
...style,
|
|
99
|
-
}, src: videoClip.src, onEnded: notifyVideoStopped }));
|
|
100
|
+
}, src: (_a = (getCachedAsset && getCachedAsset(videoClip.src))) !== null && _a !== void 0 ? _a : videoClip.src, onEnded: notifyVideoStopped }));
|
|
100
101
|
const fullscreenCustomStyle = typeof fullscreen === 'object' ? fullscreen.style : undefined;
|
|
101
102
|
return fullscreen ? (react_1.default.createElement("div", { style: { position: 'absolute', zIndex: 1, top: 0, left: 0, width: '100vw', height: '100vh', ...fullscreenCustomStyle } }, video)) : (video);
|
|
102
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Video.js","sourceRoot":"","sources":["../../src/components/Video.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAwG;AACxG,+CAAwE;AACxE,6EAAqD;AACrD,6EAAqD;AAUrD,SAAwB,KAAK,CAAC,EAC5B,SAAS,EACT,KAAK,EACL,UAAU,EACV,UAAU,EACV,SAAS,
|
|
1
|
+
{"version":3,"file":"Video.js","sourceRoot":"","sources":["../../src/components/Video.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAwG;AACxG,+CAAwE;AACxE,6EAAqD;AACrD,6EAAqD;AAUrD,SAAwB,KAAK,CAAC,EAC5B,SAAS,EACT,KAAK,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,cAAc,EAQf;;IACC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,gBAAQ,CAAC,CAAC,CAAC,CAAC;IAEpD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,gBAAQ,CAAmB,IAAI,CAAC,CAAC;IAEnE,wBAAc,CACZ,UAAU,EACV,mBAAW,CAAC,CAAC,OAA0B,EAAE,EAAE;;QACzC,QAAQ,OAAO,CAAC,IAAI,EAAE;YACpB,KAAK,qBAAqB;gBACxB,eAAe,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;gBACtC,MAAM;YACR,KAAK,YAAY;gBACf,YAAY,CAAC;oBACX,GAAG,EAAE,sBAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;oBAC3B,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,GAAG,EAAE,OAAO,CAAC,GAAG;oBAChB,IAAI,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,KAAK;oBAC3B,KAAK,EAAE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,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5F,OAAO,UAAU,CAAC,CAAC,CAAC,CAClB,uCAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,qBAAqB,EAAE,IAAG,KAAK,CAAO,CAC3I,CAAC,CAAC,CAAC,CACF,KAAK,CACN,CAAC;AACJ,CAAC;AA7GD,wBA6GC"}
|
|
@@ -5,7 +5,7 @@ const react_1 = require("react");
|
|
|
5
5
|
function useCogsConfig(connection) {
|
|
6
6
|
const [config, setConfig] = react_1.useState(connection.config);
|
|
7
7
|
react_1.useEffect(() => {
|
|
8
|
-
const listener = () => setConfig(
|
|
8
|
+
const listener = (event) => setConfig(event.detail);
|
|
9
9
|
connection.addEventListener('config', listener);
|
|
10
10
|
return () => connection.removeEventListener('config', listener);
|
|
11
11
|
}, [connection]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCogsConfig.js","sourceRoot":"","sources":["../../src/hooks/useCogsConfig.ts"],"names":[],"mappings":";;AACA,iCAA4C;AAI5C,8DAA8D;AAC9D,SAAwB,aAAa,CAAyC,UAAsB;IAClG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,gBAAQ,CAAyB,UAAU,CAAC,MAAM,CAAC,CAAC;IAEhF,iBAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"useCogsConfig.js","sourceRoot":"","sources":["../../src/hooks/useCogsConfig.ts"],"names":[],"mappings":";;AACA,iCAA4C;AAI5C,8DAA8D;AAC9D,SAAwB,aAAa,CAAyC,UAAsB;IAClG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,gBAAQ,CAAyB,UAAU,CAAC,MAAM,CAAC,CAAC;IAEhF,iBAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,CAAC,KAA0C,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACzF,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAChD,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,OAAO,MAAM,CAAC;AAChB,CAAC;AAVD,gCAUC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CogsConnection } from '@clockworkdog/cogs-client';
|
|
2
2
|
declare type InputPortsType<Connection> = Connection extends CogsConnection<infer Types> ? Types['inputPorts'] : never;
|
|
3
|
-
export default function
|
|
3
|
+
export default function useCogsInputPortValue<Connection extends CogsConnection<any>, PortName extends keyof NonNullable<InputPortsType<Connection>>>(connection: Connection, portName: PortName): NonNullable<InputPortsType<Connection>>[PortName];
|
|
4
4
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_1 = require("react");
|
|
4
|
-
function
|
|
4
|
+
function useCogsInputPortValue(connection, portName) {
|
|
5
5
|
const [value, setValue] = react_1.useState(connection.inputPortValues[portName]);
|
|
6
6
|
react_1.useEffect(() => {
|
|
7
7
|
const listener = (event) => {
|
|
@@ -14,5 +14,5 @@ function useCogsOutputPortValue(connection, portName) {
|
|
|
14
14
|
}, [connection, portName]);
|
|
15
15
|
return value;
|
|
16
16
|
}
|
|
17
|
-
exports.default =
|
|
17
|
+
exports.default = useCogsInputPortValue;
|
|
18
18
|
//# sourceMappingURL=useCogsInputPortValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCogsInputPortValue.js","sourceRoot":"","sources":["../../src/hooks/useCogsInputPortValue.ts"],"names":[],"mappings":";;AACA,iCAA4C;AAI5C,SAAwB,
|
|
1
|
+
{"version":3,"file":"useCogsInputPortValue.js","sourceRoot":"","sources":["../../src/hooks/useCogsInputPortValue.ts"],"names":[],"mappings":";;AACA,iCAA4C;AAI5C,SAAwB,qBAAqB,CAI3C,UAAsB,EAAE,QAAkB;IAC1C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,gBAAQ,CAAoD,UAAU,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE5H,iBAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,CAAC,KAA2D,EAAE,EAAE;YAC/E,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE;gBACxC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;aAClC;QACH,CAAC,CAAC;QAEF,UAAU,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACjD,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnE,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE3B,OAAO,KAAK,CAAC;AACf,CAAC;AAnBD,wCAmBC"}
|
|
@@ -5,7 +5,7 @@ const react_1 = require("react");
|
|
|
5
5
|
function useCogsInputPortValues(connection) {
|
|
6
6
|
const [value, setValue] = react_1.useState(connection.inputPortValues);
|
|
7
7
|
react_1.useEffect(() => {
|
|
8
|
-
const listener = () => setValue(
|
|
8
|
+
const listener = (event) => setValue(event.detail);
|
|
9
9
|
connection.addEventListener('updates', listener);
|
|
10
10
|
return () => connection.removeEventListener('updates', listener);
|
|
11
11
|
}, [connection]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCogsInputPortValues.js","sourceRoot":"","sources":["../../src/hooks/useCogsInputPortValues.ts"],"names":[],"mappings":";;AACA,iCAA4C;AAI5C,8DAA8D;AAC9D,SAAwB,sBAAsB,CAAyC,UAAsB;IAC3G,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,gBAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE/D,iBAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"useCogsInputPortValues.js","sourceRoot":"","sources":["../../src/hooks/useCogsInputPortValues.ts"],"names":[],"mappings":";;AACA,iCAA4C;AAI5C,8DAA8D;AAC9D,SAAwB,sBAAsB,CAAyC,UAAsB;IAC3G,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,gBAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE/D,iBAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,CAAC,KAA8C,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5F,UAAU,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACjD,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,OAAO,KAAK,CAAC;AACf,CAAC;AAVD,yCAUC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CogsClientMessage, CogsConnection } from '@clockworkdog/cogs-client';
|
|
2
|
-
export default function useCogsMessage(connection: CogsConnection, handleMessage: (message:
|
|
2
|
+
export default function useCogsMessage<T extends CogsClientMessage = CogsClientMessage>(connection: CogsConnection, handleMessage: (message: T) => void): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCogsMessage.js","sourceRoot":"","sources":["../../src/hooks/useCogsMessage.ts"],"names":[],"mappings":";;AACA,iCAAkC;AAElC,SAAwB,cAAc,
|
|
1
|
+
{"version":3,"file":"useCogsMessage.js","sourceRoot":"","sources":["../../src/hooks/useCogsMessage.ts"],"names":[],"mappings":";;AACA,iCAAkC;AAElC,SAAwB,cAAc,CACpC,UAA0B,EAC1B,aAAmC;IAEnC,iBAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,CAAC,KAAqB,EAAE,EAAE;YACzC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC;QAEF,UAAU,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACjD,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnE,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC;AAClC,CAAC;AAZD,iCAYC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHint.js","sourceRoot":"","sources":["../../src/hooks/useHint.ts"],"names":[],"mappings":";;;;;AACA,iCAA8C;AAC9C,sEAA8C;AAE9C,SAAwB,OAAO,CAAC,UAA0B;IACxD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,gBAAQ,CAAC,EAAE,CAAC,CAAC;IAErC,wBAAc,CACZ,UAAU,EACV,mBAAW,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"useHint.js","sourceRoot":"","sources":["../../src/hooks/useHint.ts"],"names":[],"mappings":";;;;;AACA,iCAA8C;AAC9C,sEAA8C;AAE9C,SAAwB,OAAO,CAAC,UAA0B;IACxD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,gBAAQ,CAAC,EAAE,CAAC,CAAC;IAErC,wBAAc,CACZ,UAAU,EACV,mBAAW,CAAC,CAAC,OAA0B,EAAE,EAAE;QACzC,OAAO,CAAC,IAAI,KAAK,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACxE,CAAC,EAAE,EAAE,CAAC,CACP,CAAC;IAEF,OAAO,IAAI,IAAI,IAAI,CAAC;AACtB,CAAC;AAXD,0BAWC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const useCogsMessage_1 = __importDefault(require("./useCogsMessage"));
|
|
8
|
+
function useImages(connection) {
|
|
9
|
+
const [images, setImages] = react_1.useState([]);
|
|
10
|
+
useCogsMessage_1.default(connection, react_1.useCallback((message) => {
|
|
11
|
+
switch (message.type) {
|
|
12
|
+
case 'image_show':
|
|
13
|
+
{
|
|
14
|
+
const newImage = { file: message.file, fit: message.fit };
|
|
15
|
+
setImages((images) => (message.hideOthers ? [newImage] : [...images, newImage]));
|
|
16
|
+
}
|
|
17
|
+
break;
|
|
18
|
+
case 'image_hide':
|
|
19
|
+
if (message.file) {
|
|
20
|
+
setImages((images) => images.filter(({ file }) => file !== message.file));
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
setImages([]);
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
}, []));
|
|
28
|
+
return images;
|
|
29
|
+
}
|
|
30
|
+
exports.default = useImages;
|
|
31
|
+
//# sourceMappingURL=useImages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useImages.js","sourceRoot":"","sources":["../../src/hooks/useImages.ts"],"names":[],"mappings":";;;;;AACA,iCAA8C;AAC9C,sEAA8C;AAI9C,SAAwB,SAAS,CAAC,UAA0B;IAC1D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,gBAAQ,CAAU,EAAE,CAAC,CAAC;IAElD,wBAAc,CACZ,UAAU,EACV,mBAAW,CAAC,CAAC,OAA0B,EAAE,EAAE;QACzC,QAAQ,OAAO,CAAC,IAAI,EAAE;YACpB,KAAK,YAAY;gBACf;oBACE,MAAM,QAAQ,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;oBAC1D,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;iBAClF;gBACD,MAAM;YACR,KAAK,YAAY;gBACf,IAAI,OAAO,CAAC,IAAI,EAAE;oBAChB,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;iBAC3E;qBAAM;oBACL,SAAS,CAAC,EAAE,CAAC,CAAC;iBACf;gBACD,MAAM;SACT;IACH,CAAC,EAAE,EAAE,CAAC,CACP,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAzBD,4BAyBC"}
|
|
@@ -5,13 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const useCogsMessage_1 = __importDefault(require("./useCogsMessage"));
|
|
8
|
-
function
|
|
9
|
-
const [
|
|
8
|
+
function useShowPhase(connection) {
|
|
9
|
+
const [status, setStatus] = react_1.useState(connection.showPhase);
|
|
10
10
|
useCogsMessage_1.default(connection, react_1.useCallback((message) => {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
if (message.type === 'show_phase') {
|
|
12
|
+
setStatus(message.phase);
|
|
13
|
+
}
|
|
13
14
|
}, []));
|
|
14
|
-
return
|
|
15
|
+
return status;
|
|
15
16
|
}
|
|
16
|
-
exports.default =
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
exports.default = useShowPhase;
|
|
18
|
+
//# sourceMappingURL=useShowPhase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useShowPhase.js","sourceRoot":"","sources":["../../src/hooks/useShowPhase.ts"],"names":[],"mappings":";;;;;AACA,iCAA8C;AAC9C,sEAA8C;AAE9C,SAAwB,YAAY,CAAC,UAA0B;IAC7D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,gBAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAE3D,wBAAc,CACZ,UAAU,EACV,mBAAW,CAAC,CAAC,OAA0B,EAAE,EAAE;QACzC,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,EAAE;YACjC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;SAC1B;IACH,CAAC,EAAE,EAAE,CAAC,CACP,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAbD,+BAaC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const useCogsMessage_1 = __importDefault(require("./useCogsMessage"));
|
|
8
|
+
function useWhenShowReset(connection, whenReset) {
|
|
9
|
+
useCogsMessage_1.default(connection, react_1.useCallback((message) => {
|
|
10
|
+
if (message.type === 'show_reset') {
|
|
11
|
+
whenReset();
|
|
12
|
+
}
|
|
13
|
+
}, [whenReset]));
|
|
14
|
+
}
|
|
15
|
+
exports.default = useWhenShowReset;
|
|
16
|
+
//# sourceMappingURL=useWhenShowReset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWhenShowReset.js","sourceRoot":"","sources":["../../src/hooks/useWhenShowReset.ts"],"names":[],"mappings":";;;;;AACA,iCAAoC;AACpC,sEAA8C;AAE9C,SAAwB,gBAAgB,CAAC,UAA0B,EAAE,SAAqB;IACxF,wBAAc,CACZ,UAAU,EACV,mBAAW,CACT,CAAC,OAA0B,EAAE,EAAE;QAC7B,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,EAAE;YACjC,SAAS,EAAE,CAAC;SACb;IACH,CAAC,EACD,CAAC,SAAS,CAAC,CACZ,CACF,CAAC;AACJ,CAAC;AAZD,mCAYC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,11 +6,13 @@ export { default as useCogsInputPortValue } from './hooks/useCogsInputPortValue'
|
|
|
6
6
|
export { default as useCogsInputPortValues } from './hooks/useCogsInputPortValues';
|
|
7
7
|
export { default as useCogsMessage } from './hooks/useCogsMessage';
|
|
8
8
|
export { default as usePreloadedUrl } from './hooks/usePreloadedUrl';
|
|
9
|
+
export { default as useShowPhase } from './hooks/useShowPhase';
|
|
10
|
+
export { default as useWhenShowReset } from './hooks/useWhenShowReset';
|
|
9
11
|
export { default as useAudioClips } from './hooks/useAudioClips';
|
|
10
12
|
export { default as useIsAudioPlaying } from './hooks/useIsAudioPlaying';
|
|
11
|
-
export { default as useBackground } from './hooks/useBackground';
|
|
12
|
-
export { default as Background } from './components/Background';
|
|
13
13
|
export { default as useHint } from './hooks/useHint';
|
|
14
14
|
export { default as Hint } from './components/Hint';
|
|
15
15
|
export { default as Timer } from './components/Timer';
|
|
16
16
|
export { default as Video } from './components/Video';
|
|
17
|
+
export { default as useImages } from './hooks/useImages';
|
|
18
|
+
export { default as Images } from './components/Images';
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Video = exports.Timer = exports.Hint = exports.useHint = exports.
|
|
6
|
+
exports.Images = exports.useImages = exports.Video = exports.Timer = exports.Hint = exports.useHint = exports.useIsAudioPlaying = exports.useAudioClips = exports.useWhenShowReset = exports.useShowPhase = exports.usePreloadedUrl = exports.useCogsMessage = exports.useCogsInputPortValues = exports.useCogsInputPortValue = exports.useCogsEvent = exports.useCogsConfig = exports.useIsConnected = exports.useCogsConnection = exports.CogsConnectionProvider = void 0;
|
|
7
7
|
// Utilities
|
|
8
8
|
var CogsConnectionProvider_1 = require("./providers/CogsConnectionProvider");
|
|
9
9
|
Object.defineProperty(exports, "CogsConnectionProvider", { enumerable: true, get: function () { return __importDefault(CogsConnectionProvider_1).default; } });
|
|
@@ -22,16 +22,15 @@ var useCogsMessage_1 = require("./hooks/useCogsMessage");
|
|
|
22
22
|
Object.defineProperty(exports, "useCogsMessage", { enumerable: true, get: function () { return __importDefault(useCogsMessage_1).default; } });
|
|
23
23
|
var usePreloadedUrl_1 = require("./hooks/usePreloadedUrl");
|
|
24
24
|
Object.defineProperty(exports, "usePreloadedUrl", { enumerable: true, get: function () { return __importDefault(usePreloadedUrl_1).default; } });
|
|
25
|
+
var useShowPhase_1 = require("./hooks/useShowPhase");
|
|
26
|
+
Object.defineProperty(exports, "useShowPhase", { enumerable: true, get: function () { return __importDefault(useShowPhase_1).default; } });
|
|
27
|
+
var useWhenShowReset_1 = require("./hooks/useWhenShowReset");
|
|
28
|
+
Object.defineProperty(exports, "useWhenShowReset", { enumerable: true, get: function () { return __importDefault(useWhenShowReset_1).default; } });
|
|
25
29
|
// Audio
|
|
26
30
|
var useAudioClips_1 = require("./hooks/useAudioClips");
|
|
27
31
|
Object.defineProperty(exports, "useAudioClips", { enumerable: true, get: function () { return __importDefault(useAudioClips_1).default; } });
|
|
28
32
|
var useIsAudioPlaying_1 = require("./hooks/useIsAudioPlaying");
|
|
29
33
|
Object.defineProperty(exports, "useIsAudioPlaying", { enumerable: true, get: function () { return __importDefault(useIsAudioPlaying_1).default; } });
|
|
30
|
-
// Background
|
|
31
|
-
var useBackground_1 = require("./hooks/useBackground");
|
|
32
|
-
Object.defineProperty(exports, "useBackground", { enumerable: true, get: function () { return __importDefault(useBackground_1).default; } });
|
|
33
|
-
var Background_1 = require("./components/Background");
|
|
34
|
-
Object.defineProperty(exports, "Background", { enumerable: true, get: function () { return __importDefault(Background_1).default; } });
|
|
35
34
|
// Hints
|
|
36
35
|
var useHint_1 = require("./hooks/useHint");
|
|
37
36
|
Object.defineProperty(exports, "useHint", { enumerable: true, get: function () { return __importDefault(useHint_1).default; } });
|
|
@@ -40,6 +39,12 @@ Object.defineProperty(exports, "Hint", { enumerable: true, get: function () { re
|
|
|
40
39
|
// Timer
|
|
41
40
|
var Timer_1 = require("./components/Timer");
|
|
42
41
|
Object.defineProperty(exports, "Timer", { enumerable: true, get: function () { return __importDefault(Timer_1).default; } });
|
|
42
|
+
// Video
|
|
43
43
|
var Video_1 = require("./components/Video");
|
|
44
44
|
Object.defineProperty(exports, "Video", { enumerable: true, get: function () { return __importDefault(Video_1).default; } });
|
|
45
|
+
// Images
|
|
46
|
+
var useImages_1 = require("./hooks/useImages");
|
|
47
|
+
Object.defineProperty(exports, "useImages", { enumerable: true, get: function () { return __importDefault(useImages_1).default; } });
|
|
48
|
+
var Images_1 = require("./components/Images");
|
|
49
|
+
Object.defineProperty(exports, "Images", { enumerable: true, get: function () { return __importDefault(Images_1).default; } });
|
|
45
50
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,YAAY;AACZ,6EAA0G;AAAjG,iJAAA,OAAO,OAA0B;AAAE,2HAAA,iBAAiB,OAAA;AAC7D,yDAAmE;AAA1D,iIAAA,OAAO,OAAkB;AAClC,uDAAiE;AAAxD,+HAAA,OAA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clockworkdog/cogs-client-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"typescript": "^4.1.3"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@clockworkdog/cogs-client": "^0.
|
|
33
|
+
"@clockworkdog/cogs-client": "^0.16.0"
|
|
34
34
|
},
|
|
35
35
|
"description": "React components and hooks to connect to COGS to build a custom Media Master",
|
|
36
36
|
"repository": {
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const useBackground_1 = __importDefault(require("../hooks/useBackground"));
|
|
8
|
-
function Background({ className, style, connection, }) {
|
|
9
|
-
var _a, _b, _c;
|
|
10
|
-
const background = useBackground_1.default(connection);
|
|
11
|
-
return (react_1.default.createElement("div", Object.assign({}, { className }, { style: {
|
|
12
|
-
zIndex: -1,
|
|
13
|
-
position: 'absolute',
|
|
14
|
-
top: 0,
|
|
15
|
-
bottom: 0,
|
|
16
|
-
left: 0,
|
|
17
|
-
right: 0,
|
|
18
|
-
backgroundColor: (background === null || background === void 0 ? void 0 : background.color) || 'transparent',
|
|
19
|
-
backgroundImage: ((_a = background === null || background === void 0 ? void 0 : background.image) === null || _a === void 0 ? void 0 : _a.file) ? `url("${background.image.file}")` : 'none',
|
|
20
|
-
backgroundRepeat: 'no-repeat',
|
|
21
|
-
backgroundPosition: 'center',
|
|
22
|
-
backgroundSize: (_c = (_b = background === null || background === void 0 ? void 0 : background.image) === null || _b === void 0 ? void 0 : _b.fit) !== null && _c !== void 0 ? _c : 'auto',
|
|
23
|
-
...style,
|
|
24
|
-
} })));
|
|
25
|
-
}
|
|
26
|
-
exports.default = Background;
|
|
27
|
-
//# sourceMappingURL=Background.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Background.js","sourceRoot":"","sources":["../../src/components/Background.tsx"],"names":[],"mappings":";;;;;AACA,kDAA0B;AAC1B,2EAAmD;AAEnD,SAAwB,UAAU,CAAC,EACjC,SAAS,EACT,KAAK,EACL,UAAU,GAKX;;IACC,MAAM,UAAU,GAAG,uBAAa,CAAC,UAAU,CAAC,CAAC;IAE7C,OAAO,CACL,uDACM,EAAE,SAAS,EAAE,IACjB,KAAK,EAAE;YACL,MAAM,EAAE,CAAC,CAAC;YACV,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;YACR,eAAe,EAAE,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,KAAI,aAAa;YACnD,eAAe,EAAE,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,0CAAE,IAAI,EAAC,CAAC,CAAC,QAAQ,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM;YACrF,gBAAgB,EAAE,WAAW;YAC7B,kBAAkB,EAAE,QAAQ;YAC5B,cAAc,EAAE,MAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,0CAAE,GAAG,mCAAI,MAAM;YAChD,GAAG,KAAK;SACT,IACD,CACH,CAAC;AACJ,CAAC;AA9BD,6BA8BC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBackground.js","sourceRoot":"","sources":["../../src/hooks/useBackground.ts"],"names":[],"mappings":";;;;;AACA,iCAA8C;AAC9C,sEAA8C;AAE9C,SAAwB,aAAa,C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