@reactunity/renderer 0.15.1 → 0.16.0
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 +1 -0
- package/dist/editor/jsx-dev-runtime.d.ts +2 -0
- package/dist/editor/jsx-dev-runtime.js +1 -0
- package/dist/editor/jsx-runtime.d.ts +2 -0
- package/dist/editor/jsx-runtime.js +1 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.js +9 -9
- package/dist/src/helpers/dictionary-watcher.d.ts +66 -66
- package/dist/src/helpers/dictionary-watcher.js +100 -98
- package/dist/src/helpers/hooks/use-globals.d.ts +6 -6
- package/dist/src/helpers/hooks/use-globals.js +6 -6
- package/dist/src/helpers/hooks/use-reactive-value.d.ts +4 -4
- package/dist/src/helpers/hooks/use-reactive-value.js +27 -27
- package/dist/src/helpers/icons.d.ts +11 -7
- package/dist/src/helpers/icons.js +29 -29
- package/dist/src/models/base.d.ts +56 -56
- package/dist/src/models/base.js +2 -2
- package/dist/src/models/editor/components.d.ts +22 -22
- package/dist/src/models/editor/components.js +1 -1
- package/dist/src/models/editor/environment.d.ts +9 -10
- package/dist/src/models/editor/environment.js +1 -1
- package/dist/src/models/editor/index.d.ts +3 -3
- package/dist/src/models/editor/index.js +3 -3
- package/dist/src/models/editor/jsx.d.ts +111 -104
- package/dist/src/models/editor/jsx.js +1 -1
- package/dist/src/models/environment/dom/common.d.ts +85 -85
- package/dist/src/models/environment/dom/common.js +1 -1
- package/dist/src/models/environment/dom/fetch.d.ts +111 -111
- package/dist/src/models/environment/dom/fetch.js +1 -1
- package/dist/src/models/environment/dom/global.d.ts +11 -11
- package/dist/src/models/environment/dom/global.js +1 -1
- package/dist/src/models/environment/dom/xhr.d.ts +161 -161
- package/dist/src/models/environment/dom/xhr.js +1 -1
- package/dist/src/models/environment/index.d.ts +43 -47
- package/dist/src/models/environment/index.js +2 -3
- package/dist/src/models/environment/interop.d.ts +23 -23
- package/dist/src/models/environment/interop.js +1 -1
- package/dist/src/models/generated/editor.d.ts +18501 -18501
- package/dist/src/models/generated/editor.js +6 -6
- package/dist/src/models/generated/index.d.ts +6 -6
- package/dist/src/models/generated/index.js +6 -6
- package/dist/src/models/generated/react.d.ts +15214 -15214
- package/dist/src/models/generated/react.js +6 -6
- package/dist/src/models/generated/system.d.ts +36731 -36731
- package/dist/src/models/generated/system.js +6 -6
- package/dist/src/models/generated/tests.d.ts +5023 -5023
- package/dist/src/models/generated/tests.js +6 -6
- package/dist/src/models/generated/unity.d.ts +43446 -43446
- package/dist/src/models/generated/unity.js +6 -6
- package/dist/src/models/generated/yoga.d.ts +368 -368
- package/dist/src/models/generated/yoga.js +6 -6
- package/dist/src/models/properties/colors.d.ts +150 -150
- package/dist/src/models/properties/colors.js +1 -1
- package/dist/src/models/properties/common.d.ts +2 -2
- package/dist/src/models/properties/common.js +1 -1
- package/dist/src/models/properties/index.d.ts +7 -7
- package/dist/src/models/properties/index.js +7 -7
- package/dist/src/models/properties/style.d.ts +10 -10
- package/dist/src/models/properties/style.js +1 -1
- package/dist/src/models/properties/styles-enums.d.ts +23 -23
- package/dist/src/models/properties/styles-enums.js +1 -1
- package/dist/src/models/properties/styles.d.ts +127 -127
- package/dist/src/models/properties/styles.js +1 -1
- package/dist/src/models/properties/values.d.ts +24 -24
- package/dist/src/models/properties/values.js +1 -1
- package/dist/src/models/properties/yoga-enums.d.ts +8 -8
- package/dist/src/models/properties/yoga-enums.js +1 -1
- package/dist/src/models/properties/yoga.d.ts +66 -66
- package/dist/src/models/properties/yoga.js +1 -1
- package/dist/src/models/renderer.d.ts +20 -20
- package/dist/src/models/renderer.js +1 -1
- package/dist/src/models/richtext.d.ts +69 -69
- package/dist/src/models/richtext.js +2 -2
- package/dist/src/models/svg.d.ts +68 -68
- package/dist/src/models/svg.js +1 -1
- package/dist/src/models/tests/index.d.ts +12 -12
- package/dist/src/models/tests/index.js +1 -1
- package/dist/src/models/ugui/components.d.ts +86 -86
- package/dist/src/models/ugui/components.js +1 -1
- package/dist/src/models/ugui/events.d.ts +74 -74
- package/dist/src/models/ugui/events.js +2 -2
- package/dist/src/models/ugui/index.d.ts +4 -4
- package/dist/src/models/ugui/index.js +4 -4
- package/dist/src/models/ugui/input.d.ts +26 -26
- package/dist/src/models/ugui/input.js +1 -1
- package/dist/src/models/ugui/jsx.d.ts +67 -60
- package/dist/src/models/ugui/jsx.js +1 -1
- package/dist/src/models/uitoolkit/components.d.ts +82 -82
- package/dist/src/models/uitoolkit/components.js +1 -1
- package/dist/src/models/uitoolkit/events.d.ts +64 -64
- package/dist/src/models/uitoolkit/events.js +1 -1
- package/dist/src/models/uitoolkit/index.d.ts +3 -3
- package/dist/src/models/uitoolkit/index.js +3 -3
- package/dist/src/models/uitoolkit/jsx.d.ts +71 -64
- package/dist/src/models/uitoolkit/jsx.js +1 -1
- package/dist/src/renderer/async/callbacks.d.ts +5 -6
- package/dist/src/renderer/async/callbacks.js +52 -52
- package/dist/src/renderer/async/commands.d.ts +98 -47
- package/dist/src/renderer/async/commands.js +1 -1
- package/dist/src/renderer/async/objects.d.ts +7 -8
- package/dist/src/renderer/async/objects.js +31 -31
- package/dist/src/renderer/async/reconciler.d.ts +2 -2
- package/dist/src/renderer/async/reconciler.js +304 -283
- package/dist/src/renderer/async/serializer.d.ts +6 -9
- package/dist/src/renderer/async/serializer.js +31 -31
- package/dist/src/renderer/async/types.d.ts +45 -45
- package/dist/src/renderer/async/types.js +1 -1
- package/dist/src/renderer/constants.d.ts +30 -30
- package/dist/src/renderer/constants.js +70 -70
- package/dist/src/renderer/diffing.d.ts +3 -3
- package/dist/src/renderer/diffing.js +83 -83
- package/dist/src/renderer/renderer.d.ts +26 -26
- package/dist/src/renderer/renderer.js +93 -93
- package/dist/src/renderer/subcontexts/index.d.ts +6 -6
- package/dist/src/renderer/subcontexts/index.js +6 -6
- package/dist/src/renderer/subcontexts/richtext.d.ts +3 -3
- package/dist/src/renderer/subcontexts/richtext.js +52 -52
- package/dist/src/renderer/subcontexts/svg.d.ts +3 -3
- package/dist/src/renderer/subcontexts/svg.js +70 -70
- package/dist/src/renderer/sync/reconciler.d.ts +2 -2
- package/dist/src/renderer/sync/reconciler.js +35 -35
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/views/default-view.d.ts +8 -8
- package/dist/src/views/default-view.js +7 -7
- package/dist/src/views/error-boundary.d.ts +10 -10
- package/dist/src/views/error-boundary.js +42 -53
- package/dist/src/webgl-compat/error-messages.d.ts +9 -9
- package/dist/src/webgl-compat/error-messages.js +10 -10
- package/dist/src/webgl-compat/index.d.ts +13 -13
- package/dist/src/webgl-compat/index.js +8 -8
- package/dist/src/webgl-compat/types.d.ts +21 -21
- package/dist/src/webgl-compat/types.js +1 -1
- package/dist/src/webgl-compat/use-event-system.d.ts +3 -3
- package/dist/src/webgl-compat/use-event-system.js +77 -76
- package/dist/src/webgl-compat/use-unity-context.d.ts +31 -31
- package/dist/src/webgl-compat/use-unity-context.js +92 -91
- package/dist/tests.d.ts +1 -1
- package/dist/tests.js +1 -1
- package/dist/ugui/index.d.ts +1 -0
- package/dist/ugui/index.js +1 -0
- package/dist/ugui/jsx-dev-runtime.d.ts +2 -0
- package/dist/ugui/jsx-dev-runtime.js +1 -0
- package/dist/ugui/jsx-runtime.d.ts +2 -0
- package/dist/ugui/jsx-runtime.js +1 -0
- package/dist/uitoolkit/index.d.ts +1 -0
- package/dist/uitoolkit/index.js +1 -0
- package/dist/uitoolkit/jsx-dev-runtime.d.ts +2 -0
- package/dist/uitoolkit/jsx-dev-runtime.js +1 -0
- package/dist/uitoolkit/jsx-runtime.d.ts +2 -0
- package/dist/uitoolkit/jsx-runtime.js +1 -0
- package/dist/webgl-compat.d.ts +1 -1
- package/dist/webgl-compat.js +1 -1
- package/editor/jsx-dev-runtime.ts +4 -0
- package/editor/jsx-runtime.ts +4 -0
- package/package.json +13 -32
- package/ugui/jsx-dev-runtime.ts +4 -0
- package/ugui/jsx-runtime.ts +4 -0
- package/uitoolkit/jsx-dev-runtime.ts +4 -0
- package/uitoolkit/jsx-runtime.ts +4 -0
- 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/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
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { CallbacksRepo } from './callbacks';
|
|
2
|
-
import { ObjectsRepo } from './objects';
|
|
3
|
-
export var callbacksRepo = new CallbacksRepo();
|
|
4
|
-
export var objectsRepo = new ObjectsRepo();
|
|
5
|
-
// Separates properties in 3 categories: regular props, callbacks and non-serializable objects
|
|
6
|
-
export function convertPropsToSerializable(props) {
|
|
7
|
-
var res = {};
|
|
8
|
-
for (var key in props) {
|
|
9
|
-
if (Object.prototype.hasOwnProperty.call(props, key)) {
|
|
10
|
-
var value = props[key];
|
|
11
|
-
if (value == null) {
|
|
12
|
-
(res.p || (res.p = {}))[key] = null;
|
|
13
|
-
}
|
|
14
|
-
else if (key === 'style') {
|
|
15
|
-
(res.p || (res.p = {}))[key] = convertPropsToSerializable(value);
|
|
16
|
-
}
|
|
17
|
-
else if (key[0] === 'o' && key[1] === 'n' && typeof value === 'function') {
|
|
18
|
-
var ind = callbacksRepo.addObject(value);
|
|
19
|
-
(res.e || (res.e = {}))[key] = ind;
|
|
20
|
-
}
|
|
21
|
-
else if (typeof value === 'object' || typeof value === 'function') {
|
|
22
|
-
var ind = objectsRepo.addObject(value);
|
|
23
|
-
(res.o || (res.o = {}))[key] = ind;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
(res.p || (res.p = {}))[key] = value;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return res;
|
|
31
|
-
}
|
|
1
|
+
import { CallbacksRepo } from './callbacks';
|
|
2
|
+
import { ObjectsRepo } from './objects';
|
|
3
|
+
export var callbacksRepo = new CallbacksRepo();
|
|
4
|
+
export var objectsRepo = new ObjectsRepo();
|
|
5
|
+
// Separates properties in 3 categories: regular props, callbacks and non-serializable objects
|
|
6
|
+
export function convertPropsToSerializable(props) {
|
|
7
|
+
var res = {};
|
|
8
|
+
for (var key in props) {
|
|
9
|
+
if (Object.prototype.hasOwnProperty.call(props, key)) {
|
|
10
|
+
var value = props[key];
|
|
11
|
+
if (value == null) {
|
|
12
|
+
(res.p || (res.p = {}))[key] = null;
|
|
13
|
+
}
|
|
14
|
+
else if (key === 'style') {
|
|
15
|
+
(res.p || (res.p = {}))[key] = convertPropsToSerializable(value);
|
|
16
|
+
}
|
|
17
|
+
else if (key[0] === 'o' && key[1] === 'n' && typeof value === 'function') {
|
|
18
|
+
var ind = callbacksRepo.addObject(value);
|
|
19
|
+
(res.e || (res.e = {}))[key] = ind;
|
|
20
|
+
}
|
|
21
|
+
else if (typeof value === 'object' || typeof value === 'function') {
|
|
22
|
+
var ind = objectsRepo.addObject(value);
|
|
23
|
+
(res.o || (res.o = {}))[key] = ind;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
(res.p || (res.p = {}))[key] = value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return res;
|
|
31
|
+
}
|
|
@@ -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 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -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,70 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { ContinuousEventPriority, DefaultEventPriority, DiscreteEventPriority, IdleEventPriority } from 'react-reconciler/constants';
|
|
13
|
-
import { styleStringSymbol } from './diffing';
|
|
14
|
-
export var hideClass = 'react-unity__renderer__hidden';
|
|
15
|
-
export var eventPriorities = {
|
|
16
|
-
discrete: DiscreteEventPriority,
|
|
17
|
-
continuous: ContinuousEventPriority,
|
|
18
|
-
default: DefaultEventPriority,
|
|
19
|
-
idle: IdleEventPriority,
|
|
20
|
-
};
|
|
21
|
-
export var textTypes = {
|
|
22
|
-
text: true,
|
|
23
|
-
icon: true,
|
|
24
|
-
style: true,
|
|
25
|
-
script: true,
|
|
26
|
-
};
|
|
27
|
-
export function stringizePoolKey(key) {
|
|
28
|
-
switch (typeof key) {
|
|
29
|
-
case 'string': return key;
|
|
30
|
-
case 'boolean': return key ? 'default' : '';
|
|
31
|
-
case 'number': return key.toString();
|
|
32
|
-
case 'undefined': return null;
|
|
33
|
-
default: return '';
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export function getAllowedProps(props, type) {
|
|
37
|
-
var children = props.children, tag = props.tag, pool = props.pool, rest = __rest(props, ["children", "tag", "pool"]);
|
|
38
|
-
if (textTypes[type] && 'children' in props) {
|
|
39
|
-
rest.children = (!children || typeof children === 'boolean') ? null : Array.isArray(children) ? children.join('') : children + '';
|
|
40
|
-
}
|
|
41
|
-
if (typeof props.style === 'string')
|
|
42
|
-
rest[styleStringSymbol] = props.style;
|
|
43
|
-
return rest;
|
|
44
|
-
}
|
|
45
|
-
export var commonReconciler = {
|
|
46
|
-
// -------------------
|
|
47
|
-
// Scheduling
|
|
48
|
-
// -------------------
|
|
49
|
-
now: Date.now,
|
|
50
|
-
getCurrentEventPriority: function () { return UnityBridge.CurrentEventPriority || eventPriorities.default; },
|
|
51
|
-
noTimeout: -1,
|
|
52
|
-
scheduleTimeout: function (callback, delay) { return setTimeout(callback, delay); },
|
|
53
|
-
scheduleMicrotask: typeof queueMicrotask === 'function' ? queueMicrotask :
|
|
54
|
-
function (callback) { return Promise.resolve(null).then(callback)
|
|
55
|
-
.catch(function (error) { return setTimeout(function () { throw error; }, 0); }); },
|
|
56
|
-
cancelTimeout: function (handle) { return clearTimeout(handle); },
|
|
57
|
-
beforeActiveInstanceBlur: function () {
|
|
58
|
-
},
|
|
59
|
-
afterActiveInstanceBlur: function () {
|
|
60
|
-
},
|
|
61
|
-
getInstanceFromNode: function (node) {
|
|
62
|
-
return undefined;
|
|
63
|
-
},
|
|
64
|
-
getInstanceFromScope: function (scopeInstance) {
|
|
65
|
-
return undefined;
|
|
66
|
-
},
|
|
67
|
-
prepareScopeUpdate: function (scopeInstance, instance) {
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
export var isDevelopment = process.env.NODE_ENV === 'development';
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { ContinuousEventPriority, DefaultEventPriority, DiscreteEventPriority, IdleEventPriority } from 'react-reconciler/constants';
|
|
13
|
+
import { styleStringSymbol } from './diffing';
|
|
14
|
+
export var hideClass = 'react-unity__renderer__hidden';
|
|
15
|
+
export var eventPriorities = {
|
|
16
|
+
discrete: DiscreteEventPriority,
|
|
17
|
+
continuous: ContinuousEventPriority,
|
|
18
|
+
default: DefaultEventPriority,
|
|
19
|
+
idle: IdleEventPriority,
|
|
20
|
+
};
|
|
21
|
+
export var textTypes = {
|
|
22
|
+
text: true,
|
|
23
|
+
icon: true,
|
|
24
|
+
style: true,
|
|
25
|
+
script: true,
|
|
26
|
+
};
|
|
27
|
+
export function stringizePoolKey(key) {
|
|
28
|
+
switch (typeof key) {
|
|
29
|
+
case 'string': return key;
|
|
30
|
+
case 'boolean': return key ? 'default' : '';
|
|
31
|
+
case 'number': return key.toString();
|
|
32
|
+
case 'undefined': return null;
|
|
33
|
+
default: return '';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export function getAllowedProps(props, type) {
|
|
37
|
+
var children = props.children, tag = props.tag, pool = props.pool, rest = __rest(props, ["children", "tag", "pool"]);
|
|
38
|
+
if (textTypes[type] && 'children' in props) {
|
|
39
|
+
rest.children = (!children || typeof children === 'boolean') ? null : Array.isArray(children) ? children.join('') : children + '';
|
|
40
|
+
}
|
|
41
|
+
if (typeof props.style === 'string')
|
|
42
|
+
rest[styleStringSymbol] = props.style;
|
|
43
|
+
return rest;
|
|
44
|
+
}
|
|
45
|
+
export var commonReconciler = {
|
|
46
|
+
// -------------------
|
|
47
|
+
// Scheduling
|
|
48
|
+
// -------------------
|
|
49
|
+
now: Date.now,
|
|
50
|
+
getCurrentEventPriority: function () { return UnityBridge.CurrentEventPriority || eventPriorities.default; },
|
|
51
|
+
noTimeout: -1,
|
|
52
|
+
scheduleTimeout: function (callback, delay) { return setTimeout(callback, delay); },
|
|
53
|
+
scheduleMicrotask: typeof queueMicrotask === 'function' ? queueMicrotask :
|
|
54
|
+
function (callback) { return Promise.resolve(null).then(callback)
|
|
55
|
+
.catch(function (error) { return setTimeout(function () { throw error; }, 0); }); },
|
|
56
|
+
cancelTimeout: function (handle) { return clearTimeout(handle); },
|
|
57
|
+
beforeActiveInstanceBlur: function () {
|
|
58
|
+
},
|
|
59
|
+
afterActiveInstanceBlur: function () {
|
|
60
|
+
},
|
|
61
|
+
getInstanceFromNode: function (node) {
|
|
62
|
+
return undefined;
|
|
63
|
+
},
|
|
64
|
+
getInstanceFromScope: function (scopeInstance) {
|
|
65
|
+
return undefined;
|
|
66
|
+
},
|
|
67
|
+
prepareScopeUpdate: function (scopeInstance, instance) {
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export var 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,83 @@
|
|
|
1
|
-
export var styleStringSymbol = '__style_as_string__';
|
|
2
|
-
var propDepths = {
|
|
3
|
-
style: 1,
|
|
4
|
-
data: 1,
|
|
5
|
-
custom: 1,
|
|
6
|
-
};
|
|
7
|
-
export function diffProperties(lastProps, nextProps, deepDiffing) {
|
|
8
|
-
if (deepDiffing === void 0) { deepDiffing = 0; }
|
|
9
|
-
if (lastProps === nextProps)
|
|
10
|
-
return null;
|
|
11
|
-
var updatePayload = null;
|
|
12
|
-
var propKey;
|
|
13
|
-
for (propKey in lastProps) {
|
|
14
|
-
// This loop is for removing properties that existed in the previous properties, but not on current
|
|
15
|
-
if (nextProps.hasOwnProperty(propKey)
|
|
16
|
-
|| !lastProps.hasOwnProperty(propKey)
|
|
17
|
-
|| lastProps[propKey] == null) {
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
var prop = null;
|
|
21
|
-
// If style existed in the previous properties as string, set it to null
|
|
22
|
-
if (propKey === 'style' && typeof lastProps.style === 'string') {
|
|
23
|
-
(updatePayload = updatePayload || {})[styleStringSymbol] = null;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
var depth = deepDiffing > 0 ? deepDiffing : (propDepths[propKey] || 0);
|
|
27
|
-
if (depth > 0) {
|
|
28
|
-
prop = diffProperties(lastProps[propKey], {}, depth - 1);
|
|
29
|
-
if (!prop)
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
// For all other deleted properties we add it to the queue. We use
|
|
33
|
-
// the whitelist in the commit phase instead.
|
|
34
|
-
(updatePayload = updatePayload || {})[propKey] = prop;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
for (propKey in nextProps) {
|
|
38
|
-
// This loop is for finding difference between current properties and previous properties
|
|
39
|
-
var nextProp = nextProps[propKey];
|
|
40
|
-
var lastProp = lastProps != null ? lastProps[propKey] : undefined;
|
|
41
|
-
if (!nextProps.hasOwnProperty(propKey)
|
|
42
|
-
|| nextProp === lastProp
|
|
43
|
-
|| (nextProp == null && lastProp == null)) {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
var prop = nextProp;
|
|
47
|
-
if (propKey === 'style') {
|
|
48
|
-
var prevWasString = (typeof lastProp === 'string');
|
|
49
|
-
var curIsString = (typeof prop === 'string');
|
|
50
|
-
if (prevWasString !== curIsString) {
|
|
51
|
-
(updatePayload = updatePayload || {})[styleStringSymbol] = typeof prop === 'string' ? prop : null;
|
|
52
|
-
if (curIsString) {
|
|
53
|
-
// Current style is string while previous is object, so revert all changes from the previous one
|
|
54
|
-
prop = diffProperties(lastProp, {}, 0);
|
|
55
|
-
if (!prop)
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
if (curIsString) {
|
|
61
|
-
// Both styles are string, style does not need changing
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
// Both styles are object, take the difference
|
|
66
|
-
prop = diffProperties(lastProp, nextProp, 0);
|
|
67
|
-
if (!prop)
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
var depth = deepDiffing > 0 ? deepDiffing : (propDepths[propKey] || 0);
|
|
74
|
-
if (depth > 0) {
|
|
75
|
-
prop = diffProperties(lastProp, nextProp, depth - 1);
|
|
76
|
-
if (!prop)
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
(updatePayload = updatePayload || {})[propKey] = prop;
|
|
81
|
-
}
|
|
82
|
-
return updatePayload;
|
|
83
|
-
}
|
|
1
|
+
export var styleStringSymbol = '__style_as_string__';
|
|
2
|
+
var propDepths = {
|
|
3
|
+
style: 1,
|
|
4
|
+
data: 1,
|
|
5
|
+
custom: 1,
|
|
6
|
+
};
|
|
7
|
+
export function diffProperties(lastProps, nextProps, deepDiffing) {
|
|
8
|
+
if (deepDiffing === void 0) { deepDiffing = 0; }
|
|
9
|
+
if (lastProps === nextProps)
|
|
10
|
+
return null;
|
|
11
|
+
var updatePayload = null;
|
|
12
|
+
var propKey;
|
|
13
|
+
for (propKey in lastProps) {
|
|
14
|
+
// This loop is for removing properties that existed in the previous properties, but not on current
|
|
15
|
+
if (nextProps.hasOwnProperty(propKey)
|
|
16
|
+
|| !lastProps.hasOwnProperty(propKey)
|
|
17
|
+
|| lastProps[propKey] == null) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
var prop = null;
|
|
21
|
+
// If style existed in the previous properties as string, set it to null
|
|
22
|
+
if (propKey === 'style' && typeof lastProps.style === 'string') {
|
|
23
|
+
(updatePayload = updatePayload || {})[styleStringSymbol] = null;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
var depth = deepDiffing > 0 ? deepDiffing : (propDepths[propKey] || 0);
|
|
27
|
+
if (depth > 0) {
|
|
28
|
+
prop = diffProperties(lastProps[propKey], {}, depth - 1);
|
|
29
|
+
if (!prop)
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
// For all other deleted properties we add it to the queue. We use
|
|
33
|
+
// the whitelist in the commit phase instead.
|
|
34
|
+
(updatePayload = updatePayload || {})[propKey] = prop;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
for (propKey in nextProps) {
|
|
38
|
+
// This loop is for finding difference between current properties and previous properties
|
|
39
|
+
var nextProp = nextProps[propKey];
|
|
40
|
+
var lastProp = lastProps != null ? lastProps[propKey] : undefined;
|
|
41
|
+
if (!nextProps.hasOwnProperty(propKey)
|
|
42
|
+
|| nextProp === lastProp
|
|
43
|
+
|| (nextProp == null && lastProp == null)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
var prop = nextProp;
|
|
47
|
+
if (propKey === 'style') {
|
|
48
|
+
var prevWasString = (typeof lastProp === 'string');
|
|
49
|
+
var curIsString = (typeof prop === 'string');
|
|
50
|
+
if (prevWasString !== curIsString) {
|
|
51
|
+
(updatePayload = updatePayload || {})[styleStringSymbol] = typeof prop === 'string' ? prop : null;
|
|
52
|
+
if (curIsString) {
|
|
53
|
+
// Current style is string while previous is object, so revert all changes from the previous one
|
|
54
|
+
prop = diffProperties(lastProp, {}, 0);
|
|
55
|
+
if (!prop)
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
if (curIsString) {
|
|
61
|
+
// Both styles are string, style does not need changing
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
// Both styles are object, take the difference
|
|
66
|
+
prop = diffProperties(lastProp, nextProp, 0);
|
|
67
|
+
if (!prop)
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
var depth = deepDiffing > 0 ? deepDiffing : (propDepths[propKey] || 0);
|
|
74
|
+
if (depth > 0) {
|
|
75
|
+
prop = diffProperties(lastProp, nextProp, depth - 1);
|
|
76
|
+
if (!prop)
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
(updatePayload = updatePayload || {})[propKey] = prop;
|
|
81
|
+
}
|
|
82
|
+
return updatePayload;
|
|
83
|
+
}
|
|
@@ -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 {};
|