@reactunity/renderer 0.13.2 → 0.14.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.
Files changed (55) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.js +2 -1
  3. package/dist/src/helpers/dictionary-watcher.d.ts +17 -8
  4. package/dist/src/helpers/dictionary-watcher.js +50 -25
  5. package/dist/src/helpers/hooks/use-globals.d.ts +6 -0
  6. package/dist/src/helpers/hooks/use-globals.js +6 -0
  7. package/dist/src/helpers/hooks/use-watchable.d.ts +4 -0
  8. package/dist/src/helpers/hooks/use-watchable.js +26 -0
  9. package/dist/src/helpers/icons.d.ts +2 -2
  10. package/dist/src/models/base.d.ts +8 -8
  11. package/dist/src/models/editor/components.d.ts +2 -2
  12. package/dist/src/models/editor/events.d.ts +4 -4
  13. package/dist/src/models/editor/jsx.d.ts +5 -5
  14. package/dist/src/models/environment/dom/common.d.ts +5 -5
  15. package/dist/src/models/environment/dom/fetch.d.ts +10 -10
  16. package/dist/src/models/environment/dom/xhr.d.ts +2 -2
  17. package/dist/src/models/environment/interop.d.ts +2 -2
  18. package/dist/src/models/generated/editor.d.ts +15016 -11979
  19. package/dist/src/models/generated/editor.js +1 -1
  20. package/dist/src/models/generated/react.d.ts +1336 -417
  21. package/dist/src/models/generated/react.js +1 -1
  22. package/dist/src/models/generated/system.d.ts +2602 -2704
  23. package/dist/src/models/generated/system.js +2 -2
  24. package/dist/src/models/generated/tests.d.ts +228 -231
  25. package/dist/src/models/generated/tests.js +1 -1
  26. package/dist/src/models/generated/unity.d.ts +7998 -14519
  27. package/dist/src/models/generated/unity.js +2 -2
  28. package/dist/src/models/generated/yoga.d.ts +1 -1
  29. package/dist/src/models/generated/yoga.js +1 -1
  30. package/dist/src/models/properties/colors.d.ts +1 -1
  31. package/dist/src/models/properties/style.d.ts +7 -2
  32. package/dist/src/models/properties/styles-enums.d.ts +24 -19
  33. package/dist/src/models/properties/styles.d.ts +76 -60
  34. package/dist/src/models/properties/values.d.ts +16 -16
  35. package/dist/src/models/properties/yoga-enums.d.ts +8 -8
  36. package/dist/src/models/properties/yoga.d.ts +16 -16
  37. package/dist/src/models/renderer.d.ts +14 -14
  38. package/dist/src/models/richtext.d.ts +6 -2
  39. package/dist/src/models/svg.d.ts +2 -2
  40. package/dist/src/models/ugui/components.d.ts +1 -1
  41. package/dist/src/models/ugui/events.d.ts +7 -7
  42. package/dist/src/models/ugui/input.d.ts +6 -6
  43. package/dist/src/models/ugui/jsx.d.ts +2 -2
  44. package/dist/src/models/uitoolkit/components.d.ts +2 -2
  45. package/dist/src/models/uitoolkit/events.d.ts +4 -4
  46. package/dist/src/models/uitoolkit/jsx.d.ts +2 -2
  47. package/dist/src/renderer/async/commands.d.ts +14 -14
  48. package/dist/src/renderer/async/types.d.ts +10 -10
  49. package/dist/src/renderer/diffing.d.ts +1 -1
  50. package/dist/src/version.d.ts +1 -1
  51. package/dist/src/version.js +1 -1
  52. package/dist/src/views/default-view.js +1 -2
  53. package/package.json +5 -5
  54. package/dist/src/helpers/watcher.d.ts +0 -2
  55. package/dist/src/helpers/watcher.js +0 -14
