@reactunity/renderer 0.15.2 → 0.16.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/editor/index.d.ts +1 -0
- package/dist/editor/index.js +17 -0
- package/dist/editor/jsx-dev-runtime.d.ts +2 -0
- package/dist/editor/jsx-dev-runtime.js +17 -0
- package/dist/editor/jsx-runtime.d.ts +2 -0
- package/dist/editor/jsx-runtime.js +17 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.js +31 -9
- package/dist/src/helpers/dictionary-watcher.d.ts +66 -66
- package/dist/src/helpers/dictionary-watcher.js +104 -98
- package/dist/src/helpers/hooks/use-globals.d.ts +6 -6
- package/dist/src/helpers/hooks/use-globals.js +9 -6
- package/dist/src/helpers/hooks/use-reactive-value.d.ts +4 -4
- package/dist/src/helpers/hooks/use-reactive-value.js +31 -27
- package/dist/src/helpers/icons.d.ts +11 -7
- package/dist/src/helpers/icons.js +32 -29
- package/dist/src/models/base.d.ts +56 -56
- package/dist/src/models/base.js +3 -2
- package/dist/src/models/editor/components.d.ts +22 -22
- package/dist/src/models/editor/components.js +2 -1
- package/dist/src/models/editor/environment.d.ts +9 -10
- package/dist/src/models/editor/environment.js +2 -1
- package/dist/src/models/editor/index.d.ts +3 -3
- package/dist/src/models/editor/index.js +19 -3
- package/dist/src/models/editor/jsx.d.ts +111 -104
- package/dist/src/models/editor/jsx.js +2 -1
- package/dist/src/models/environment/dom/common.d.ts +85 -85
- package/dist/src/models/environment/dom/common.js +2 -1
- package/dist/src/models/environment/dom/fetch.d.ts +111 -111
- package/dist/src/models/environment/dom/fetch.js +2 -1
- package/dist/src/models/environment/dom/global.d.ts +11 -11
- package/dist/src/models/environment/dom/global.js +2 -1
- package/dist/src/models/environment/dom/xhr.d.ts +161 -161
- package/dist/src/models/environment/dom/xhr.js +2 -1
- package/dist/src/models/environment/index.d.ts +43 -47
- package/dist/src/models/environment/index.js +18 -3
- package/dist/src/models/environment/interop.d.ts +23 -23
- package/dist/src/models/environment/interop.js +2 -1
- package/dist/src/models/generated/editor.d.ts +18501 -18501
- package/dist/src/models/generated/editor.js +7 -6
- package/dist/src/models/generated/index.d.ts +6 -6
- package/dist/src/models/generated/index.js +22 -6
- package/dist/src/models/generated/react.d.ts +15214 -15214
- package/dist/src/models/generated/react.js +7 -6
- package/dist/src/models/generated/system.d.ts +36731 -36731
- package/dist/src/models/generated/system.js +7 -6
- package/dist/src/models/generated/tests.d.ts +5023 -5023
- package/dist/src/models/generated/tests.js +7 -6
- package/dist/src/models/generated/unity.d.ts +43446 -43446
- package/dist/src/models/generated/unity.js +7 -6
- package/dist/src/models/generated/yoga.d.ts +368 -368
- package/dist/src/models/generated/yoga.js +7 -6
- package/dist/src/models/properties/colors.d.ts +150 -150
- package/dist/src/models/properties/colors.js +2 -1
- package/dist/src/models/properties/common.d.ts +2 -2
- package/dist/src/models/properties/common.js +2 -1
- package/dist/src/models/properties/index.d.ts +7 -7
- package/dist/src/models/properties/index.js +23 -7
- package/dist/src/models/properties/style.d.ts +10 -10
- package/dist/src/models/properties/style.js +2 -1
- package/dist/src/models/properties/styles-enums.d.ts +23 -23
- package/dist/src/models/properties/styles-enums.js +2 -1
- package/dist/src/models/properties/styles.d.ts +127 -127
- package/dist/src/models/properties/styles.js +2 -1
- package/dist/src/models/properties/values.d.ts +24 -24
- package/dist/src/models/properties/values.js +2 -1
- package/dist/src/models/properties/yoga-enums.d.ts +8 -8
- package/dist/src/models/properties/yoga-enums.js +2 -1
- package/dist/src/models/properties/yoga.d.ts +66 -66
- package/dist/src/models/properties/yoga.js +2 -1
- package/dist/src/models/renderer.d.ts +20 -20
- package/dist/src/models/renderer.js +2 -1
- package/dist/src/models/richtext.d.ts +69 -69
- package/dist/src/models/richtext.js +3 -2
- package/dist/src/models/svg.d.ts +68 -68
- package/dist/src/models/svg.js +2 -1
- package/dist/src/models/tests/index.d.ts +12 -12
- package/dist/src/models/tests/index.js +2 -1
- package/dist/src/models/ugui/components.d.ts +86 -86
- package/dist/src/models/ugui/components.js +2 -1
- package/dist/src/models/ugui/events.d.ts +74 -74
- package/dist/src/models/ugui/events.js +3 -2
- package/dist/src/models/ugui/index.d.ts +4 -4
- package/dist/src/models/ugui/index.js +20 -4
- package/dist/src/models/ugui/input.d.ts +26 -26
- package/dist/src/models/ugui/input.js +2 -1
- package/dist/src/models/ugui/jsx.d.ts +67 -60
- package/dist/src/models/ugui/jsx.js +2 -1
- package/dist/src/models/uitoolkit/components.d.ts +82 -82
- package/dist/src/models/uitoolkit/components.js +2 -1
- package/dist/src/models/uitoolkit/events.d.ts +64 -64
- package/dist/src/models/uitoolkit/events.js +2 -1
- package/dist/src/models/uitoolkit/index.d.ts +3 -3
- package/dist/src/models/uitoolkit/index.js +19 -3
- package/dist/src/models/uitoolkit/jsx.d.ts +71 -64
- package/dist/src/models/uitoolkit/jsx.js +2 -1
- package/dist/src/renderer/async/callbacks.d.ts +5 -6
- package/dist/src/renderer/async/callbacks.js +55 -52
- package/dist/src/renderer/async/commands.d.ts +98 -47
- package/dist/src/renderer/async/commands.js +2 -1
- package/dist/src/renderer/async/objects.d.ts +7 -8
- package/dist/src/renderer/async/objects.js +34 -31
- package/dist/src/renderer/async/reconciler.d.ts +2 -2
- package/dist/src/renderer/async/reconciler.js +307 -283
- package/dist/src/renderer/async/serializer.d.ts +6 -9
- package/dist/src/renderer/async/serializer.js +35 -31
- package/dist/src/renderer/async/types.d.ts +45 -45
- package/dist/src/renderer/async/types.js +2 -1
- package/dist/src/renderer/constants.d.ts +30 -30
- package/dist/src/renderer/constants.js +75 -70
- package/dist/src/renderer/diffing.d.ts +3 -3
- package/dist/src/renderer/diffing.js +87 -83
- package/dist/src/renderer/renderer.d.ts +26 -26
- package/dist/src/renderer/renderer.js +97 -93
- package/dist/src/renderer/subcontexts/index.d.ts +6 -6
- package/dist/src/renderer/subcontexts/index.js +9 -6
- package/dist/src/renderer/subcontexts/richtext.d.ts +3 -3
- package/dist/src/renderer/subcontexts/richtext.js +57 -52
- package/dist/src/renderer/subcontexts/svg.d.ts +3 -3
- package/dist/src/renderer/subcontexts/svg.js +75 -70
- package/dist/src/renderer/sync/reconciler.d.ts +2 -2
- package/dist/src/renderer/sync/reconciler.js +38 -35
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +4 -1
- package/dist/src/views/default-view.d.ts +8 -8
- package/dist/src/views/default-view.js +11 -7
- package/dist/src/views/error-boundary.d.ts +10 -10
- package/dist/src/views/error-boundary.js +45 -53
- package/dist/src/webgl-compat/error-messages.d.ts +9 -9
- package/dist/src/webgl-compat/error-messages.js +13 -10
- package/dist/src/webgl-compat/index.d.ts +13 -13
- package/dist/src/webgl-compat/index.js +13 -8
- package/dist/src/webgl-compat/types.d.ts +21 -21
- package/dist/src/webgl-compat/types.js +2 -1
- package/dist/src/webgl-compat/use-event-system.d.ts +3 -3
- package/dist/src/webgl-compat/use-event-system.js +82 -76
- package/dist/src/webgl-compat/use-unity-context.d.ts +31 -31
- package/dist/src/webgl-compat/use-unity-context.js +96 -91
- package/dist/tests.d.ts +1 -1
- package/dist/tests.js +17 -1
- package/dist/ugui/index.d.ts +1 -0
- package/dist/ugui/index.js +17 -0
- package/dist/ugui/jsx-dev-runtime.d.ts +2 -0
- package/dist/ugui/jsx-dev-runtime.js +17 -0
- package/dist/ugui/jsx-runtime.d.ts +2 -0
- package/dist/ugui/jsx-runtime.js +17 -0
- package/dist/uitoolkit/index.d.ts +1 -0
- package/dist/uitoolkit/index.js +17 -0
- package/dist/uitoolkit/jsx-dev-runtime.d.ts +2 -0
- package/dist/uitoolkit/jsx-dev-runtime.js +17 -0
- package/dist/uitoolkit/jsx-runtime.d.ts +2 -0
- package/dist/uitoolkit/jsx-runtime.js +17 -0
- package/dist/webgl-compat.d.ts +1 -1
- package/dist/webgl-compat.js +17 -1
- package/package.json +16 -32
- package/dist/editor.d.ts +0 -1
- package/dist/editor.js +0 -1
- package/dist/src/models/environment/jsx.d.ts +0 -45
- package/dist/src/models/environment/jsx.js +0 -1
- package/dist/ugui.d.ts +0 -1
- package/dist/ugui.js +0 -1
- package/dist/uitoolkit.d.ts +0 -1
- package/dist/uitoolkit.js +0 -1
- package/editor.ts +0 -1
- package/tests.ts +0 -1
- package/tsconfig.editor.json +0 -6
- package/tsconfig.ugui.json +0 -6
- package/tsconfig.uitoolkit.json +0 -6
- package/ugui.ts +0 -1
- package/uitoolkit.ts +0 -1
- package/version.js +0 -3
- package/webgl-compat.ts +0 -1
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(res.p || (res.p = {}))[key] =
|
|
16
|
-
}
|
|
17
|
-
else if (key
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
(res.
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertPropsToSerializable = exports.objectsRepo = exports.callbacksRepo = void 0;
|
|
4
|
+
var callbacks_1 = require("./callbacks");
|
|
5
|
+
var objects_1 = require("./objects");
|
|
6
|
+
exports.callbacksRepo = new callbacks_1.CallbacksRepo();
|
|
7
|
+
exports.objectsRepo = new objects_1.ObjectsRepo();
|
|
8
|
+
// Separates properties in 3 categories: regular props, callbacks and non-serializable objects
|
|
9
|
+
function convertPropsToSerializable(props) {
|
|
10
|
+
var res = {};
|
|
11
|
+
for (var key in props) {
|
|
12
|
+
if (Object.prototype.hasOwnProperty.call(props, key)) {
|
|
13
|
+
var value = props[key];
|
|
14
|
+
if (value == null) {
|
|
15
|
+
(res.p || (res.p = {}))[key] = null;
|
|
16
|
+
}
|
|
17
|
+
else if (key === 'style') {
|
|
18
|
+
(res.p || (res.p = {}))[key] = convertPropsToSerializable(value);
|
|
19
|
+
}
|
|
20
|
+
else if (key[0] === 'o' && key[1] === 'n' && typeof value === 'function') {
|
|
21
|
+
var ind = exports.callbacksRepo.addObject(value);
|
|
22
|
+
(res.e || (res.e = {}))[key] = ind;
|
|
23
|
+
}
|
|
24
|
+
else if (typeof value === 'object' || typeof value === 'function') {
|
|
25
|
+
var ind = exports.objectsRepo.addObject(value);
|
|
26
|
+
(res.o || (res.o = {}))[key] = ind;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
(res.p || (res.p = {}))[key] = value;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return res;
|
|
34
|
+
}
|
|
35
|
+
exports.convertPropsToSerializable = convertPropsToSerializable;
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import * as Reconciler from 'react-reconciler';
|
|
2
|
-
import { ReactUnity } from '../../models/generated';
|
|
3
|
-
import { ChildSet, HydratableInstance, InstanceTag, NoTimeout, Props, TimeoutHandle, UpdatePayload } from '../../models/renderer';
|
|
4
|
-
import { BatchCommand } from './commands';
|
|
5
|
-
import { ObjectsRepo } from './objects';
|
|
6
|
-
export type AsyncHostContext = AsyncNativeInstance | AsyncSubContext;
|
|
7
|
-
export type AsyncInstance = AsyncNativeInstance | AsyncSubContext;
|
|
8
|
-
export type AsyncNativeInstance = {
|
|
9
|
-
context: ReactUnity.ReactContext;
|
|
10
|
-
commands: BatchCommand[];
|
|
11
|
-
refId: number;
|
|
12
|
-
type: 'native';
|
|
13
|
-
subContext?: AsyncSubContext;
|
|
14
|
-
};
|
|
15
|
-
export type AsyncSubContext = RichTextContext | SvgContext;
|
|
16
|
-
export type RichTextContext = {
|
|
17
|
-
hostContext: AsyncNativeInstance;
|
|
18
|
-
type: 'richtext';
|
|
19
|
-
node: RichTextNode;
|
|
20
|
-
root: AsyncNativeInstance;
|
|
21
|
-
parent: RichTextContext;
|
|
22
|
-
};
|
|
23
|
-
export type SvgContext = {
|
|
24
|
-
hostContext: AsyncNativeInstance;
|
|
25
|
-
type: 'svg';
|
|
26
|
-
node: RichTextNode;
|
|
27
|
-
root: AsyncNativeInstance;
|
|
28
|
-
parent: SvgContext;
|
|
29
|
-
};
|
|
30
|
-
export type RichTextNode = ({
|
|
31
|
-
tag: string;
|
|
32
|
-
attributes: Record<string, any>;
|
|
33
|
-
children: RichTextNode[];
|
|
34
|
-
hidden?: boolean;
|
|
35
|
-
} | {
|
|
36
|
-
text: string;
|
|
37
|
-
hidden?: boolean;
|
|
38
|
-
});
|
|
39
|
-
export type AsyncContainerInstance = AsyncNativeInstance & {
|
|
40
|
-
component: ReactUnity.IReactComponent;
|
|
41
|
-
fiberCache: ObjectsRepo | null;
|
|
42
|
-
};
|
|
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
|
-
export {};
|
|
1
|
+
import * as Reconciler from 'react-reconciler';
|
|
2
|
+
import { ReactUnity } from '../../models/generated';
|
|
3
|
+
import { ChildSet, HydratableInstance, InstanceTag, NoTimeout, Props, TimeoutHandle, UpdatePayload } from '../../models/renderer';
|
|
4
|
+
import { BatchCommand } from './commands';
|
|
5
|
+
import { ObjectsRepo } from './objects';
|
|
6
|
+
export type AsyncHostContext = AsyncNativeInstance | AsyncSubContext;
|
|
7
|
+
export type AsyncInstance = AsyncNativeInstance | AsyncSubContext;
|
|
8
|
+
export type AsyncNativeInstance = {
|
|
9
|
+
context: ReactUnity.ReactContext;
|
|
10
|
+
commands: BatchCommand[];
|
|
11
|
+
refId: number;
|
|
12
|
+
type: 'native';
|
|
13
|
+
subContext?: AsyncSubContext;
|
|
14
|
+
};
|
|
15
|
+
export type AsyncSubContext = RichTextContext | SvgContext;
|
|
16
|
+
export type RichTextContext = {
|
|
17
|
+
hostContext: AsyncNativeInstance;
|
|
18
|
+
type: 'richtext';
|
|
19
|
+
node: RichTextNode;
|
|
20
|
+
root: AsyncNativeInstance;
|
|
21
|
+
parent: RichTextContext;
|
|
22
|
+
};
|
|
23
|
+
export type SvgContext = {
|
|
24
|
+
hostContext: AsyncNativeInstance;
|
|
25
|
+
type: 'svg';
|
|
26
|
+
node: RichTextNode;
|
|
27
|
+
root: AsyncNativeInstance;
|
|
28
|
+
parent: SvgContext;
|
|
29
|
+
};
|
|
30
|
+
export type RichTextNode = ({
|
|
31
|
+
tag: string;
|
|
32
|
+
attributes: Record<string, any>;
|
|
33
|
+
children: RichTextNode[];
|
|
34
|
+
hidden?: boolean;
|
|
35
|
+
} | {
|
|
36
|
+
text: string;
|
|
37
|
+
hidden?: boolean;
|
|
38
|
+
});
|
|
39
|
+
export type AsyncContainerInstance = AsyncNativeInstance & {
|
|
40
|
+
component: ReactUnity.IReactComponent;
|
|
41
|
+
fiberCache: ObjectsRepo | null;
|
|
42
|
+
};
|
|
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
|
+
export {};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { PoolKey } from '../models/base';
|
|
2
|
-
export declare const hideClass = "react-unity__renderer__hidden";
|
|
3
|
-
export declare const eventPriorities: {
|
|
4
|
-
discrete: number;
|
|
5
|
-
continuous: number;
|
|
6
|
-
default: number;
|
|
7
|
-
idle: number;
|
|
8
|
-
};
|
|
9
|
-
export declare const textTypes: {
|
|
10
|
-
text: boolean;
|
|
11
|
-
icon: boolean;
|
|
12
|
-
style: boolean;
|
|
13
|
-
script: boolean;
|
|
14
|
-
};
|
|
15
|
-
export declare function stringizePoolKey(key: PoolKey): string;
|
|
16
|
-
export declare function getAllowedProps(props: any, type: any): any;
|
|
17
|
-
export declare const commonReconciler: {
|
|
18
|
-
now: () => number;
|
|
19
|
-
getCurrentEventPriority: () => number;
|
|
20
|
-
noTimeout: -1;
|
|
21
|
-
scheduleTimeout: (callback: any, delay: any) => number;
|
|
22
|
-
scheduleMicrotask: (callback: (...args: any[]) => any) => void;
|
|
23
|
-
cancelTimeout: (handle: any) => void;
|
|
24
|
-
beforeActiveInstanceBlur(): void;
|
|
25
|
-
afterActiveInstanceBlur(): void;
|
|
26
|
-
getInstanceFromNode(node: any): any;
|
|
27
|
-
getInstanceFromScope(scopeInstance: any): any;
|
|
28
|
-
prepareScopeUpdate(scopeInstance: any, instance: any): void;
|
|
29
|
-
};
|
|
30
|
-
export declare const isDevelopment: boolean;
|
|
1
|
+
import { PoolKey } from '../models/base';
|
|
2
|
+
export declare const hideClass = "react-unity__renderer__hidden";
|
|
3
|
+
export declare const eventPriorities: {
|
|
4
|
+
discrete: number;
|
|
5
|
+
continuous: number;
|
|
6
|
+
default: number;
|
|
7
|
+
idle: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const textTypes: {
|
|
10
|
+
text: boolean;
|
|
11
|
+
icon: boolean;
|
|
12
|
+
style: boolean;
|
|
13
|
+
script: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function stringizePoolKey(key: PoolKey): string;
|
|
16
|
+
export declare function getAllowedProps(props: any, type: any): any;
|
|
17
|
+
export declare const commonReconciler: {
|
|
18
|
+
now: () => number;
|
|
19
|
+
getCurrentEventPriority: () => number;
|
|
20
|
+
noTimeout: -1;
|
|
21
|
+
scheduleTimeout: (callback: any, delay: any) => number;
|
|
22
|
+
scheduleMicrotask: (callback: (...args: any[]) => any) => void;
|
|
23
|
+
cancelTimeout: (handle: any) => void;
|
|
24
|
+
beforeActiveInstanceBlur(): void;
|
|
25
|
+
afterActiveInstanceBlur(): void;
|
|
26
|
+
getInstanceFromNode(node: any): any;
|
|
27
|
+
getInstanceFromScope(scopeInstance: any): any;
|
|
28
|
+
prepareScopeUpdate(scopeInstance: any, instance: any): void;
|
|
29
|
+
};
|
|
30
|
+
export declare const isDevelopment: boolean;
|
|
@@ -1,70 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
case '
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.isDevelopment = exports.commonReconciler = exports.getAllowedProps = exports.stringizePoolKey = exports.textTypes = exports.eventPriorities = exports.hideClass = void 0;
|
|
15
|
+
var constants_1 = require("react-reconciler/constants");
|
|
16
|
+
var diffing_1 = require("./diffing");
|
|
17
|
+
exports.hideClass = 'react-unity__renderer__hidden';
|
|
18
|
+
exports.eventPriorities = {
|
|
19
|
+
discrete: constants_1.DiscreteEventPriority,
|
|
20
|
+
continuous: constants_1.ContinuousEventPriority,
|
|
21
|
+
default: constants_1.DefaultEventPriority,
|
|
22
|
+
idle: constants_1.IdleEventPriority,
|
|
23
|
+
};
|
|
24
|
+
exports.textTypes = {
|
|
25
|
+
text: true,
|
|
26
|
+
icon: true,
|
|
27
|
+
style: true,
|
|
28
|
+
script: true,
|
|
29
|
+
};
|
|
30
|
+
function stringizePoolKey(key) {
|
|
31
|
+
switch (typeof key) {
|
|
32
|
+
case 'string': return key;
|
|
33
|
+
case 'boolean': return key ? 'default' : '';
|
|
34
|
+
case 'number': return key.toString();
|
|
35
|
+
case 'undefined': return null;
|
|
36
|
+
default: return '';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.stringizePoolKey = stringizePoolKey;
|
|
40
|
+
function getAllowedProps(props, type) {
|
|
41
|
+
var children = props.children, tag = props.tag, pool = props.pool, rest = __rest(props, ["children", "tag", "pool"]);
|
|
42
|
+
if (exports.textTypes[type] && 'children' in props) {
|
|
43
|
+
rest.children = (!children || typeof children === 'boolean') ? null : Array.isArray(children) ? children.join('') : children + '';
|
|
44
|
+
}
|
|
45
|
+
if (typeof props.style === 'string')
|
|
46
|
+
rest[diffing_1.styleStringSymbol] = props.style;
|
|
47
|
+
return rest;
|
|
48
|
+
}
|
|
49
|
+
exports.getAllowedProps = getAllowedProps;
|
|
50
|
+
exports.commonReconciler = {
|
|
51
|
+
// -------------------
|
|
52
|
+
// Scheduling
|
|
53
|
+
// -------------------
|
|
54
|
+
now: Date.now,
|
|
55
|
+
getCurrentEventPriority: function () { return UnityBridge.CurrentEventPriority || exports.eventPriorities.default; },
|
|
56
|
+
noTimeout: -1,
|
|
57
|
+
scheduleTimeout: function (callback, delay) { return setTimeout(callback, delay); },
|
|
58
|
+
scheduleMicrotask: typeof queueMicrotask === 'function' ? queueMicrotask :
|
|
59
|
+
function (callback) { return Promise.resolve(null).then(callback)
|
|
60
|
+
.catch(function (error) { return setTimeout(function () { throw error; }, 0); }); },
|
|
61
|
+
cancelTimeout: function (handle) { return clearTimeout(handle); },
|
|
62
|
+
beforeActiveInstanceBlur: function () {
|
|
63
|
+
},
|
|
64
|
+
afterActiveInstanceBlur: function () {
|
|
65
|
+
},
|
|
66
|
+
getInstanceFromNode: function (node) {
|
|
67
|
+
return undefined;
|
|
68
|
+
},
|
|
69
|
+
getInstanceFromScope: function (scopeInstance) {
|
|
70
|
+
return undefined;
|
|
71
|
+
},
|
|
72
|
+
prepareScopeUpdate: function (scopeInstance, instance) {
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
exports.isDevelopment = process.env.NODE_ENV === 'development';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type DiffResult = null | Record<string, any>;
|
|
2
|
-
export declare const styleStringSymbol = "__style_as_string__";
|
|
3
|
-
export declare function diffProperties(lastProps: Record<string, any>, nextProps: Record<string, any>, deepDiffing?: number): DiffResult;
|
|
1
|
+
export type DiffResult = null | Record<string, any>;
|
|
2
|
+
export declare const styleStringSymbol = "__style_as_string__";
|
|
3
|
+
export declare function diffProperties(lastProps: Record<string, any>, nextProps: Record<string, any>, deepDiffing?: number): DiffResult;
|
|
@@ -1,83 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.diffProperties = exports.styleStringSymbol = void 0;
|
|
4
|
+
exports.styleStringSymbol = '__style_as_string__';
|
|
5
|
+
var propDepths = {
|
|
6
|
+
style: 1,
|
|
7
|
+
data: 1,
|
|
8
|
+
custom: 1,
|
|
9
|
+
};
|
|
10
|
+
function diffProperties(lastProps, nextProps, deepDiffing) {
|
|
11
|
+
if (deepDiffing === void 0) { deepDiffing = 0; }
|
|
12
|
+
if (lastProps === nextProps)
|
|
13
|
+
return null;
|
|
14
|
+
var updatePayload = null;
|
|
15
|
+
var propKey;
|
|
16
|
+
for (propKey in lastProps) {
|
|
17
|
+
// This loop is for removing properties that existed in the previous properties, but not on current
|
|
18
|
+
if (nextProps.hasOwnProperty(propKey)
|
|
19
|
+
|| !lastProps.hasOwnProperty(propKey)
|
|
20
|
+
|| lastProps[propKey] == null) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
var prop = null;
|
|
24
|
+
// If style existed in the previous properties as string, set it to null
|
|
25
|
+
if (propKey === 'style' && typeof lastProps.style === 'string') {
|
|
26
|
+
(updatePayload = updatePayload || {})[exports.styleStringSymbol] = null;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
var depth = deepDiffing > 0 ? deepDiffing : (propDepths[propKey] || 0);
|
|
30
|
+
if (depth > 0) {
|
|
31
|
+
prop = diffProperties(lastProps[propKey], {}, depth - 1);
|
|
32
|
+
if (!prop)
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
// For all other deleted properties we add it to the queue. We use
|
|
36
|
+
// the whitelist in the commit phase instead.
|
|
37
|
+
(updatePayload = updatePayload || {})[propKey] = prop;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
for (propKey in nextProps) {
|
|
41
|
+
// This loop is for finding difference between current properties and previous properties
|
|
42
|
+
var nextProp = nextProps[propKey];
|
|
43
|
+
var lastProp = lastProps != null ? lastProps[propKey] : undefined;
|
|
44
|
+
if (!nextProps.hasOwnProperty(propKey)
|
|
45
|
+
|| nextProp === lastProp
|
|
46
|
+
|| (nextProp == null && lastProp == null)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
var prop = nextProp;
|
|
50
|
+
if (propKey === 'style') {
|
|
51
|
+
var prevWasString = (typeof lastProp === 'string');
|
|
52
|
+
var curIsString = (typeof prop === 'string');
|
|
53
|
+
if (prevWasString !== curIsString) {
|
|
54
|
+
(updatePayload = updatePayload || {})[exports.styleStringSymbol] = typeof prop === 'string' ? prop : null;
|
|
55
|
+
if (curIsString) {
|
|
56
|
+
// Current style is string while previous is object, so revert all changes from the previous one
|
|
57
|
+
prop = diffProperties(lastProp, {}, 0);
|
|
58
|
+
if (!prop)
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
if (curIsString) {
|
|
64
|
+
// Both styles are string, style does not need changing
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// Both styles are object, take the difference
|
|
69
|
+
prop = diffProperties(lastProp, nextProp, 0);
|
|
70
|
+
if (!prop)
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
var depth = deepDiffing > 0 ? deepDiffing : (propDepths[propKey] || 0);
|
|
77
|
+
if (depth > 0) {
|
|
78
|
+
prop = diffProperties(lastProp, nextProp, depth - 1);
|
|
79
|
+
if (!prop)
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
(updatePayload = updatePayload || {})[propKey] = prop;
|
|
84
|
+
}
|
|
85
|
+
return updatePayload;
|
|
86
|
+
}
|
|
87
|
+
exports.diffProperties = diffProperties;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { NativeContainerInstance } from '../models/renderer';
|
|
3
|
-
import { AsyncContainerInstance, AsyncNativeInstance } from './async/types';
|
|
4
|
-
interface RenderOptions {
|
|
5
|
-
hostContainer?: NativeContainerInstance;
|
|
6
|
-
disableHelpers?: boolean;
|
|
7
|
-
mode?: 'legacy' | 'concurrent';
|
|
8
|
-
/**
|
|
9
|
-
Render using the sync reconciler instead of the batch rendering. It is not recommended to change this value.
|
|
10
|
-
Changing this will disable some features like inline rich-text and svg rendering, although it may improve performance for Jint.
|
|
11
|
-
*/
|
|
12
|
-
disableBatchRendering?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare function render(element: React.ReactNode, options?: RenderOptions): import("react-reconciler").Reconciler<AsyncContainerInstance, import("./async/types").AsyncInstance, import("./async/types").AsyncInstance, AsyncNativeInstance, import("../..").ReactUnity.IReactComponent> | import("react-reconciler").Reconciler<import("../..").ReactUnity.IReactComponent, import("../..").ReactUnity.IReactComponent, import("../..").ReactUnity.ITextComponent, import("../..").ReactUnity.IReactComponent, any>;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Instead, import `render` directly from `@reactunity/renderer`
|
|
17
|
-
*/
|
|
18
|
-
export declare const Renderer: {
|
|
19
|
-
render(element: React.ReactNode, options?: RenderOptions): import("react-reconciler").Reconciler<AsyncContainerInstance, import("./async/types").AsyncInstance, import("./async/types").AsyncInstance, AsyncNativeInstance, import("../..").ReactUnity.IReactComponent> | import("react-reconciler").Reconciler<import("../..").ReactUnity.IReactComponent, import("../..").ReactUnity.IReactComponent, import("../..").ReactUnity.ITextComponent, import("../..").ReactUnity.IReactComponent, any>;
|
|
20
|
-
};
|
|
21
|
-
export declare const batchedUpdates: <A, R>(fn: (a: A) => R, a: A) => R;
|
|
22
|
-
export declare const flushSync: {
|
|
23
|
-
(): void;
|
|
24
|
-
<R>(fn: () => R): R;
|
|
25
|
-
};
|
|
26
|
-
export {};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { NativeContainerInstance } from '../models/renderer';
|
|
3
|
+
import { AsyncContainerInstance, AsyncNativeInstance } from './async/types';
|
|
4
|
+
interface RenderOptions {
|
|
5
|
+
hostContainer?: NativeContainerInstance;
|
|
6
|
+
disableHelpers?: boolean;
|
|
7
|
+
mode?: 'legacy' | 'concurrent';
|
|
8
|
+
/**
|
|
9
|
+
Render using the sync reconciler instead of the batch rendering. It is not recommended to change this value.
|
|
10
|
+
Changing this will disable some features like inline rich-text and svg rendering, although it may improve performance for Jint.
|
|
11
|
+
*/
|
|
12
|
+
disableBatchRendering?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function render(element: React.ReactNode, options?: RenderOptions): import("react-reconciler").Reconciler<AsyncContainerInstance, import("./async/types").AsyncInstance, import("./async/types").AsyncInstance, AsyncNativeInstance, import("../..").ReactUnity.IReactComponent> | import("react-reconciler").Reconciler<import("../..").ReactUnity.IReactComponent, import("../..").ReactUnity.IReactComponent, import("../..").ReactUnity.ITextComponent, import("../..").ReactUnity.IReactComponent, any>;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Instead, import `render` directly from `@reactunity/renderer`
|
|
17
|
+
*/
|
|
18
|
+
export declare const Renderer: {
|
|
19
|
+
render(element: React.ReactNode, options?: RenderOptions): import("react-reconciler").Reconciler<AsyncContainerInstance, import("./async/types").AsyncInstance, import("./async/types").AsyncInstance, AsyncNativeInstance, import("../..").ReactUnity.IReactComponent> | import("react-reconciler").Reconciler<import("../..").ReactUnity.IReactComponent, import("../..").ReactUnity.IReactComponent, import("../..").ReactUnity.ITextComponent, import("../..").ReactUnity.IReactComponent, any>;
|
|
20
|
+
};
|
|
21
|
+
export declare const batchedUpdates: <A, R>(fn: (a: A) => R, a: A) => R;
|
|
22
|
+
export declare const flushSync: {
|
|
23
|
+
(): void;
|
|
24
|
+
<R>(fn: () => R): R;
|
|
25
|
+
};
|
|
26
|
+
export {};
|