remotion 4.0.0-newpaths.13 → 4.0.0-newpaths.40

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.
@@ -0,0 +1,5 @@
1
+ import type { PropsWithChildren } from 'react';
2
+ import React from 'react';
3
+ export declare const Satori: React.FC<PropsWithChildren>;
4
+ export declare const SatoriForRendering: React.FC<PropsWithChildren>;
5
+ export declare const SatoriForDevelopment: React.FC<PropsWithChildren>;
package/dist/Satori.js ADDED
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.SatoriForDevelopment = exports.SatoriForRendering = exports.Satori = void 0;
30
+ const jsx_runtime_1 = require("react/jsx-runtime");
31
+ const react_1 = __importStar(require("react"));
32
+ const satori_1 = __importDefault(require("satori"));
33
+ const _1 = require(".");
34
+ const get_environment_1 = require("./get-environment");
35
+ const NativeLayers_1 = require("./NativeLayers");
36
+ const use_video_config_1 = require("./use-video-config");
37
+ const Satori = ({ children }) => {
38
+ if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
39
+ return (0, jsx_runtime_1.jsx)(exports.SatoriForRendering, { children: children });
40
+ }
41
+ return (0, jsx_runtime_1.jsx)(exports.SatoriForDevelopment, { children: children });
42
+ };
43
+ exports.Satori = Satori;
44
+ const SatoriForRendering = ({ children }) => {
45
+ const { width, height } = (0, use_video_config_1.useVideoConfig)();
46
+ const { setSatoriStack } = (0, react_1.useContext)(NativeLayers_1.NativeLayersContext);
47
+ (0, react_1.useLayoutEffect)(() => {
48
+ const handle = (0, _1.delayRender)();
49
+ (0, satori_1.default)(children, {
50
+ width,
51
+ height,
52
+ fonts: [],
53
+ })
54
+ .then((svg) => {
55
+ (0, _1.continueRender)(handle);
56
+ setSatoriStack(svg);
57
+ console.log({ svg });
58
+ })
59
+ .catch((err) => {
60
+ console.log(err);
61
+ });
62
+ }, [children, height, setSatoriStack, width]);
63
+ return (0, jsx_runtime_1.jsx)(_1.Experimental.Null, {});
64
+ };
65
+ exports.SatoriForRendering = SatoriForRendering;
66
+ const SatoriForDevelopment = ({ children, }) => {
67
+ const [markup, setMarkup] = react_1.default.useState(null);
68
+ const { width, height } = (0, use_video_config_1.useVideoConfig)();
69
+ (0, react_1.useEffect)(() => {
70
+ (0, satori_1.default)(children, {
71
+ width,
72
+ height,
73
+ fonts: [],
74
+ })
75
+ .then((svg) => {
76
+ setMarkup(svg);
77
+ console.log({ svg });
78
+ })
79
+ .catch((err) => {
80
+ console.log(err);
81
+ });
82
+ }, [children, height, width]);
83
+ if (!markup) {
84
+ return null;
85
+ }
86
+ return ((0, jsx_runtime_1.jsx)("div", {
87
+ // eslint-disable-next-line react/no-danger
88
+ dangerouslySetInnerHTML: {
89
+ __html: markup,
90
+ } }));
91
+ };
92
+ exports.SatoriForDevelopment = SatoriForDevelopment;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.0-newpaths.13+40cc970bd";
1
+ export declare const VERSION = "4.0.0-newpaths.40+09405cced";
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '4.0.0-newpaths.13+40cc970bd';
5
+ exports.VERSION = '4.0.0-newpaths.40+09405cced';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.0-newpaths.13+40cc970bd",
3
+ "version": "4.0.0-newpaths.40+09405cced",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -65,5 +65,5 @@
65
65
  ]
66
66
  }
67
67
  },
68
- "gitHead": "40cc970bd20f2c9fde0c1644f1c9f33cd47f3dc7"
68
+ "gitHead": "09405cced148038402b72b568f349e0bc7bbb949"
69
69
  }