@@ -1,11 +1,11 @@
1
- export declare type BatchUpdateProps = {
1
+ export type BatchUpdateProps = {
2
2
  [key: string]: string | number | object;
3
3
  };
4
- export declare type AsyncCallback = (...args: any[]) => any;
5
- export declare type BatchUpdateCallbacks = {
4
+ export type AsyncCallback = (...args: any[]) => any;
5
+ export type BatchUpdateCallbacks = {
6
6
  [key: string]: number;
7
7
  };
8
- declare type ApplyUpdatesParams = {
8
+ type ApplyUpdatesParams = {
9
9
  t: string;
10
10
  r: number;
11
11
  c?: string;
@@ -13,35 +13,35 @@ declare type ApplyUpdatesParams = {
13
13
  e?: BatchUpdateCallbacks;
14
14
  o?: BatchUpdateCallbacks;
15
15
  };
16
- export declare type CreateInstanceCommand = ['c', ApplyUpdatesParams & {
16
+ export type CreateInstanceCommand = ['c', ApplyUpdatesParams & {
17
17
  k?: string;
18
18
  }];
19
- export declare type CreateTextInstanceCommand = ['t', {
19
+ export type CreateTextInstanceCommand = ['t', {
20
20
  r: number;
21
21
  c?: string;
22
22
  }];
23
- export declare type AppendChildCommand = ['a', {
23
+ export type AppendChildCommand = ['a', {
24
24
  p: number;
25
25
  c: number;
26
26
  }];
27
- export declare type RemoveChildCommand = ['r', {
27
+ export type RemoveChildCommand = ['r', {
28
28
  p: number;
29
29
  c: number;
30
30
  }];
31
- export declare type InsertChildCommand = ['i', {
31
+ export type InsertChildCommand = ['i', {
32
32
  p: number;
33
33
  c: number;
34
34
  i?: number;
35
35
  }];
36
- export declare type ApplyUpdatesCommand = ['u', ApplyUpdatesParams];
37
- export declare type TextUpdateCommand = ['x', {
36
+ export type ApplyUpdatesCommand = ['u', ApplyUpdatesParams];
37
+ export type TextUpdateCommand = ['x', {
38
38
  r: number;
39
39
  c: string;
40
40
  }];
41
- export declare type ToggleHideCommand = ['h', {
41
+ export type ToggleHideCommand = ['h', {
42
42
  r: number;
43
43
  h: boolean;
44
44
  }];
45
- export declare type ClearContainerCommand = ['o'];
46
- export declare type BatchCommand = CreateInstanceCommand | CreateTextInstanceCommand | AppendChildCommand | RemoveChildCommand | InsertChildCommand | ApplyUpdatesCommand | TextUpdateCommand | ToggleHideCommand | ClearContainerCommand | null;
45
+ export type ClearContainerCommand = ['o'];
46
+ export type BatchCommand = CreateInstanceCommand | CreateTextInstanceCommand | AppendChildCommand | RemoveChildCommand | InsertChildCommand | ApplyUpdatesCommand | TextUpdateCommand | ToggleHideCommand | ClearContainerCommand | null;
47
47
  export {};
@@ -3,31 +3,31 @@ import { ReactUnity } from '../../models/generated';
3
3
  import { ChildSet, HydratableInstance, InstanceTag, NoTimeout, Props, TimeoutHandle, UpdatePayload } from '../../models/renderer';
4
4
  import { BatchCommand } from './commands';
5
5
  import { ObjectsRepo } from './objects';
6
- export declare type AsyncHostContext = AsyncNativeInstance | AsyncSubContext;
7
- export declare type AsyncInstance = AsyncNativeInstance | AsyncSubContext;
8
- export declare type AsyncNativeInstance = {
6
+ export type AsyncHostContext = AsyncNativeInstance | AsyncSubContext;
7
+ export type AsyncInstance = AsyncNativeInstance | AsyncSubContext;
8
+ export type AsyncNativeInstance = {
9
9
  context: ReactUnity.ReactContext;
10
10
  commands: BatchCommand[];
11
11
  refId: number;
12
12
  type: 'native';
13
13
  subContext?: AsyncSubContext;
14
14
  };
15
- export declare type AsyncSubContext = RichTextContext | SvgContext;
16
- export declare type RichTextContext = {
15
+ export type AsyncSubContext = RichTextContext | SvgContext;
16
+ export type RichTextContext = {
17
17
  hostContext: AsyncNativeInstance;
18
18
  type: 'richtext';
19
19
  node: RichTextNode;
20
20
  root: AsyncNativeInstance;
21
21
  parent: RichTextContext;
22
22
  };
23
- export declare type SvgContext = {
23
+ export type SvgContext = {
24
24
  hostContext: AsyncNativeInstance;
25
25
  type: 'svg';
26
26
  node: RichTextNode;
27
27
  root: AsyncNativeInstance;
28
28
  parent: SvgContext;
29
29
  };
30
- export declare type RichTextNode = ({
30
+ export type RichTextNode = ({
31
31
  tag: string;
32
32
  attributes: Record<string, any>;
33
33
  children: RichTextNode[];
@@ -36,10 +36,10 @@ export declare type RichTextNode = ({
36
36
  text: string;
37
37
  hidden?: boolean;
38
38
  });
39
- export declare type AsyncContainerInstance = AsyncNativeInstance & {
39
+ export type AsyncContainerInstance = AsyncNativeInstance & {
40
40
  component: ReactUnity.IReactComponent;
41
41
  fiberCache: ObjectsRepo | null;
42
42
  };
43
- declare type AsyncPublicInstance = ReactUnity.IReactComponent;
44
- export declare type AsyncReconcilerConfig = Reconciler.HostConfig<InstanceTag, Props, AsyncContainerInstance, AsyncInstance, AsyncInstance, AsyncNativeInstance, HydratableInstance, AsyncPublicInstance, AsyncHostContext, UpdatePayload, ChildSet, TimeoutHandle, NoTimeout>;
43
+ type AsyncPublicInstance = ReactUnity.IReactComponent;
44
+ export type AsyncReconcilerConfig = Reconciler.HostConfig<InstanceTag, Props, AsyncContainerInstance, AsyncInstance, AsyncInstance, AsyncNativeInstance, HydratableInstance, AsyncPublicInstance, AsyncHostContext, UpdatePayload, ChildSet, TimeoutHandle, NoTimeout>;
45
45
  export {};
@@ -1,3 +1,3 @@
1
- export declare type DiffResult = null | Record<string, any>;
1
+ export type DiffResult = null | Record<string, any>;
2
2
  export declare const styleStringSymbol = "__style_as_string__";
3
3
  export declare function diffProperties(lastProps: Record<string, any>, nextProps: Record<string, any>, deepDiffing?: number): DiffResult;
@@ -1 +1 @@
1
- export declare const version = "0.13.2";
1
+ export declare const version = "0.14.1";
@@ -1 +1 @@
1
- export var version = '0.13.2';
1
+ export var version = '0.14.1';
@@ -1,8 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { GlobalsProvider } from '../helpers/dictionary-watcher';
3
2
  import { ErrorBoundary } from './error-boundary';
4
3
  export function DefaultView(_a) {
5
4
  var children = _a.children, withHelpers = _a.withHelpers;
6
5
  return _jsx(_Fragment, { children: !withHelpers ? children :
7
- _jsx(ErrorBoundary, { children: _jsx(GlobalsProvider, { children: children }) }) });
6
+ _jsx(ErrorBoundary, { children: children }) });
8
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactunity/renderer",
3
- "version": "0.13.2",
3
+ "version": "0.14.1",
4
4
  "description": "React renderer for Unity3D",
5
5
  "types": "dist/index.d.ts",
6
6
  "typings": "dist/index.d.ts",
@@ -61,9 +61,9 @@
61
61
  "react": "^18.0.0"
62
62
  },
63
63
  "devDependencies": {
64
- "@reactunity/scripts": "^0.13.0",
65
- "@types/react-reconciler": "^0.28.0",
66
- "rimraf": "^3.0.2",
67
- "typescript": "^4.8.3"
64
+ "@reactunity/scripts": "^0.14.0",
65
+ "@types/react-reconciler": "^0.28.2",
66
+ "rimraf": "^4.1.2",
67
+ "typescript": "^4.9.5"
68
68
  }
69
69
  }
@@ -1,2 +0,0 @@
1
- import { ReactUnity } from '../models/generated';
2
- export declare function useWatchable<T>(obj: ReactUnity.Helpers.IWatchable<T>): T;
@@ -1,14 +0,0 @@
1
- import { useCallback, useMemo } from 'react';
2
- import { useSyncExternalStore } from 'use-sync-external-store/shim';
3
- export function useWatchable(obj) {
4
- var isWatchable = useMemo(function () { return obj && typeof obj === 'object' && ('Value' in obj); }, [obj]);
5
- var subscribe = useCallback(function (onStoreChange) {
6
- if (isWatchable && 'AddListener' in obj) {
7
- var unsub_1 = obj.AddListener(function () { return onStoreChange(); });
8
- return function () { return unsub_1 === null || unsub_1 === void 0 ? void 0 : unsub_1(); };
9
- }
10
- return function () { };
11
- }, [obj, isWatchable]);
12
- var getSnapshot = useCallback(function () { return isWatchable ? obj.Value : undefined; }, [obj, isWatchable]);
13
- return useSyncExternalStore(subscribe, getSnapshot);
14
- }