@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.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/src/helpers/dictionary-watcher.d.ts +17 -8
- package/dist/src/helpers/dictionary-watcher.js +50 -25
- package/dist/src/helpers/hooks/use-globals.d.ts +6 -0
- package/dist/src/helpers/hooks/use-globals.js +6 -0
- package/dist/src/helpers/hooks/use-watchable.d.ts +4 -0
- package/dist/src/helpers/hooks/use-watchable.js +26 -0
- package/dist/src/helpers/icons.d.ts +2 -2
- package/dist/src/models/base.d.ts +8 -8
- package/dist/src/models/editor/components.d.ts +2 -2
- package/dist/src/models/editor/events.d.ts +4 -4
- package/dist/src/models/editor/jsx.d.ts +5 -5
- package/dist/src/models/environment/dom/common.d.ts +5 -5
- package/dist/src/models/environment/dom/fetch.d.ts +10 -10
- package/dist/src/models/environment/dom/xhr.d.ts +2 -2
- package/dist/src/models/environment/interop.d.ts +2 -2
- package/dist/src/models/generated/editor.d.ts +15016 -11979
- package/dist/src/models/generated/editor.js +1 -1
- package/dist/src/models/generated/react.d.ts +1336 -417
- package/dist/src/models/generated/react.js +1 -1
- package/dist/src/models/generated/system.d.ts +2602 -2704
- package/dist/src/models/generated/system.js +2 -2
- package/dist/src/models/generated/tests.d.ts +228 -231
- package/dist/src/models/generated/tests.js +1 -1
- package/dist/src/models/generated/unity.d.ts +7998 -14519
- package/dist/src/models/generated/unity.js +2 -2
- package/dist/src/models/generated/yoga.d.ts +1 -1
- package/dist/src/models/generated/yoga.js +1 -1
- package/dist/src/models/properties/colors.d.ts +1 -1
- package/dist/src/models/properties/style.d.ts +7 -2
- package/dist/src/models/properties/styles-enums.d.ts +24 -19
- package/dist/src/models/properties/styles.d.ts +76 -60
- package/dist/src/models/properties/values.d.ts +16 -16
- package/dist/src/models/properties/yoga-enums.d.ts +8 -8
- package/dist/src/models/properties/yoga.d.ts +16 -16
- package/dist/src/models/renderer.d.ts +14 -14
- package/dist/src/models/richtext.d.ts +6 -2
- package/dist/src/models/svg.d.ts +2 -2
- package/dist/src/models/ugui/components.d.ts +1 -1
- package/dist/src/models/ugui/events.d.ts +7 -7
- package/dist/src/models/ugui/input.d.ts +6 -6
- package/dist/src/models/ugui/jsx.d.ts +2 -2
- package/dist/src/models/uitoolkit/components.d.ts +2 -2
- package/dist/src/models/uitoolkit/events.d.ts +4 -4
- package/dist/src/models/uitoolkit/jsx.d.ts +2 -2
- package/dist/src/renderer/async/commands.d.ts +14 -14
- package/dist/src/renderer/async/types.d.ts +10 -10
- package/dist/src/renderer/diffing.d.ts +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/views/default-view.js +1 -2
- package/package.json +5 -5
- package/dist/src/helpers/watcher.d.ts +0 -2
- package/dist/src/helpers/watcher.js +0 -14
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type BatchUpdateProps = {
|
|
2
2
|
[key: string]: string | number | object;
|
|
3
3
|
};
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type AsyncCallback = (...args: any[]) => any;
|
|
5
|
+
export type BatchUpdateCallbacks = {
|
|
6
6
|
[key: string]: number;
|
|
7
7
|
};
|
|
8
|
-
|
|
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
|
|
16
|
+
export type CreateInstanceCommand = ['c', ApplyUpdatesParams & {
|
|
17
17
|
k?: string;
|
|
18
18
|
}];
|
|
19
|
-
export
|
|
19
|
+
export type CreateTextInstanceCommand = ['t', {
|
|
20
20
|
r: number;
|
|
21
21
|
c?: string;
|
|
22
22
|
}];
|
|
23
|
-
export
|
|
23
|
+
export type AppendChildCommand = ['a', {
|
|
24
24
|
p: number;
|
|
25
25
|
c: number;
|
|
26
26
|
}];
|
|
27
|
-
export
|
|
27
|
+
export type RemoveChildCommand = ['r', {
|
|
28
28
|
p: number;
|
|
29
29
|
c: number;
|
|
30
30
|
}];
|
|
31
|
-
export
|
|
31
|
+
export type InsertChildCommand = ['i', {
|
|
32
32
|
p: number;
|
|
33
33
|
c: number;
|
|
34
34
|
i?: number;
|
|
35
35
|
}];
|
|
36
|
-
export
|
|
37
|
-
export
|
|
36
|
+
export type ApplyUpdatesCommand = ['u', ApplyUpdatesParams];
|
|
37
|
+
export type TextUpdateCommand = ['x', {
|
|
38
38
|
r: number;
|
|
39
39
|
c: string;
|
|
40
40
|
}];
|
|
41
|
-
export
|
|
41
|
+
export type ToggleHideCommand = ['h', {
|
|
42
42
|
r: number;
|
|
43
43
|
h: boolean;
|
|
44
44
|
}];
|
|
45
|
-
export
|
|
46
|
-
export
|
|
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
|
|
7
|
-
export
|
|
8
|
-
export
|
|
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
|
|
16
|
-
export
|
|
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
|
|
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
|
|
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
|
|
39
|
+
export type AsyncContainerInstance = AsyncNativeInstance & {
|
|
40
40
|
component: ReactUnity.IReactComponent;
|
|
41
41
|
fiberCache: ObjectsRepo | null;
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
export
|
|
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
|
|
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;
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.14.1";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '0.
|
|
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:
|
|
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.
|
|
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.
|
|
65
|
-
"@types/react-reconciler": "^0.28.
|
|
66
|
-
"rimraf": "^
|
|
67
|
-
"typescript": "^4.
|
|
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,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
|
-
}
|