@reactunity/renderer 0.5.2 → 0.8.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.d.ts +1 -1
- package/dist/editor.js +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +4 -5
- package/dist/src/helpers/dictionary-watcher.d.ts +1 -1
- package/dist/src/helpers/dictionary-watcher.js +2 -2
- package/dist/{models → src/models}/base.d.ts +24 -5
- package/dist/{models/ugui/events.js → src/models/base.js} +0 -0
- package/dist/{models → src/models}/editor/components.d.ts +0 -0
- package/dist/{models → src/models}/editor/components.js +0 -0
- package/dist/{models → src/models}/editor/environment.d.ts +0 -0
- package/dist/{models → src/models}/editor/environment.js +0 -0
- package/dist/{models → src/models}/editor/events.d.ts +0 -0
- package/dist/{models → src/models}/editor/events.js +0 -0
- package/dist/{models → src/models}/editor/index.d.ts +0 -0
- package/dist/{models → src/models}/editor/index.js +0 -0
- package/dist/{models → src/models}/editor/jsx.d.ts +2 -4
- package/dist/{models → src/models}/editor/jsx.js +0 -0
- package/dist/src/models/environment/index.d.ts +41 -0
- package/dist/src/models/environment/index.js +1 -0
- package/dist/{models → src/models/environment}/interop.d.ts +2 -2
- package/dist/{models → src/models/environment}/interop.js +0 -0
- package/dist/{models → src/models}/generated/editor.d.ts +0 -0
- package/dist/src/models/generated/editor.js +6 -0
- package/dist/{models → src/models}/generated/index.d.ts +1 -0
- package/dist/{models → src/models}/generated/index.js +1 -0
- package/dist/{models → src/models}/generated/react.d.ts +3474 -2904
- package/dist/src/models/generated/react.js +6 -0
- package/dist/{models → src/models}/generated/system.d.ts +0 -0
- package/dist/{models → src/models}/generated/system.js +1 -0
- package/dist/{models → src/models}/generated/tests.d.ts +0 -0
- package/dist/src/models/generated/tests.js +6 -0
- package/dist/{models → src/models}/generated/unity.d.ts +0 -0
- package/dist/src/models/generated/unity.js +6 -0
- package/dist/src/models/generated/yoga.d.ts +358 -0
- package/dist/src/models/generated/yoga.js +6 -0
- package/dist/{models → src/models}/properties/colors.d.ts +0 -0
- package/dist/{models → src/models}/properties/colors.js +0 -0
- package/dist/{models → src/models}/properties/index.d.ts +0 -0
- package/dist/{models → src/models}/properties/index.js +0 -0
- package/dist/{models → src/models}/properties/style.d.ts +0 -0
- package/dist/{models → src/models}/properties/style.js +0 -0
- package/dist/{models → src/models}/properties/styles-enums.d.ts +5 -0
- package/dist/{models → src/models}/properties/styles-enums.js +0 -0
- package/dist/src/models/properties/styles.d.ts +104 -0
- package/dist/{models → src/models}/properties/styles.js +0 -0
- package/dist/{models → src/models}/properties/values.d.ts +1 -1
- package/dist/{models → src/models}/properties/values.js +0 -0
- package/dist/{models → src/models}/properties/yoga-enums.d.ts +0 -0
- package/dist/{models → src/models}/properties/yoga-enums.js +0 -0
- package/dist/{models → src/models}/properties/yoga.d.ts +0 -0
- package/dist/{models → src/models}/properties/yoga.js +0 -0
- package/dist/{models → src/models}/renderer.d.ts +0 -0
- package/dist/{models → src/models}/renderer.js +0 -0
- package/dist/src/models/tests/index.d.ts +12 -0
- package/dist/{models → src/models}/tests/index.js +0 -0
- package/dist/{models → src/models}/ugui/components.d.ts +3 -5
- package/dist/{models → src/models}/ugui/components.js +0 -0
- package/dist/{models → src/models}/ugui/events.d.ts +0 -0
- package/dist/src/models/ugui/events.js +2 -0
- package/dist/{models → src/models}/ugui/index.d.ts +0 -0
- package/dist/{models → src/models}/ugui/index.js +0 -0
- package/dist/{models → src/models}/ugui/input.d.ts +0 -0
- package/dist/{models → src/models}/ugui/input.js +0 -0
- package/dist/{models → src/models}/ugui/jsx.d.ts +2 -4
- package/dist/{models → src/models}/ugui/jsx.js +0 -0
- package/dist/{models → src/models}/uitoolkit/components.d.ts +3 -5
- package/dist/{models → src/models}/uitoolkit/components.js +0 -0
- package/dist/{models → src/models}/uitoolkit/events.d.ts +0 -0
- package/dist/{models → src/models}/uitoolkit/events.js +0 -0
- package/dist/{models → src/models}/uitoolkit/index.d.ts +0 -0
- package/dist/{models → src/models}/uitoolkit/index.js +0 -0
- package/dist/{models → src/models}/uitoolkit/jsx.d.ts +2 -4
- package/dist/{models → src/models}/uitoolkit/jsx.js +0 -0
- package/dist/src/renderer/diffing.d.ts +3 -2
- package/dist/src/renderer/diffing.js +11 -6
- package/dist/src/renderer/renderer.d.ts +1 -1
- package/dist/src/renderer/renderer.js +42 -102
- package/dist/tests.d.ts +1 -1
- package/dist/tests.js +1 -1
- package/dist/ugui.d.ts +1 -1
- package/dist/ugui.js +1 -1
- package/dist/uitoolkit.d.ts +1 -1
- package/dist/uitoolkit.js +1 -1
- package/editor.ts +1 -1
- package/package.json +5 -8
- package/tests.ts +1 -1
- package/ugui.ts +1 -1
- package/uitoolkit.ts +1 -1
- package/dist/models/base.js +0 -1
- package/dist/models/environment.d.ts +0 -30
- package/dist/models/environment.js +0 -1
- package/dist/models/generated/editor.js +0 -1
- package/dist/models/generated/react.js +0 -1
- package/dist/models/generated/tests.js +0 -1
- package/dist/models/generated/unity.js +0 -1
- package/dist/models/properties/styles.d.ts +0 -67
- package/dist/models/tests/index.d.ts +0 -12
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as rc from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseElements, Textable } from '../base';
|
|
3
3
|
import { ReactUnity } from '../generated';
|
|
4
4
|
import * as Components from './components';
|
|
5
5
|
import Cmp = ReactUnity.UIToolkit;
|
|
@@ -7,9 +7,7 @@ declare type Children<T = any> = {
|
|
|
7
7
|
children?: T;
|
|
8
8
|
};
|
|
9
9
|
declare type BaseElement<T = Cmp.UIToolkitComponent> = Components.View<T> & rc.RefAttributes<Cmp.UIToolkitComponent> & Children;
|
|
10
|
-
export interface UIToolkitElements {
|
|
11
|
-
[key: string]: BaseElement<any> | StyleCmpDef;
|
|
12
|
-
style: StyleCmpDef;
|
|
10
|
+
export interface UIToolkitElements extends BaseElements<BaseElement<any>> {
|
|
13
11
|
view: BaseElement & {
|
|
14
12
|
tag?: string;
|
|
15
13
|
};
|
|
File without changes
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare type DiffResult = null |
|
|
2
|
-
export declare
|
|
1
|
+
export declare 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,10 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var styleStringSymbol = '__style_as_string__';
|
|
2
|
+
export function diffProperties(lastProps, nextProps, deepDiffing) {
|
|
2
3
|
if (deepDiffing === void 0) { deepDiffing = 0; }
|
|
3
|
-
if (
|
|
4
|
+
if (lastProps === nextProps)
|
|
4
5
|
return null;
|
|
5
6
|
var updatePayload = null;
|
|
6
|
-
var lastProps = lastRawProps;
|
|
7
|
-
var nextProps = nextRawProps;
|
|
8
7
|
var propKey;
|
|
9
8
|
for (propKey in lastProps) {
|
|
10
9
|
if (nextProps.hasOwnProperty(propKey)
|
|
@@ -13,6 +12,9 @@ export function diffProperties(lastRawProps, nextRawProps, deepDiffing) {
|
|
|
13
12
|
continue;
|
|
14
13
|
}
|
|
15
14
|
var prop = null;
|
|
15
|
+
if (propKey === 'style' && typeof lastProps.style === 'string') {
|
|
16
|
+
(updatePayload = updatePayload || {})[styleStringSymbol] = null;
|
|
17
|
+
}
|
|
16
18
|
var depth = deepDiffing > 0 ? deepDiffing : propKey === 'style' ? 1 : 0;
|
|
17
19
|
if (depth > 0) {
|
|
18
20
|
prop = diffProperties(lastProps[propKey], null, depth - 1);
|
|
@@ -21,7 +23,7 @@ export function diffProperties(lastRawProps, nextRawProps, deepDiffing) {
|
|
|
21
23
|
}
|
|
22
24
|
// For all other deleted properties we add it to the queue. We use
|
|
23
25
|
// the whitelist in the commit phase instead.
|
|
24
|
-
(updatePayload = updatePayload || []
|
|
26
|
+
(updatePayload = updatePayload || {})[propKey] = prop;
|
|
25
27
|
}
|
|
26
28
|
for (propKey in nextProps) {
|
|
27
29
|
var nextProp = nextProps[propKey];
|
|
@@ -32,13 +34,16 @@ export function diffProperties(lastRawProps, nextRawProps, deepDiffing) {
|
|
|
32
34
|
continue;
|
|
33
35
|
}
|
|
34
36
|
var prop = nextProp;
|
|
37
|
+
if (propKey === 'style' && (typeof prop === 'string') !== (typeof lastProp === 'string')) {
|
|
38
|
+
(updatePayload = updatePayload || {})[styleStringSymbol] = typeof prop === 'string' ? prop : null;
|
|
39
|
+
}
|
|
35
40
|
var depth = deepDiffing > 0 ? deepDiffing : propKey === 'style' ? 1 : 0;
|
|
36
41
|
if (depth > 0) {
|
|
37
42
|
prop = diffProperties(lastProp, nextProp, depth - 1);
|
|
38
43
|
if (!prop)
|
|
39
44
|
continue;
|
|
40
45
|
}
|
|
41
|
-
(updatePayload = updatePayload || []
|
|
46
|
+
(updatePayload = updatePayload || {})[propKey] = prop;
|
|
42
47
|
}
|
|
43
48
|
return updatePayload;
|
|
44
49
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
|
-
import { NativeContainerInstance } from '
|
|
2
|
+
import { NativeContainerInstance } from '../models/renderer';
|
|
3
3
|
export declare const Renderer: {
|
|
4
4
|
render(element: React.ReactNode, hostContainer?: NativeContainerInstance, renderWithoutHelpers?: boolean): number;
|
|
5
5
|
};
|
|
@@ -1,80 +1,34 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { createElement } from 'react';
|
|
2
13
|
import * as Reconciler from 'react-reconciler';
|
|
3
14
|
import { DefaultView } from '../views/default-view';
|
|
4
|
-
import { diffProperties } from './diffing';
|
|
15
|
+
import { diffProperties, styleStringSymbol } from './diffing';
|
|
5
16
|
var hostContext = {};
|
|
6
17
|
var childContext = {};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
else
|
|
18
|
-
writeTo.SetWithoutNotify(attr, value);
|
|
19
|
-
}
|
|
20
|
-
return updatePayload.length > 0;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
for (var attr in updatePayload) {
|
|
24
|
-
if (updatePayload.hasOwnProperty(attr)) {
|
|
25
|
-
var value = updatePayload[attr];
|
|
26
|
-
writeTo.SetWithoutNotify(attr, value);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function applyUpdate(instance, updatePayload, isAfterMount, type, pre) {
|
|
33
|
-
if (pre === void 0) { pre = true; }
|
|
34
|
-
var updateAfterMount = false;
|
|
35
|
-
for (var index = 0; index < updatePayload.length; index += 2) {
|
|
36
|
-
var attr = updatePayload[index];
|
|
37
|
-
var value = updatePayload[index + 1];
|
|
38
|
-
var isEvent = attr.substring(0, 2) === 'on';
|
|
39
|
-
// Register events before other properties
|
|
40
|
-
if (pre !== isEvent)
|
|
41
|
-
continue;
|
|
42
|
-
if (isEvent) {
|
|
43
|
-
UnityBridge.setEventListener(instance, attr, value);
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
if (attr === 'children') {
|
|
47
|
-
if (type === 'text' || type === 'icon' || type === 'style') {
|
|
48
|
-
UnityBridge.setText(instance, value ? ((Array.isArray(value) && value.join) ? value.join('') : value + '') : '');
|
|
49
|
-
}
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
if (attr === 'key')
|
|
53
|
-
continue;
|
|
54
|
-
if (attr === 'ref')
|
|
55
|
-
continue;
|
|
56
|
-
if (attr === 'tag')
|
|
57
|
-
continue;
|
|
58
|
-
if (!isAfterMount && attr === 'style') {
|
|
59
|
-
updateAfterMount = true;
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
if (attr === 'style') {
|
|
63
|
-
if (applyDiffedUpdate(instance.Style, value)) {
|
|
64
|
-
instance.ResolveStyle();
|
|
65
|
-
}
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
if (attr.substring(0, 5) === 'data-') {
|
|
69
|
-
UnityBridge.setData(instance, attr.substring(5), value);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
UnityBridge.setProperty(instance, attr, value);
|
|
73
|
-
}
|
|
18
|
+
var textTypes = {
|
|
19
|
+
text: true,
|
|
20
|
+
icon: true,
|
|
21
|
+
style: true,
|
|
22
|
+
script: true,
|
|
23
|
+
};
|
|
24
|
+
function getAllowedProps(props, type) {
|
|
25
|
+
var children = props.children, tag = props.tag, rest = __rest(props, ["children", "tag"]);
|
|
26
|
+
if (textTypes[type]) {
|
|
27
|
+
rest.children = (!children || typeof children === 'boolean') ? null : Array.isArray(children) ? children.join('') : children + '';
|
|
74
28
|
}
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
return
|
|
29
|
+
if (typeof props.style === 'string')
|
|
30
|
+
rest[styleStringSymbol] = props.style;
|
|
31
|
+
return rest;
|
|
78
32
|
}
|
|
79
33
|
var hostConfig = {
|
|
80
34
|
getRootHostContext: function (rootContainerInstance) { return hostContext; },
|
|
@@ -88,37 +42,20 @@ var hostConfig = {
|
|
|
88
42
|
supportsPersistence: false,
|
|
89
43
|
isPrimaryRenderer: true,
|
|
90
44
|
createInstance: function (type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
((_a = props.children) === null || _a === void 0 ? void 0 : _a.toString()) || '';
|
|
96
|
-
return UnityBridge.createElement(type, text, rootContainerInstance);
|
|
97
|
-
}
|
|
98
|
-
return UnityBridge.createElement(props.tag || type, null, rootContainerInstance);
|
|
45
|
+
var aProps = getAllowedProps(props, type);
|
|
46
|
+
var children = aProps.children || null;
|
|
47
|
+
delete aProps.children;
|
|
48
|
+
return UnityBridge.createElement(props.tag || type, children, rootContainerInstance, aProps);
|
|
99
49
|
},
|
|
100
50
|
createTextInstance: function (text, rootContainerInstance, hostContext, internalInstanceHandle) {
|
|
101
51
|
return UnityBridge.createText(text, rootContainerInstance);
|
|
102
52
|
},
|
|
103
53
|
appendInitialChild: function (parent, child) { UnityBridge.appendChild(parent, child); },
|
|
104
54
|
finalizeInitialChildren: function (instance, type, props, rootContainerInstance, hostContext) {
|
|
105
|
-
|
|
106
|
-
var keys = Object.keys(props);
|
|
107
|
-
for (var index = 0; index < keys.length; index++) {
|
|
108
|
-
var key = keys[index];
|
|
109
|
-
var value = props[key];
|
|
110
|
-
propsToUpdate.push(key, value);
|
|
111
|
-
}
|
|
112
|
-
return applyUpdate(instance, propsToUpdate, false);
|
|
113
|
-
},
|
|
114
|
-
// Some attributes like style need to be changed only after mount
|
|
115
|
-
commitMount: function (instance, type, newProps, internalInstanceHandle) {
|
|
116
|
-
var props = [];
|
|
117
|
-
if ('style' in newProps)
|
|
118
|
-
props.push('style', newProps.style);
|
|
119
|
-
applyUpdate(instance, props, true);
|
|
55
|
+
return false;
|
|
120
56
|
},
|
|
121
|
-
|
|
57
|
+
commitMount: function (instance, type, newProps, internalInstanceHandle) { },
|
|
58
|
+
shouldSetTextContent: function (type, props) { return textTypes[type]; },
|
|
122
59
|
shouldDeprioritizeSubtree: function (type, props) { return false; },
|
|
123
60
|
// -------------------
|
|
124
61
|
// Mutation
|
|
@@ -128,7 +65,7 @@ var hostConfig = {
|
|
|
128
65
|
return diffProperties(oldProps, newProps);
|
|
129
66
|
},
|
|
130
67
|
commitUpdate: function (instance, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
|
|
131
|
-
applyUpdate(instance, updatePayload,
|
|
68
|
+
UnityBridge.applyUpdate(instance, getAllowedProps(updatePayload, type), type);
|
|
132
69
|
},
|
|
133
70
|
resetTextContent: function (instance) { console.log('resetTextContent'); },
|
|
134
71
|
commitTextUpdate: function (textInstance, oldText, newText) { UnityBridge.setText(textInstance, newText); },
|
|
@@ -152,19 +89,22 @@ var hostConfig = {
|
|
|
152
89
|
// -------------------
|
|
153
90
|
// Scheduling
|
|
154
91
|
// -------------------
|
|
155
|
-
scheduleDeferredCallback: function (callback, options) { return
|
|
156
|
-
cancelDeferredCallback: function (callBackID) {
|
|
92
|
+
scheduleDeferredCallback: function (callback, options) { return setTimeout(callback, (options === null || options === void 0 ? void 0 : options.timeout) || 0); },
|
|
93
|
+
cancelDeferredCallback: function (callBackID) { clearTimeout(callBackID); },
|
|
157
94
|
noTimeout: -1,
|
|
158
|
-
scheduleTimeout: function (callback, timeout) { return
|
|
159
|
-
cancelTimeout: function (handle) {
|
|
160
|
-
queueMicrotask: function (callback) { return
|
|
95
|
+
scheduleTimeout: function (callback, timeout) { return setTimeout(callback, timeout); },
|
|
96
|
+
cancelTimeout: function (handle) { clearTimeout(handle); },
|
|
97
|
+
queueMicrotask: function (callback) { return setTimeout(callback, 0); },
|
|
161
98
|
};
|
|
162
99
|
var ReactUnityReconciler = Reconciler(hostConfig);
|
|
100
|
+
var containerMap = new Map();
|
|
163
101
|
export var Renderer = {
|
|
164
102
|
render: function (element, hostContainer, renderWithoutHelpers) {
|
|
165
103
|
if (!hostContainer)
|
|
166
104
|
hostContainer = HostContainer;
|
|
167
|
-
var hostRoot =
|
|
105
|
+
var hostRoot = containerMap.get(hostContainer);
|
|
106
|
+
if (!hostRoot)
|
|
107
|
+
containerMap.set(hostContainer, hostRoot = ReactUnityReconciler.createContainer(hostContainer, 0, false, {}));
|
|
168
108
|
if (!renderWithoutHelpers)
|
|
169
109
|
element = createElement(DefaultView, null, element);
|
|
170
110
|
return ReactUnityReconciler.updateContainer(element, hostRoot, null);
|
package/dist/tests.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './models/tests';
|
|
1
|
+
export * from './src/models/tests';
|
package/dist/tests.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './models/tests';
|
|
1
|
+
export * from './src/models/tests';
|
package/dist/ugui.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './models/ugui';
|
|
1
|
+
export * from './src/models/ugui';
|
package/dist/ugui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './models/ugui';
|
|
1
|
+
export * from './src/models/ugui';
|
package/dist/uitoolkit.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './models/uitoolkit';
|
|
1
|
+
export * from './src/models/uitoolkit';
|
package/dist/uitoolkit.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './models/uitoolkit';
|
|
1
|
+
export * from './src/models/uitoolkit';
|
package/editor.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './models/editor';
|
|
1
|
+
export * from './src/models/editor';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactunity/renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "React renderer for Unity3D",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"preinstall": "npx only-allow@1.0.0 yarn",
|
|
34
33
|
"build:clean": "rimraf dist",
|
|
35
34
|
"build:base": "tsc",
|
|
36
35
|
"build:editor": "tsc -p tsconfig.editor.json",
|
|
@@ -39,7 +38,7 @@
|
|
|
39
38
|
"build": "yarn build:clean && yarn build:base && yarn build:editor && yarn build:ugui && yarn build:uitoolkit",
|
|
40
39
|
"prepare": "yarn build",
|
|
41
40
|
"watch": "tsc --watch",
|
|
42
|
-
"lint": "
|
|
41
|
+
"lint": "react-unity-scripts lint",
|
|
43
42
|
"local": "yalc publish --push",
|
|
44
43
|
"pack": "npm pack"
|
|
45
44
|
},
|
|
@@ -62,11 +61,9 @@
|
|
|
62
61
|
"react": "^17.0.2"
|
|
63
62
|
},
|
|
64
63
|
"devDependencies": {
|
|
65
|
-
"@
|
|
66
|
-
"@types/react-reconciler": "^0.26.
|
|
67
|
-
"@types/webpack-env": "^1.16.2",
|
|
68
|
-
"eslint": "^7.32.0",
|
|
64
|
+
"@reactunity/scripts": "^0.8.0",
|
|
65
|
+
"@types/react-reconciler": "^0.26.4",
|
|
69
66
|
"rimraf": "^3.0.2",
|
|
70
|
-
"typescript": "^4.4.
|
|
67
|
+
"typescript": "^4.4.4"
|
|
71
68
|
}
|
|
72
69
|
}
|
package/tests.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './models/tests';
|
|
1
|
+
export * from './src/models/tests';
|
package/ugui.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './models/ugui';
|
|
1
|
+
export * from './src/models/ugui';
|
package/uitoolkit.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './models/uitoolkit';
|
|
1
|
+
export * from './src/models/uitoolkit';
|
package/dist/models/base.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ReactUnity } from './generated';
|
|
2
|
-
import { NativeContainerInstance } from './renderer';
|
|
3
|
-
interface Console {
|
|
4
|
-
assert(condition?: boolean, ...data: any[]): void;
|
|
5
|
-
clear(): void;
|
|
6
|
-
debug(...data: any[]): void;
|
|
7
|
-
dir(item?: any, options?: any): void;
|
|
8
|
-
error(...data: any[]): void;
|
|
9
|
-
exception(message?: string, ...optionalParams: any[]): void;
|
|
10
|
-
info(...data: any[]): void;
|
|
11
|
-
log(...data: any[]): void;
|
|
12
|
-
trace(...data: any[]): void;
|
|
13
|
-
warn(...data: any[]): void;
|
|
14
|
-
}
|
|
15
|
-
declare global {
|
|
16
|
-
const UnityBridge: ReactUnity.ReactUnityBridge;
|
|
17
|
-
const Context: ReactUnity.ReactContext;
|
|
18
|
-
const HostContainer: NativeContainerInstance;
|
|
19
|
-
const UnityScheduler: ReactUnity.Scheduling.IScheduler;
|
|
20
|
-
const Callback: <T, R>(callback: (...args: T[]) => R) => ReactUnity.Helpers.Callback;
|
|
21
|
-
const location: ReactUnity.DomProxies.Location;
|
|
22
|
-
const localStorage: ReactUnity.DomProxies.LocalStorage;
|
|
23
|
-
const console: Console;
|
|
24
|
-
function matchMedia(query: string): ReactUnity.StyleEngine.MediaQueryList;
|
|
25
|
-
interface DefaultGlobals {
|
|
26
|
-
[key: string]: any;
|
|
27
|
-
}
|
|
28
|
-
const Globals: ReactUnity.Helpers.WatchableRecord<any> & DefaultGlobals;
|
|
29
|
-
}
|
|
30
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { ObjectFit } from '.';
|
|
2
|
-
import { Appearance, BackgroundBlendMode, CursorType, FontStyles, FontWeight, NavigationMode, PointerEvents, TextAlign, TextOverflowModes, Visibility, WhiteSpace } from './styles-enums';
|
|
3
|
-
import { AssetReference, ColorAux, NumberAux, Vector2Aux, Vector3Aux } from './values';
|
|
4
|
-
import { YogaValue2Aux, YogaValueAux } from './yoga';
|
|
5
|
-
export interface RenderStyle {
|
|
6
|
-
opacity?: NumberAux;
|
|
7
|
-
zIndex?: number;
|
|
8
|
-
visibility?: Visibility | boolean;
|
|
9
|
-
cursor?: CursorType | string;
|
|
10
|
-
pointerEvents?: PointerEvents;
|
|
11
|
-
content?: string;
|
|
12
|
-
appearance?: Appearance;
|
|
13
|
-
navigation?: NavigationMode;
|
|
14
|
-
backgroundBlendMode?: BackgroundBlendMode;
|
|
15
|
-
backgroundColor?: ColorAux;
|
|
16
|
-
backgroundImage?: AssetReference;
|
|
17
|
-
mask?: AssetReference;
|
|
18
|
-
maskImage?: AssetReference;
|
|
19
|
-
borderRadius?: NumberAux;
|
|
20
|
-
borderTopLeftRadius?: NumberAux;
|
|
21
|
-
borderTopRightRadius?: NumberAux;
|
|
22
|
-
borderBottomRightRadius?: NumberAux;
|
|
23
|
-
borderBottomLeftRadius?: NumberAux;
|
|
24
|
-
borderColor?: ColorAux;
|
|
25
|
-
borderTopColor?: ColorAux;
|
|
26
|
-
borderRightColor?: ColorAux;
|
|
27
|
-
borderBottomColor?: ColorAux;
|
|
28
|
-
borderLeftColor?: ColorAux;
|
|
29
|
-
boxShadow?: string;
|
|
30
|
-
objectFit?: ObjectFit;
|
|
31
|
-
objectPosition?: YogaValue2Aux;
|
|
32
|
-
transformOrigin?: Vector2Aux;
|
|
33
|
-
translate?: YogaValue2Aux;
|
|
34
|
-
scale?: Vector2Aux;
|
|
35
|
-
rotate?: Vector3Aux;
|
|
36
|
-
animation?: string;
|
|
37
|
-
transition?: string;
|
|
38
|
-
audio?: string;
|
|
39
|
-
stateDuration?: number;
|
|
40
|
-
color?: ColorAux;
|
|
41
|
-
fontFamily?: AssetReference;
|
|
42
|
-
fontWeight?: FontWeight;
|
|
43
|
-
fontStyle?: FontStyles;
|
|
44
|
-
fontSize?: YogaValueAux;
|
|
45
|
-
textOverflow?: TextOverflowModes;
|
|
46
|
-
textAlign?: TextAlign;
|
|
47
|
-
whiteSpace?: WhiteSpace;
|
|
48
|
-
textStrokeWidth?: NumberAux;
|
|
49
|
-
textStrokeColor?: ColorAux;
|
|
50
|
-
lineHeight?: number;
|
|
51
|
-
letterSpacing?: number;
|
|
52
|
-
wordSpacing?: number;
|
|
53
|
-
border?: string;
|
|
54
|
-
borderTop?: string;
|
|
55
|
-
borderRight?: string;
|
|
56
|
-
borderBottom?: string;
|
|
57
|
-
borderLeft?: string;
|
|
58
|
-
borderWidth?: string;
|
|
59
|
-
margin?: string;
|
|
60
|
-
padding?: string;
|
|
61
|
-
inset?: string;
|
|
62
|
-
flex?: string;
|
|
63
|
-
flexFlow?: string;
|
|
64
|
-
font?: string;
|
|
65
|
-
textStroke?: string;
|
|
66
|
-
[variable: `--${string}`]: any;
|
|
67
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NUnit, UnityEngine } from '../generated';
|
|
2
|
-
declare global {
|
|
3
|
-
const Assert: NUnit.Framework.Assert;
|
|
4
|
-
const Has: NUnit.Framework.Has;
|
|
5
|
-
const Is: NUnit.Framework.Is;
|
|
6
|
-
const Iz: NUnit.Framework.Iz;
|
|
7
|
-
const Contains: NUnit.Framework.Contains;
|
|
8
|
-
const Does: NUnit.Framework.Does;
|
|
9
|
-
const Assume: NUnit.Framework.Assume;
|
|
10
|
-
const Throws: NUnit.Framework.Throws;
|
|
11
|
-
const LogAssert: UnityEngine.TestTools.LogAssert;
|
|
12
|
-
}
|