onejs-core 1.0.12 → 1.0.14
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/definitions/Assemblies/OneJS.Runtime.d.ts +84 -55
- package/definitions/augments.d.ts +8 -5
- package/definitions/globals.d.ts +6 -6
- package/definitions/modules.d.ts +4 -0
- package/dist/dom/document.d.ts +0 -1
- package/dist/dom/dom.d.ts +0 -2
- package/dist/index.d.ts +0 -1
- package/dist/utils/color-parser.d.ts +0 -1
- package/dist/utils/float-parser.d.ts +0 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/subscribe.d.ts +4 -0
- package/dist/utils/subscribe.js +10 -0
- package/package.json +2 -2
- package/scripts/onejs-tw-config.cjs +4 -4
- package/scripts/uss-transform-plugin.cjs +5 -1
- package/tsconfig.json +2 -2
- package/utils/index.ts +1 -0
- package/utils/subscribe.ts +17 -0
|
@@ -14,13 +14,6 @@ declare namespace CS {
|
|
|
14
14
|
// }
|
|
15
15
|
// interface $Task<T> {}
|
|
16
16
|
namespace OneJS {
|
|
17
|
-
class WebApi extends System.Object
|
|
18
|
-
{
|
|
19
|
-
protected [__keep_incompatibility]: never;
|
|
20
|
-
public static getText ($uri: string, $callback: System.Action$1<string>) : UnityEngine.Coroutine
|
|
21
|
-
public static getImage ($uri: string, $callback: System.Action$1<UnityEngine.Texture2D>) : UnityEngine.Coroutine
|
|
22
|
-
public constructor ()
|
|
23
|
-
}
|
|
24
17
|
class EventfulPropertyAttribute extends System.Attribute implements System.Runtime.InteropServices._Attribute
|
|
25
18
|
{
|
|
26
19
|
protected [__keep_incompatibility]: never;
|
|
@@ -57,7 +50,7 @@ declare namespace CS {
|
|
|
57
50
|
public textAsset : UnityEngine.TextAsset
|
|
58
51
|
public constructor ()
|
|
59
52
|
}
|
|
60
|
-
class DTSGenerator extends
|
|
53
|
+
class DTSGenerator extends System.Object
|
|
61
54
|
{
|
|
62
55
|
protected [__keep_incompatibility]: never;
|
|
63
56
|
public assemblies : System.Array$1<string>
|
|
@@ -72,17 +65,21 @@ declare namespace CS {
|
|
|
72
65
|
public includeGlobalObjects : boolean
|
|
73
66
|
public constructor ()
|
|
74
67
|
}
|
|
75
|
-
|
|
68
|
+
interface IEngineHost {
|
|
69
|
+
add_onReload ($value: System.Action) : void
|
|
70
|
+
remove_onReload ($value: System.Action) : void
|
|
71
|
+
add_onDispose ($value: System.Action) : void
|
|
72
|
+
remove_onDispose ($value: System.Action) : void
|
|
73
|
+
}
|
|
74
|
+
class EngineHost extends System.Object implements System.IDisposable, IEngineHost
|
|
76
75
|
{
|
|
77
76
|
protected [__keep_incompatibility]: never;
|
|
78
|
-
public add_onReload ($value:
|
|
79
|
-
public remove_onReload ($value:
|
|
80
|
-
public
|
|
81
|
-
public
|
|
77
|
+
public add_onReload ($value: System.Action) : void
|
|
78
|
+
public remove_onReload ($value: System.Action) : void
|
|
79
|
+
public add_onDispose ($value: System.Action) : void
|
|
80
|
+
public remove_onDispose ($value: System.Action) : void
|
|
82
81
|
public subscribe ($eventSource: any, $eventName: string, $handler: Function) : System.Action
|
|
83
82
|
public subscribe ($eventName: string, $handler: Function) : System.Action
|
|
84
|
-
public InvokeOnReload () : void
|
|
85
|
-
public InvokeOnDestroy () : void
|
|
86
83
|
public Dispose () : void
|
|
87
84
|
public constructor ($engine: OneJS.ScriptEngine)
|
|
88
85
|
}
|
|
@@ -94,16 +91,22 @@ declare namespace CS {
|
|
|
94
91
|
public preloads : System.Array$1<UnityEngine.TextAsset>
|
|
95
92
|
public globalObjects : System.Array$1<OneJS.ObjectMappingPair>
|
|
96
93
|
public styleSheets : System.Array$1<UnityEngine.UIElements.StyleSheet>
|
|
94
|
+
public dtsGenerator : OneJS.DTSGenerator
|
|
97
95
|
public get Tick(): number;
|
|
98
96
|
public get WorkingDir(): string;
|
|
99
97
|
public get JsEnv(): Puerts.JsEnv;
|
|
98
|
+
public get AddToGlobal(): System.Action$2<string, any>;
|
|
99
|
+
public add_OnPreInit ($value: System.Action$1<Puerts.JsEnv>) : void
|
|
100
|
+
public remove_OnPreInit ($value: System.Action$1<Puerts.JsEnv>) : void
|
|
101
|
+
public add_OnPostInit ($value: System.Action$1<Puerts.JsEnv>) : void
|
|
102
|
+
public remove_OnPostInit ($value: System.Action$1<Puerts.JsEnv>) : void
|
|
100
103
|
public add_OnReload ($value: System.Action) : void
|
|
101
104
|
public remove_OnReload ($value: System.Action) : void
|
|
102
105
|
public GetFullPath ($filepath: string) : string
|
|
103
106
|
public Shutdown () : void
|
|
104
107
|
public Reload () : void
|
|
105
108
|
public EvalFile ($filepath: string) : void
|
|
106
|
-
public Eval ($code: string) : void
|
|
109
|
+
public Eval ($code: string, $chunkName?: string) : void
|
|
107
110
|
public GenerateGlobalsDefinitions () : void
|
|
108
111
|
public constructor ()
|
|
109
112
|
}
|
|
@@ -142,6 +145,20 @@ declare namespace CS {
|
|
|
142
145
|
public ClearLog () : void
|
|
143
146
|
public constructor ()
|
|
144
147
|
}
|
|
148
|
+
class StaticCoroutine extends System.Object
|
|
149
|
+
{
|
|
150
|
+
protected [__keep_incompatibility]: never;
|
|
151
|
+
public static Start ($coroutine: System.Collections.IEnumerator) : UnityEngine.Coroutine
|
|
152
|
+
public static Stop ($coroutine: UnityEngine.Coroutine) : void
|
|
153
|
+
public constructor ()
|
|
154
|
+
}
|
|
155
|
+
class WebApi extends System.Object
|
|
156
|
+
{
|
|
157
|
+
protected [__keep_incompatibility]: never;
|
|
158
|
+
public getText ($uri: string, $callback: System.Action$1<string>) : UnityEngine.Coroutine
|
|
159
|
+
public getImage ($url: string, $callback: System.Action$1<UnityEngine.Texture2D>) : UnityEngine.Coroutine
|
|
160
|
+
public constructor ()
|
|
161
|
+
}
|
|
145
162
|
class Runner extends UnityEngine.MonoBehaviour
|
|
146
163
|
{
|
|
147
164
|
protected [__keep_incompatibility]: never;
|
|
@@ -154,6 +171,7 @@ declare namespace CS {
|
|
|
154
171
|
public respawnJanitorOnSceneLoad : boolean
|
|
155
172
|
public stopCleaningOnDisable : boolean
|
|
156
173
|
public standalone : boolean
|
|
174
|
+
public Reload () : void
|
|
157
175
|
public constructor ()
|
|
158
176
|
}
|
|
159
177
|
class ScreenMonitor extends UnityEngine.MonoBehaviour
|
|
@@ -203,7 +221,7 @@ declare namespace CS {
|
|
|
203
221
|
class Dom extends System.Object
|
|
204
222
|
{
|
|
205
223
|
protected [__keep_incompatibility]: never;
|
|
206
|
-
public get document(): OneJS.Dom.
|
|
224
|
+
public get document(): OneJS.Dom.IDocument;
|
|
207
225
|
public get ve(): UnityEngine.UIElements.VisualElement;
|
|
208
226
|
public get childNodes(): System.Array$1<OneJS.Dom.Dom>;
|
|
209
227
|
public get firstChild(): OneJS.Dom.Dom;
|
|
@@ -235,16 +253,15 @@ declare namespace CS {
|
|
|
235
253
|
public removeEventListener ($name: string, $callback: UnityEngine.UIElements.EventCallback$1<UnityEngine.UIElements.EventBase>, $useCapture?: boolean) : void
|
|
236
254
|
public appendChild ($node: OneJS.Dom.Dom) : void
|
|
237
255
|
public removeChild ($child: OneJS.Dom.Dom) : void
|
|
238
|
-
public contains ($child: OneJS.Dom.Dom) : boolean
|
|
239
256
|
public insertBefore ($a: OneJS.Dom.Dom, $b: OneJS.Dom.Dom) : void
|
|
240
257
|
public insertAfter ($a: OneJS.Dom.Dom, $b: OneJS.Dom.Dom) : void
|
|
241
258
|
public setAttribute ($name: string, $val: any) : void
|
|
242
259
|
public removeAttribute ($name: string) : void
|
|
260
|
+
public contains ($child: OneJS.Dom.Dom) : boolean
|
|
243
261
|
public focus () : void
|
|
244
262
|
public First ($predicate: System.Func$2<OneJS.Dom.Dom, boolean>) : OneJS.Dom.Dom
|
|
245
263
|
public ProcessClassStr ($classStr: string, $dom: OneJS.Dom.Dom) : string
|
|
246
|
-
public constructor ($ve: UnityEngine.UIElements.VisualElement)
|
|
247
|
-
public constructor ($ve: UnityEngine.UIElements.VisualElement, $document: OneJS.Dom.Document)
|
|
264
|
+
public constructor ($ve: UnityEngine.UIElements.VisualElement, $document: OneJS.Dom.IDocument)
|
|
248
265
|
}
|
|
249
266
|
class ElementCreationOptions extends System.Object
|
|
250
267
|
{
|
|
@@ -252,14 +269,12 @@ declare namespace CS {
|
|
|
252
269
|
public is : string
|
|
253
270
|
public constructor ()
|
|
254
271
|
}
|
|
255
|
-
class Document extends System.Object
|
|
272
|
+
class Document extends System.Object implements OneJS.Dom.IDocument
|
|
256
273
|
{
|
|
257
274
|
protected [__keep_incompatibility]: never;
|
|
258
275
|
public get scriptEngine(): OneJS.ScriptEngine;
|
|
259
276
|
public get Root(): UnityEngine.UIElements.VisualElement;
|
|
260
277
|
public get body(): OneJS.Dom.Dom;
|
|
261
|
-
public get UIElementEventTypesDict(): System.Collections.Generic.Dictionary$2<string, System.Type>;
|
|
262
|
-
public FindUIElementEventType ($name: string) : System.Type
|
|
263
278
|
public addRuntimeUSS ($uss: string) : void
|
|
264
279
|
public removeRuntimeStyleSheet ($sheet: UnityEngine.UIElements.StyleSheet) : void
|
|
265
280
|
public clearRuntimeStyleSheets () : void
|
|
@@ -270,6 +285,8 @@ declare namespace CS {
|
|
|
270
285
|
public getElementById ($id: string) : OneJS.Dom.Dom
|
|
271
286
|
public querySelectorAll ($selector: string) : System.Array$1<OneJS.Dom.Dom>
|
|
272
287
|
public getDomFromVE ($ve: UnityEngine.UIElements.VisualElement) : OneJS.Dom.Dom
|
|
288
|
+
public clearCache () : void
|
|
289
|
+
public loadRemoteImage ($url: string, $callback: System.Action$1<UnityEngine.Texture2D>) : UnityEngine.Coroutine
|
|
273
290
|
public loadImage ($path: string, $filterMode?: UnityEngine.FilterMode) : UnityEngine.Texture2D
|
|
274
291
|
public loadFont ($path: string) : UnityEngine.Font
|
|
275
292
|
public loadFontDefinition ($path: string) : UnityEngine.UIElements.FontDefinition
|
|
@@ -278,6 +295,23 @@ declare namespace CS {
|
|
|
278
295
|
public static createStyleList ($v: any, $type: System.Type) : any
|
|
279
296
|
public static createStyleListWithKeyword ($keyword: UnityEngine.UIElements.StyleKeyword, $type: System.Type) : any
|
|
280
297
|
public constructor ($root: UnityEngine.UIElements.VisualElement, $scriptEngine: OneJS.ScriptEngine)
|
|
298
|
+
public loadRemoteImage ($path: string, $callback: System.Action$1<UnityEngine.Texture2D>) : UnityEngine.Coroutine
|
|
299
|
+
public AddCachingDom ($dom: OneJS.Dom.Dom) : void
|
|
300
|
+
public RemoveCachingDom ($dom: OneJS.Dom.Dom) : void
|
|
301
|
+
}
|
|
302
|
+
interface IDocument
|
|
303
|
+
{
|
|
304
|
+
createElement ($tagName: string) : OneJS.Dom.Dom
|
|
305
|
+
createElement ($tagName: string, $options: OneJS.Dom.ElementCreationOptions) : OneJS.Dom.Dom
|
|
306
|
+
createElementNS ($ns: string, $tagName: string, $options: OneJS.Dom.ElementCreationOptions) : OneJS.Dom.Dom
|
|
307
|
+
createTextNode ($text: string) : OneJS.Dom.Dom
|
|
308
|
+
clearCache () : void
|
|
309
|
+
loadRemoteImage ($path: string, $callback: System.Action$1<UnityEngine.Texture2D>) : UnityEngine.Coroutine
|
|
310
|
+
loadImage ($path: string, $filterMode?: UnityEngine.FilterMode) : UnityEngine.Texture2D
|
|
311
|
+
loadFont ($path: string) : UnityEngine.Font
|
|
312
|
+
loadFontDefinition ($path: string) : UnityEngine.UIElements.FontDefinition
|
|
313
|
+
AddCachingDom ($dom: OneJS.Dom.Dom) : void
|
|
314
|
+
RemoveCachingDom ($dom: OneJS.Dom.Dom) : void
|
|
281
315
|
}
|
|
282
316
|
class RegisteredCallbackHolder extends System.Object
|
|
283
317
|
{
|
|
@@ -385,7 +419,7 @@ declare namespace CS {
|
|
|
385
419
|
public static TryParseColorString ($s: string, $color: $Ref<UnityEngine.Color>) : boolean
|
|
386
420
|
public constructor ($dom: OneJS.Dom.Dom)
|
|
387
421
|
}
|
|
388
|
-
class Flipbook extends UnityEngine.UIElements.Image implements UnityEngine.UIElements.
|
|
422
|
+
class Flipbook extends UnityEngine.UIElements.Image implements UnityEngine.UIElements.Experimental.ITransitionAnimations, UnityEngine.UIElements.IVisualElementScheduler, UnityEngine.UIElements.IResolvedStyle, UnityEngine.UIElements.IStylePropertyAnimations, UnityEngine.UIElements.IEventHandler, UnityEngine.UIElements.IExperimentalFeatures, UnityEngine.UIElements.ITransform
|
|
389
423
|
{
|
|
390
424
|
protected [__keep_incompatibility]: never;
|
|
391
425
|
public get src(): any;
|
|
@@ -400,14 +434,14 @@ declare namespace CS {
|
|
|
400
434
|
public set randomRotation(value: boolean);
|
|
401
435
|
public constructor ()
|
|
402
436
|
}
|
|
403
|
-
class GradientRect extends UnityEngine.UIElements.VisualElement implements UnityEngine.UIElements.
|
|
437
|
+
class GradientRect extends UnityEngine.UIElements.VisualElement implements UnityEngine.UIElements.Experimental.ITransitionAnimations, UnityEngine.UIElements.IVisualElementScheduler, UnityEngine.UIElements.IResolvedStyle, UnityEngine.UIElements.IStylePropertyAnimations, UnityEngine.UIElements.IEventHandler, UnityEngine.UIElements.IExperimentalFeatures, UnityEngine.UIElements.ITransform
|
|
404
438
|
{
|
|
405
439
|
protected [__keep_incompatibility]: never;
|
|
406
440
|
public get Colors(): System.Array$1<UnityEngine.Color>;
|
|
407
441
|
public set Colors(value: System.Array$1<UnityEngine.Color>);
|
|
408
442
|
public constructor ()
|
|
409
443
|
}
|
|
410
|
-
class Img extends UnityEngine.UIElements.
|
|
444
|
+
class Img extends UnityEngine.UIElements.Image implements UnityEngine.UIElements.Experimental.ITransitionAnimations, UnityEngine.UIElements.IVisualElementScheduler, UnityEngine.UIElements.IResolvedStyle, UnityEngine.UIElements.IStylePropertyAnimations, UnityEngine.UIElements.IEventHandler, UnityEngine.UIElements.IExperimentalFeatures, UnityEngine.UIElements.ITransform
|
|
411
445
|
{
|
|
412
446
|
protected [__keep_incompatibility]: never;
|
|
413
447
|
public get Src(): string;
|
|
@@ -416,14 +450,6 @@ declare namespace CS {
|
|
|
416
450
|
public constructor ()
|
|
417
451
|
}
|
|
418
452
|
}
|
|
419
|
-
namespace OneJS.EngineHost {
|
|
420
|
-
interface ActionCallback
|
|
421
|
-
{
|
|
422
|
-
() : void;
|
|
423
|
-
Invoke?: () => void;
|
|
424
|
-
}
|
|
425
|
-
var ActionCallback: { new (func: () => void): ActionCallback; }
|
|
426
|
-
}
|
|
427
453
|
namespace Puerts {
|
|
428
454
|
class GenericDelegate extends System.Object
|
|
429
455
|
{
|
|
@@ -433,26 +459,17 @@ declare namespace CS {
|
|
|
433
459
|
{
|
|
434
460
|
protected [__keep_incompatibility]: never;
|
|
435
461
|
}
|
|
462
|
+
type JSObject = any;
|
|
436
463
|
}
|
|
437
464
|
namespace OneJS.EditorWorkingDirInfo {
|
|
438
465
|
enum EditorBaseDir
|
|
439
|
-
{ ProjectPath = 0, PersistentDataPath = 1 }
|
|
466
|
+
{ ProjectPath = 0, PersistentDataPath = 1, StreamingAssetsPath = 2 }
|
|
440
467
|
}
|
|
441
468
|
namespace OneJS.PlayerWorkingDirInfo {
|
|
442
469
|
enum PlayerBaseDir
|
|
443
|
-
{ PersistentDataPath = 0,
|
|
470
|
+
{ PersistentDataPath = 0, StreamingAssetsPath = 1, AppPath = 2 }
|
|
444
471
|
}
|
|
445
472
|
namespace OneJS.Utils {
|
|
446
|
-
class FloatConvUtil extends System.Object
|
|
447
|
-
{
|
|
448
|
-
protected [__keep_incompatibility]: never;
|
|
449
|
-
public static CreateFloatBuffer ($jsObj: any) : System.Array
|
|
450
|
-
public static SetFloatValue ($arr: System.Array, val: number, index: number) : void
|
|
451
|
-
public static SetFloat2Value ($arr: System.Array, val: Unity.Mathematics.float2, index: number) : void
|
|
452
|
-
public static SetFloat3Value ($arr: System.Array, val: Unity.Mathematics.float3, index: number) : void
|
|
453
|
-
public static SetFloat4Value ($arr: System.Array, val: Unity.Mathematics.float4, index: number) : void
|
|
454
|
-
public constructor ()
|
|
455
|
-
}
|
|
456
473
|
class AssemblyFinder extends System.Object
|
|
457
474
|
{
|
|
458
475
|
protected [__keep_incompatibility]: never;
|
|
@@ -461,6 +478,16 @@ declare namespace CS {
|
|
|
461
478
|
public static FindTypesInNamespace ($namespaceName: string) : System.Collections.Generic.List$1<System.Type>
|
|
462
479
|
public constructor ()
|
|
463
480
|
}
|
|
481
|
+
class FloatConvUtil extends System.Object
|
|
482
|
+
{
|
|
483
|
+
protected [__keep_incompatibility]: never;
|
|
484
|
+
public static CreateFloatBuffer ($obj: Puerts.JSObject) : System.Array$1<number>
|
|
485
|
+
public static SetFloatValue ($arr: System.Array, $val: number, $index: number) : void
|
|
486
|
+
public static SetFloat2Value ($arr: System.Array, $val: Unity.Mathematics.float2, $index: number) : void
|
|
487
|
+
public static SetFloat3Value ($arr: System.Array, $val: Unity.Mathematics.float3, $index: number) : void
|
|
488
|
+
public static SetFloat4Value ($arr: System.Array, $val: Unity.Mathematics.float4, $index: number) : void
|
|
489
|
+
public constructor ()
|
|
490
|
+
}
|
|
464
491
|
class CoroutineUtil extends UnityEngine.MonoBehaviour
|
|
465
492
|
{
|
|
466
493
|
protected [__keep_incompatibility]: never;
|
|
@@ -602,11 +629,21 @@ declare namespace CS {
|
|
|
602
629
|
class VisualElementExts extends System.Object
|
|
603
630
|
{
|
|
604
631
|
protected [__keep_incompatibility]: never;
|
|
632
|
+
public static Q ($e: UnityEngine.UIElements.VisualElement, $type: System.Type, $name?: string, ...classes: string[]) : UnityEngine.UIElements.VisualElement
|
|
633
|
+
public static Query ($e: UnityEngine.UIElements.VisualElement, $type: System.Type, $name?: string, ...classes: string[]) : UnityEngine.UIElements.UQueryBuilder$1<UnityEngine.UIElements.VisualElement>
|
|
605
634
|
public static Register ($cbeh: UnityEngine.UIElements.CallbackEventHandler, $eventType: System.Type, $handler: UnityEngine.UIElements.EventCallback$1<UnityEngine.UIElements.EventBase>, $useTrickleDown?: UnityEngine.UIElements.TrickleDown) : void
|
|
606
635
|
public static Unregister ($cbeh: UnityEngine.UIElements.CallbackEventHandler, $eventType: System.Type, $handler: UnityEngine.UIElements.EventCallback$1<UnityEngine.UIElements.EventBase>, $useTrickleDown?: UnityEngine.UIElements.TrickleDown) : void
|
|
607
636
|
public static ForceUpdate ($view: UnityEngine.UIElements.VisualElement) : void
|
|
608
637
|
}
|
|
609
638
|
}
|
|
639
|
+
namespace OneJS.Dom.Dom {
|
|
640
|
+
interface RegisterCallbackDelegate
|
|
641
|
+
{
|
|
642
|
+
(ve: UnityEngine.UIElements.VisualElement, callback: UnityEngine.UIElements.EventCallback$1<UnityEngine.UIElements.EventBase>, trickleDown: UnityEngine.UIElements.TrickleDown) : void;
|
|
643
|
+
Invoke?: (ve: UnityEngine.UIElements.VisualElement, callback: UnityEngine.UIElements.EventCallback$1<UnityEngine.UIElements.EventBase>, trickleDown: UnityEngine.UIElements.TrickleDown) => void;
|
|
644
|
+
}
|
|
645
|
+
var RegisterCallbackDelegate: { new (func: (ve: UnityEngine.UIElements.VisualElement, callback: UnityEngine.UIElements.EventCallback$1<UnityEngine.UIElements.EventBase>, trickleDown: UnityEngine.UIElements.TrickleDown) => void): RegisterCallbackDelegate; }
|
|
646
|
+
}
|
|
610
647
|
namespace OneJS.CustomStyleSheets {
|
|
611
648
|
class CSSSpec extends System.Object
|
|
612
649
|
{
|
|
@@ -642,7 +679,7 @@ declare namespace CS {
|
|
|
642
679
|
{
|
|
643
680
|
protected [__keep_incompatibility]: never;
|
|
644
681
|
public BuildStyleSheet ($asset: UnityEngine.UIElements.StyleSheet, $contents: string) : void
|
|
645
|
-
public constructor ($scriptEngine: OneJS.
|
|
682
|
+
public constructor ($scriptEngine: OneJS.IScriptEngine)
|
|
646
683
|
}
|
|
647
684
|
class Dimension extends System.ValueType implements System.IEquatable$1<OneJS.CustomStyleSheets.Dimension>
|
|
648
685
|
{
|
|
@@ -780,12 +817,4 @@ declare namespace CS {
|
|
|
780
817
|
enum Unit
|
|
781
818
|
{ Unitless = 0, Pixel = 1, Percent = 2, Second = 3, Millisecond = 4, Degree = 5, Gradian = 6, Radian = 7, Turn = 8 }
|
|
782
819
|
}
|
|
783
|
-
namespace OneJS.Dom.Dom {
|
|
784
|
-
interface RegisterCallbackDelegate
|
|
785
|
-
{
|
|
786
|
-
(ve: UnityEngine.UIElements.VisualElement, callback: UnityEngine.UIElements.EventCallback$1<UnityEngine.UIElements.EventBase>, trickleDown: UnityEngine.UIElements.TrickleDown) : void;
|
|
787
|
-
Invoke?: (ve: UnityEngine.UIElements.VisualElement, callback: UnityEngine.UIElements.EventCallback$1<UnityEngine.UIElements.EventBase>, trickleDown: UnityEngine.UIElements.TrickleDown) => void;
|
|
788
|
-
}
|
|
789
|
-
var RegisterCallbackDelegate: { new (func: (ve: UnityEngine.UIElements.VisualElement, callback: UnityEngine.UIElements.EventCallback$1<UnityEngine.UIElements.EventBase>, trickleDown: UnityEngine.UIElements.TrickleDown) => void): RegisterCallbackDelegate; }
|
|
790
|
-
}
|
|
791
820
|
}
|
|
@@ -34,11 +34,14 @@ declare global {
|
|
|
34
34
|
const cancelAnimationFrame: (id: number) => void
|
|
35
35
|
|
|
36
36
|
const console: {
|
|
37
|
-
log: (...args: any[]) => void
|
|
38
|
-
|
|
39
|
-
warn: (...args: any[]) => void
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
log: (...args: any[]) => void;
|
|
38
|
+
info: (...args: any[]) => void;
|
|
39
|
+
warn: (...args: any[]) => void;
|
|
40
|
+
error: (...args: any[]) => void;
|
|
41
|
+
trace: (...args: any[]) => void;
|
|
42
|
+
assert: (condition: boolean, ...args: any[]) => void;
|
|
43
|
+
time: (label: string) => void;
|
|
44
|
+
timeEnd: (label: string) => void;
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
interface Event {
|
package/definitions/globals.d.ts
CHANGED
|
@@ -12,13 +12,13 @@ declare namespace OneJS {
|
|
|
12
12
|
declare const onejs: {
|
|
13
13
|
add_onReload(handler: () => void): void
|
|
14
14
|
remove_onReload(handler: () => void): void
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
add_onDispose(handler: () => void): void
|
|
16
|
+
remove_onDispose(handler: () => void): void
|
|
17
17
|
|
|
18
|
-
interop: { // TODO
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
18
|
+
// interop: { // TODO
|
|
19
|
+
// classes: Record<string, any>
|
|
20
|
+
// objects: Record<string, any>
|
|
21
|
+
// }
|
|
22
22
|
|
|
23
23
|
subscribe<T, K extends OneJS.EventKeys<T>>(
|
|
24
24
|
eventSource: T,
|
package/definitions/modules.d.ts
CHANGED
package/dist/dom/document.d.ts
CHANGED
package/dist/dom/dom.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/// <reference path="../../definitions/modules.d.ts" />
|
|
2
|
-
/// <reference types="Assemblies" />
|
|
3
|
-
/// <reference types="Assemblies" />
|
|
4
2
|
import { EventBase } from "UnityEngine/UIElements";
|
|
5
3
|
import { DomStyleWrapper } from "./dom-style";
|
|
6
4
|
export declare class DomWrapper {
|
package/dist/index.d.ts
CHANGED
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -10,3 +10,4 @@ export { parseColor, parseCSSColor, colorStrToF4, namedColor, namedColors } from
|
|
|
10
10
|
export { palettes } from "./color-palettes";
|
|
11
11
|
// @ts-ignore - prevent `allowImportingTsExtensions` error
|
|
12
12
|
export { parseFloat2, parseFloat3, parseFloat4 } from "./float-parser";
|
|
13
|
+
export { subscribe } from "./subscribe";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Action, Delegate } from "System";
|
|
2
|
+
export function subscribe(target, eventName, callback) {
|
|
3
|
+
var action = new Action(callback);
|
|
4
|
+
target[eventName] = Delegate.Combine(target[eventName], action);
|
|
5
|
+
const unsubscribe = () => {
|
|
6
|
+
target[eventName] = Delegate.Remove(target[eventName], action);
|
|
7
|
+
};
|
|
8
|
+
onejs.add_onReload(unsubscribe);
|
|
9
|
+
return unsubscribe;
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onejs-core",
|
|
3
3
|
"description": "The JS part of OneJS, a UI framework and Scripting Engine for Unity.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.14",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
|
-
"types": "./
|
|
6
|
+
"types": "./typings.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"css-flatten": "^2.0.0",
|
|
9
9
|
"css-simple-parser": "^3.0.0"
|
|
@@ -6,7 +6,7 @@ theme.extend = {
|
|
|
6
6
|
transitionTimingFunction: {
|
|
7
7
|
DEFAULT: "ease-in-out",
|
|
8
8
|
"in-out": "ease-in-out",
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
}
|
|
11
11
|
exports.theme = theme
|
|
12
12
|
|
|
@@ -155,11 +155,11 @@ exports.plugins = [
|
|
|
155
155
|
exports.corePlugins = [
|
|
156
156
|
"alignContent", "alignItems", "alignSelf",
|
|
157
157
|
"justifyContent",
|
|
158
|
-
"backgroundColor", "backgroundImage", "backgroundPosition", "backgroundRepeat", "backgroundSize",
|
|
159
|
-
"borderColor", "borderRadius", "borderWidth",
|
|
158
|
+
"backgroundColor", "backgroundImage", "backgroundPosition", "backgroundRepeat", "backgroundSize",
|
|
159
|
+
"borderColor", "borderRadius", "borderWidth",
|
|
160
160
|
"colors", "textColor", "cursor",
|
|
161
161
|
"flex", "flexBasis", "flexDirection", "flexGrow", "flexShrink", "flexWrap",
|
|
162
|
-
"fontFamily", "fontSize", "fontStyle",
|
|
162
|
+
"fontFamily", "fontSize", "fontStyle",
|
|
163
163
|
"width", "height", "maxWidth", "maxHeight", "minWidth", "minHeight",
|
|
164
164
|
"margin", "padding",
|
|
165
165
|
"opacity", "overflow", "display", "visibility",
|
|
@@ -12,7 +12,7 @@ module.exports = () => {
|
|
|
12
12
|
root.walkRules((rule) => {
|
|
13
13
|
// Transform class selectors
|
|
14
14
|
rule.selectors = rule.selectors.map(selector =>
|
|
15
|
-
selector.replace(/(\\\.|\\#|\\%|\\:|\\\/|\\\[|\\\]|\\\(|\\\)|\\2c)/g, match => {
|
|
15
|
+
selector.replace(/(\\\.|\\#|\\%|\\:|\\\/|\\\[|\\\]|\\\(|\\\)|\\2c|\\&|\\>|\\<|\\\*)/g, match => {
|
|
16
16
|
switch (match) {
|
|
17
17
|
case '\\.': return '_d_';
|
|
18
18
|
case '\\#': return '_n_';
|
|
@@ -24,6 +24,10 @@ module.exports = () => {
|
|
|
24
24
|
case '\\(': return '_lp_';
|
|
25
25
|
case '\\)': return '_rp_';
|
|
26
26
|
case '\\2c': return '_cm_';
|
|
27
|
+
case '\\&': return '_amp_';
|
|
28
|
+
case '\\>': return '_gt_';
|
|
29
|
+
case '\\<': return '_lt_';
|
|
30
|
+
case '\\*': return '_ast_';
|
|
27
31
|
default: return match;
|
|
28
32
|
}
|
|
29
33
|
})
|
package/tsconfig.json
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
"module": "esnext",
|
|
5
5
|
"lib": [ "esnext" ],
|
|
6
6
|
"outDir": "./dist",
|
|
7
|
-
"moduleResolution": "
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
8
|
"jsx": "react",
|
|
9
9
|
"jsxFactory": "h",
|
|
10
10
|
"jsxFragmentFactory": "Fragment",
|
|
11
11
|
"skipLibCheck": false,
|
|
12
12
|
"forceConsistentCasingInFileNames": true,
|
|
13
13
|
"declaration": true,
|
|
14
|
-
"typeRoots": [
|
|
14
|
+
"typeRoots": [ ],
|
|
15
15
|
},
|
|
16
16
|
"include": [
|
|
17
17
|
"./**/*"
|
package/utils/index.ts
CHANGED
|
@@ -11,3 +11,4 @@ export { parseColor, parseCSSColor, colorStrToF4, namedColor, namedColors } from
|
|
|
11
11
|
export { palettes } from "./color-palettes"
|
|
12
12
|
// @ts-ignore - prevent `allowImportingTsExtensions` error
|
|
13
13
|
export { parseFloat2, parseFloat3, parseFloat4 } from "./float-parser"
|
|
14
|
+
export { subscribe } from "./subscribe"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Action, Delegate } from "System"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export function subscribe<T, K extends keyof T>(target: T, eventName: K, callback: () => void): () => void
|
|
5
|
+
export function subscribe<T, K extends keyof T>(target: { new(): T }, eventName: K, callback: () => void): () => void
|
|
6
|
+
export function subscribe(target: any, eventName: any, callback: () => void): () => void {
|
|
7
|
+
var action = new Action(callback)
|
|
8
|
+
target[eventName] = Delegate.Combine(target[eventName] as any, action) as any
|
|
9
|
+
|
|
10
|
+
const unsubscribe = () => {
|
|
11
|
+
target[eventName] = Delegate.Remove(target[eventName] as any, action) as any
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
onejs.add_onReload(unsubscribe)
|
|
15
|
+
|
|
16
|
+
return unsubscribe
|
|
17
|
+
}
|