@noya-app/noya-multiplayer-react 0.1.56 → 0.1.58
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/.turbo/turbo-build.log +11 -11
- package/CHANGELOG.md +17 -0
- package/dist/index.bundle.js +13 -12
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/NoyaStateContext.tsx +17 -0
- package/src/inspector/useStateInspector.tsx +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1114,6 +1114,7 @@ import { useEffect as useEffect4 } from "react";
|
|
|
1114
1114
|
import {
|
|
1115
1115
|
Observable
|
|
1116
1116
|
} from "@noya-app/observable";
|
|
1117
|
+
import { useStableCallback } from "@noya-app/react-utils";
|
|
1117
1118
|
import React5, {
|
|
1118
1119
|
createContext,
|
|
1119
1120
|
useCallback as useCallback2,
|
|
@@ -4011,8 +4012,9 @@ var ErrorOverlay = React.memo(function ErrorOverlay2({
|
|
|
4011
4012
|
});
|
|
4012
4013
|
|
|
4013
4014
|
// src/inspector/useStateInspector.tsx
|
|
4014
|
-
import React4
|
|
4015
|
+
import React4 from "react";
|
|
4015
4016
|
import { createRoot } from "react-dom/client";
|
|
4017
|
+
import { useIsomorphicLayoutEffect } from "@noya-app/react-utils";
|
|
4016
4018
|
|
|
4017
4019
|
// src/inspector/StateInspector.tsx
|
|
4018
4020
|
import { memoGeneric } from "@noya-app/react-utils";
|
|
@@ -5052,7 +5054,7 @@ function useStateInspector({
|
|
|
5052
5054
|
anchor
|
|
5053
5055
|
}) {
|
|
5054
5056
|
const [root, setRoot] = React4.useState(null);
|
|
5055
|
-
|
|
5057
|
+
useIsomorphicLayoutEffect(() => {
|
|
5056
5058
|
if (disabled) return;
|
|
5057
5059
|
const { host, container } = createShadowRootElement();
|
|
5058
5060
|
const root2 = createRoot(container);
|
|
@@ -5062,7 +5064,7 @@ function useStateInspector({
|
|
|
5062
5064
|
document.body.removeChild(host);
|
|
5063
5065
|
};
|
|
5064
5066
|
}, [disabled]);
|
|
5065
|
-
|
|
5067
|
+
useIsomorphicLayoutEffect(() => {
|
|
5066
5068
|
if (!root) return;
|
|
5067
5069
|
root.render(
|
|
5068
5070
|
/* @__PURE__ */ React4.createElement(
|
|
@@ -5350,6 +5352,18 @@ function useIOManager() {
|
|
|
5350
5352
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
5351
5353
|
return noyaManager.ioManager;
|
|
5352
5354
|
}
|
|
5355
|
+
function usePublish(callback) {
|
|
5356
|
+
const { noyaManager } = useAnyNoyaStateContext();
|
|
5357
|
+
const stableCallback = useStableCallback(callback);
|
|
5358
|
+
useEffect3(() => {
|
|
5359
|
+
noyaManager.publishingManager.setPublishingEnabled(true);
|
|
5360
|
+
noyaManager.publishingManager.getFilesToPublish = stableCallback;
|
|
5361
|
+
return () => {
|
|
5362
|
+
noyaManager.publishingManager.setPublishingEnabled(false);
|
|
5363
|
+
noyaManager.publishingManager.getFilesToPublish = void 0;
|
|
5364
|
+
};
|
|
5365
|
+
}, [noyaManager, stableCallback]);
|
|
5366
|
+
}
|
|
5353
5367
|
function useIsInitialized() {
|
|
5354
5368
|
const { noyaManager, viewType } = useAnyNoyaStateContext();
|
|
5355
5369
|
const isInitializedObservable = useMemo4(
|
|
@@ -5733,6 +5747,7 @@ export {
|
|
|
5733
5747
|
useObservable,
|
|
5734
5748
|
useOutputTransforms,
|
|
5735
5749
|
usePipelineManager,
|
|
5750
|
+
usePublish,
|
|
5736
5751
|
useRegisterAITool,
|
|
5737
5752
|
useSecret,
|
|
5738
5753
|
useSecretManager,
|