@reactunity/renderer 0.25.0 → 0.26.1

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.
@@ -1,6 +1,6 @@
1
1
  import { n as UnityEngine } from "./unity-CqyiwXyf.js";
2
2
  import { t as UnityEditor } from "./editor-DwsHqUiS.js";
3
- import { A as AssetReference, Dt as AnchorTarget, i as ContentSrcProps, kt as ScrollDirection, s as ReactUnity, t as BaseCmpProps, u as Style } from "./base-3-s8tzdC.js";
3
+ import { A as AssetReference, At as ScrollDirection, Ot as AnchorTarget, i as ContentSrcProps, s as ReactUnity, t as BaseCmpProps, u as Style } from "./base-BdOJBAjh.js";
4
4
  type BaseCmp$1 = ReactUnity.UIToolkit.UIToolkitComponent;
5
5
  type Handler<T, TSender = BaseCmp$1> = (ev: T, sender: TSender) => void;
6
6
  type ActionCallback<TSender = BaseCmp$1> = (sender: TSender) => void;
@@ -150,4 +150,4 @@ interface IMGUI extends View<Cmp.IMGUIComponent> {
150
150
  interface Svg extends View<Cmp.SvgComponent>, ContentSrcProps {}
151
151
  //#endregion
152
152
  export { Events as C, BaseEventCallback as S, Toggle as _, Button as a, View as b, Image as c, Scroll as d, Slider as f, TextField as g, Text as h, Bindable as i, Portal as l, Svg as m, BaseField as n, IMGUI as o, StringField as p, BaseSlider as r, Icon as s, Anchor as t, Range as u, ToggleEvent as v, Handler as w, ActionCallback as x, ValueComponent as y };
153
- //# sourceMappingURL=components-CHc816Qv.d.ts.map
153
+ //# sourceMappingURL=components-Dyz9O4hQ.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { t as UnityEditor } from "../editor-DwsHqUiS.js";
2
- import { s as ReactUnity } from "../base-3-s8tzdC.js";
3
- import { a as ObjectProps, i as EnumProps, n as JSX, r as DialogProps, t as EditorElements } from "../jsx-5DJ6sjv6.js";
2
+ import { s as ReactUnity } from "../base-BdOJBAjh.js";
3
+ import { a as ObjectProps, i as EnumProps, n as JSX, r as DialogProps, t as EditorElements } from "../jsx-C4D-jFq9.js";
4
4
  //#region src/models/editor/environment.d.ts
5
5
  declare global {
6
6
  interface DefaultGlobals {
@@ -1,3 +1,3 @@
1
- import { n as JSX } from "../jsx-5DJ6sjv6.js";
1
+ import { n as JSX } from "../jsx-C4D-jFq9.js";
2
2
  import { Fragment, JSXSource, jsxDEV } from "react/jsx-dev-runtime";
3
3
  export { Fragment, type JSX, type JSXSource, jsxDEV };
@@ -1,3 +1,3 @@
1
- import { n as JSX } from "../jsx-5DJ6sjv6.js";
1
+ import { n as JSX } from "../jsx-C4D-jFq9.js";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  export { Fragment, type JSX, jsx, jsxs };
@@ -0,0 +1 @@
1
+ import "./jsx-CclP7PDw.js";
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { n as UnityEngine, r as System, t as Unity } from "./unity-CqyiwXyf.js";
2
2
  import { t as UnityEditor } from "./editor-DwsHqUiS.js";
3
- import { $ as ContainerType, A as AssetReference, B as Vector3Aux, C as Position, Ct as TimingFunctionType, D as Array2Aux, Dt as AnchorTarget, E as YogaJustify, Et as WhiteSpace, F as KnownColor, G as BackfaceVisibility, H as AnimationFillMode, I as NumberAux, J as BackgroundRepeat, K as BackgroundBlendMode, L as PositioningLiteral, M as ColorAux, N as HexColor, O as Array3Aux, Ot as SafeString, P as HttpSource, Q as ColorScheme, R as RectOffsetAux, S as Overflow, St as TimelineAxis, T as YogaAlign, Tt as Visibility, U as AnimationPlayState, V as AnimationDirection, W as Appearance, X as BorderImageRepeat, Y as BackgroundSize, Z as BorderStyle, _ as YogaValueAux, _t as ScrollSnapStop, a as Textable, at as ImageRendering, b as Display, bt as TextOverflowModes, c as Yoga, ct as MixBlendMode, d as RenderStyle, dt as OverscrollBehavior, et as CssKeyword, f as Layout, ft as PointerEvents, g as YogaValue4Aux, gt as ScrollSnapAxis, h as YogaValue2Aux, ht as ScrollSnapAlignment, it as FontWeight, j as AssetReferenceOrHttp, k as Array4Aux, kt as ScrollDirection, l as InlineStyleRemap, lt as NavigationMode, m as LayoutExtended, mt as ScrollSnapAlign, nt as FontStyles, ot as Isolation, p as LayoutCssCompatible, pt as ScrollBehavior, q as BackgroundClip, rt as FontVariant, s as ReactUnity, st as MaskMode, tt as CursorType, u as Style, ut as ObjectFit, v as BoxSizing, vt as ScrollSnapType, w as Wrap, wt as VerticalAlign, x as FlexDirection, xt as TextTransform, y as Direction, yt as TextAlign, z as Vector2Aux } from "./base-3-s8tzdC.js";
3
+ import { $ as ContainerType, A as AssetReference, At as ScrollDirection, B as Vector3Aux, C as Position, Ct as TimelineAxis, D as Array2Aux, Dt as WhiteSpace, E as YogaJustify, Et as Visibility, F as KnownColor, G as BackfaceVisibility, H as AnimationFillMode, I as NumberAux, J as BackgroundRepeat, K as BackgroundBlendMode, L as PositioningLiteral, M as ColorAux, N as HexColor, O as Array3Aux, Ot as AnchorTarget, P as HttpSource, Q as ColorScheme, R as RectOffsetAux, S as Overflow, St as TextTransform, T as YogaAlign, Tt as VerticalAlign, U as AnimationPlayState, V as AnimationDirection, W as Appearance, X as BorderImageRepeat, Y as BackgroundSize, Z as BorderStyle, _ as YogaValueAux, _t as ScrollSnapStop, a as Textable, at as ImageRendering, b as Display, bt as TextAlign, c as Yoga, ct as MixBlendMode, d as RenderStyle, dt as OverscrollBehavior, et as CssKeyword, f as Layout, ft as PointerEvents, g as YogaValue4Aux, gt as ScrollSnapAxis, h as YogaValue2Aux, ht as ScrollSnapAlignment, it as FontWeight, j as AssetReferenceOrHttp, k as Array4Aux, kt as SafeString, l as InlineStyleRemap, lt as NavigationMode, m as LayoutExtended, mt as ScrollSnapAlign, nt as FontStyles, ot as Isolation, p as LayoutCssCompatible, pt as ScrollBehavior, q as BackgroundClip, rt as FontVariant, s as ReactUnity, st as MaskMode, tt as CursorType, u as Style, ut as ObjectFit, v as BoxSizing, vt as ScrollSnapType, w as Wrap, wt as TimingFunctionType, x as FlexDirection, xt as TextOverflowModes, y as Direction, yt as ShapeRendering, z as Vector2Aux } from "./base-BdOJBAjh.js";
4
4
  import { t as NUnit } from "./tests-ByeoZtD1.js";
5
- import { p as Icon } from "./jsx-DEILne0Q.js";
6
- import "./index-DVMJGbQf.js";
5
+ import { p as Icon } from "./jsx-CclP7PDw.js";
6
+ import "./index-BjHMY1xn.js";
7
7
  import * as React$1 from "react";
8
8
  import Reconciler from "react-reconciler";
9
9
  import { UnityInstance } from "react-unity-webgl";
@@ -571,18 +571,20 @@ declare const Renderer: {
571
571
  render(element: React$1.ReactNode, options?: RenderOptions): Reconciler.Reconciler<unknown, unknown, unknown, unknown, unknown, unknown> | Reconciler.Reconciler<ReactUnity.IReactComponent, ReactUnity.IReactComponent, ReactUnity.ITextComponent, ReactUnity.IReactComponent, ReactUnity.IReactComponent, any>;
572
572
  };
573
573
  declare const batchedUpdates: ReturnType<typeof Reconciler>['batchedUpdates'];
574
- declare const flushSync: ReturnType<typeof Reconciler>['flushSync'];
574
+ /**
575
+ * Runs `fn` and commits the updates it schedules before returning. Called with no function,
576
+ * commits whatever synchronous work is pending.
577
+ */
578
+ declare function flushSync(): void;
579
+ declare function flushSync<R>(fn: () => R): R;
575
580
  //#endregion
576
581
  //#region index.d.ts
577
582
  declare const ReactUnityRenderer: {
578
583
  batchedUpdates: <A, R>(fn: (a: A) => R, a: A) => R;
579
- flushSync: {
580
- (): void;
581
- <R>(fn: () => R): R;
582
- };
584
+ flushSync: typeof flushSync;
583
585
  render: typeof render;
584
586
  unstable_batchedUpdates: <A, R>(fn: (a: A) => R, a: A) => R;
585
587
  };
586
588
  //#endregion
587
- export { AnchorTarget, AnimationDirection, AnimationFillMode, AnimationPlayState, Appearance, Array2Aux, Array3Aux, Array4Aux, AssetReference, AssetReferenceOrHttp, BackfaceVisibility, BackgroundBlendMode, BackgroundClip, BackgroundRepeat, BackgroundSize, BorderImageRepeat, BorderStyle, BoxSizing, ChildSet, ColorAux, ColorScheme, CommonConfig, ContainerType, CssKeyword, CursorType, DefaultIconNames, DictionaryWatcher, Direction, Display, FlexDirection, FontStyles, FontVariant, FontWeight, FormInstance, GlobalsProvider, HexColor, HostContext, HttpSource, HydratableInstance, ImageRendering, InlineStyleRemap, InstanceTag, Isolation, KnownColor, Layout, LayoutCssCompatible, LayoutExtended, MaskMode, MixBlendMode, NUnit, Namespace, NamespaceMap, NativeContainerInstance, NativeInstance, NativeTextInstance, NavigationMode, NoTimeout, NumberAux, ObjectFit, Overflow, OverscrollBehavior, PointerEvents, Position, PositioningLiteral, Props, PublicInstance, ReactUnity, RectOffsetAux, RenderStyle, Renderer, SafeString, ScrollBehavior, ScrollDirection, ScrollSnapAlign, ScrollSnapAlignment, ScrollSnapAxis, ScrollSnapStop, ScrollSnapType, Style, SuspenseInstance, System, TextAlign, TextOverflowModes, TextTransform, TimelineAxis, TimeoutHandle, TimingFunctionType, TransitionStatus, Unique, Unity, UnityEditor, UnityEngine, Vector2Aux, Vector3Aux, VerticalAlign, Visibility, WhiteSpace, Wrap, Yoga, YogaAlign, YogaJustify, YogaValue2Aux, YogaValue4Aux, YogaValueAux, batchedUpdates, batchedUpdates as unstable_batchedUpdates, createDictionaryWatcher, ReactUnityRenderer as default, flushSync, icon, render, useGlobals, useGlobalsContext, useGlobalsSelector, useReactiveValue };
589
+ export { AnchorTarget, AnimationDirection, AnimationFillMode, AnimationPlayState, Appearance, Array2Aux, Array3Aux, Array4Aux, AssetReference, AssetReferenceOrHttp, BackfaceVisibility, BackgroundBlendMode, BackgroundClip, BackgroundRepeat, BackgroundSize, BorderImageRepeat, BorderStyle, BoxSizing, ChildSet, ColorAux, ColorScheme, CommonConfig, ContainerType, CssKeyword, CursorType, DefaultIconNames, DictionaryWatcher, Direction, Display, FlexDirection, FontStyles, FontVariant, FontWeight, FormInstance, GlobalsProvider, HexColor, HostContext, HttpSource, HydratableInstance, ImageRendering, InlineStyleRemap, InstanceTag, Isolation, KnownColor, Layout, LayoutCssCompatible, LayoutExtended, MaskMode, MixBlendMode, NUnit, Namespace, NamespaceMap, NativeContainerInstance, NativeInstance, NativeTextInstance, NavigationMode, NoTimeout, NumberAux, ObjectFit, Overflow, OverscrollBehavior, PointerEvents, Position, PositioningLiteral, Props, PublicInstance, ReactUnity, RectOffsetAux, RenderStyle, Renderer, SafeString, ScrollBehavior, ScrollDirection, ScrollSnapAlign, ScrollSnapAlignment, ScrollSnapAxis, ScrollSnapStop, ScrollSnapType, ShapeRendering, Style, SuspenseInstance, System, TextAlign, TextOverflowModes, TextTransform, TimelineAxis, TimeoutHandle, TimingFunctionType, TransitionStatus, Unique, Unity, UnityEditor, UnityEngine, Vector2Aux, Vector3Aux, VerticalAlign, Visibility, WhiteSpace, Wrap, Yoga, YogaAlign, YogaJustify, YogaValue2Aux, YogaValue4Aux, YogaValueAux, batchedUpdates, batchedUpdates as unstable_batchedUpdates, createDictionaryWatcher, ReactUnityRenderer as default, flushSync, icon, render, useGlobals, useGlobalsContext, useGlobalsSelector, useReactiveValue };
588
590
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -931,6 +931,7 @@ const getSyncReconciler = () => {
931
931
  //#region src/renderer/renderer.ts
932
932
  const containerMap = /* @__PURE__ */ new Map();
933
933
  let renderCount = 0;
934
+ let usesSyncReconciler = false;
934
935
  function render(element, options = {}) {
935
936
  renderCount++;
936
937
  const hostContainer = (options === null || options === void 0 ? void 0 : options.hostContainer) || HostContainer;
@@ -971,7 +972,10 @@ function render(element, options = {}) {
971
972
  hostContainerInstance.context.FlushCommands(serialized);
972
973
  };
973
974
  hostRoot = asyncReconciler.createContainer(hostContainerInstance, mode, null, false, void 0, "", (error) => console.error(error), () => {}, () => {}, () => {});
974
- } else hostRoot = getSyncReconciler().createContainer(hostContainer, mode, null, false, void 0, "", (error) => console.error(error), () => {}, () => {}, () => {});
975
+ } else {
976
+ usesSyncReconciler = true;
977
+ hostRoot = getSyncReconciler().createContainer(hostContainer, mode, null, false, void 0, "", (error) => console.error(error), () => {}, () => {}, () => {});
978
+ }
975
979
  containerMap.set(cacheKey, {
976
980
  hostRoot,
977
981
  asyncJobCallback
@@ -1006,7 +1010,13 @@ const Renderer = { render(element, options = {}) {
1006
1010
  return render(element, options);
1007
1011
  } };
1008
1012
  const batchedUpdates = (...args) => getAsyncReconciler().batchedUpdates(...args);
1009
- const flushSync = (...args) => getAsyncReconciler().flushSync(...args);
1013
+ function flushSyncOn(rc, fn) {
1014
+ return typeof rc.flushSyncFromReconciler === "function" ? rc.flushSyncFromReconciler(fn) : rc.flushSync(fn);
1015
+ }
1016
+ function flushSync(fn) {
1017
+ const inner = usesSyncReconciler ? () => flushSyncOn(getSyncReconciler(), () => fn === null || fn === void 0 ? void 0 : fn()) : () => fn === null || fn === void 0 ? void 0 : fn();
1018
+ return flushSyncOn(getAsyncReconciler(), inner);
1019
+ }
1010
1020
  //#endregion
1011
1021
  //#region index.ts
1012
1022
  const ReactUnityRenderer = {