onejs-core 0.3.5
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/.gitattributes +2 -0
- package/.github/workflows/jsr.yml +19 -0
- package/.prettierrc +5 -0
- package/3rdparty/preact/LICENSE +21 -0
- package/3rdparty/preact/clone-element.ts +45 -0
- package/3rdparty/preact/compat/Children.ts +21 -0
- package/3rdparty/preact/compat/forwardRef.ts +49 -0
- package/3rdparty/preact/compat/index.ts +3 -0
- package/3rdparty/preact/compat/memo.ts +34 -0
- package/3rdparty/preact/compat/util.ts +38 -0
- package/3rdparty/preact/component.ts +235 -0
- package/3rdparty/preact/constants.ts +3 -0
- package/3rdparty/preact/create-context.ts +71 -0
- package/3rdparty/preact/create-element.ts +98 -0
- package/3rdparty/preact/diff/catch-error.ts +40 -0
- package/3rdparty/preact/diff/children.ts +355 -0
- package/3rdparty/preact/diff/index.ts +563 -0
- package/3rdparty/preact/diff/props.ts +174 -0
- package/3rdparty/preact/hooks/index.ts +536 -0
- package/3rdparty/preact/hooks/internal.d.ts +85 -0
- package/3rdparty/preact/hooks.d.ts +145 -0
- package/3rdparty/preact/index.ts +13 -0
- package/3rdparty/preact/internal.d.ts +155 -0
- package/3rdparty/preact/jsx-runtime/index.ts +80 -0
- package/3rdparty/preact/jsx.d.ts +1008 -0
- package/3rdparty/preact/options.ts +16 -0
- package/3rdparty/preact/preact.d.ts +317 -0
- package/3rdparty/preact/render.ts +76 -0
- package/3rdparty/preact/signals/index.ts +443 -0
- package/3rdparty/preact/signals/internal.d.ts +36 -0
- package/3rdparty/preact/signals-core/index.ts +663 -0
- package/3rdparty/preact/style.d.ts +205 -0
- package/3rdparty/preact/util.ts +29 -0
- package/@DO_NOT_CHANGE.txt +3 -0
- package/README.md +33 -0
- package/definitions/app.d.ts +52048 -0
- package/definitions/augments.d.ts +16 -0
- package/definitions/globals.d.ts +34 -0
- package/definitions/index.d.ts +9 -0
- package/definitions/jsx.d.ts +517 -0
- package/definitions/modules.d.ts +29 -0
- package/definitions/onejs.d.ts +164 -0
- package/definitions/preact.jsx.d.ts +7 -0
- package/definitions/proto-overrides.d.ts +13 -0
- package/definitions/puerts.d.ts +31 -0
- package/definitions/unity-engine.d.ts +23 -0
- package/hooks/eventful.ts +56 -0
- package/import-transform.mjs +42 -0
- package/index.ts +44 -0
- package/jsr.json +10 -0
- package/onejs-tw-config.cjs +188 -0
- package/package.json +9 -0
- package/preloads/inject.ts +44 -0
- package/styling/index.tsx +80 -0
- package/styling/utils/generateAlphabeticName.ts +21 -0
- package/styling/utils/generateComponentId.ts +6 -0
- package/styling/utils/hash.ts +46 -0
- package/switch.cjs +185 -0
- package/uss-transform-plugin.cjs +83 -0
- package/utils/color-palettes.ts +3 -0
- package/utils/color-parser.ts +249 -0
- package/utils/float-parser.ts +31 -0
- package/utils/index.ts +12 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Document {
|
|
3
|
+
addRuntimeUSS(uss: string): void
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
interface Element {
|
|
7
|
+
classname: string
|
|
8
|
+
ve: CS.UnityEngine.UIElements.VisualElement
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface HTMLElement {
|
|
12
|
+
style: CS.OneJS.Dom.DomStyle
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare namespace OneJS {
|
|
2
|
+
class Event<F extends Function> {
|
|
3
|
+
// Must have at least an unique member, because an empty class behaves like `any`
|
|
4
|
+
#Invoke(...args: any): any
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
type EventKeys<T> = { [k in keyof T]-?: T[k] extends Event<any> ? k : never }[keyof T]
|
|
8
|
+
|
|
9
|
+
type EventGenericType<T> = T extends Event<infer F> ? F : never
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare const onejs: {
|
|
13
|
+
add_onReload(handler: () => void): void
|
|
14
|
+
remove_onReload(handler: () => void): void
|
|
15
|
+
add_onDestroy(handler: () => void): void
|
|
16
|
+
remove_onDestroy(handler: () => void): void
|
|
17
|
+
|
|
18
|
+
interop: { // TODO
|
|
19
|
+
classes: Record<string, any>
|
|
20
|
+
objects: Record<string, any>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
subscribe<T, K extends OneJS.EventKeys<T>>(
|
|
24
|
+
eventSource: T,
|
|
25
|
+
eventName: K,
|
|
26
|
+
handler: OneJS.EventGenericType<T[K]>
|
|
27
|
+
): () => void
|
|
28
|
+
|
|
29
|
+
subscribe(eventName: string, handler: () => void): () => void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare function require(name: string): any
|
|
33
|
+
|
|
34
|
+
declare const resource: CS.OneJS.Resource
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference path="./app.d.ts" />
|
|
2
|
+
/// <reference path="./modules.d.ts" />
|
|
3
|
+
/// <reference path="./onejs.d.ts" />
|
|
4
|
+
/// <reference path="./globals.d.ts" />
|
|
5
|
+
/// <reference path="./jsx.d.ts" />
|
|
6
|
+
/// <reference path="./preact.jsx.d.ts" />
|
|
7
|
+
/// <reference path="./puerts.d.ts" />
|
|
8
|
+
/// <reference path="./unity-engine.d.ts" />
|
|
9
|
+
/// <reference path="./proto-overrides.d.ts" />
|
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
type Texture = CS.UnityEngine.Texture;
|
|
2
|
+
type Sprite = CS.UnityEngine.Sprite;
|
|
3
|
+
type Rect = CS.UnityEngine.Rect;
|
|
4
|
+
type Vector2 = CS.UnityEngine.Vector2;
|
|
5
|
+
type Vector2Int = CS.UnityEngine.Vector2Int;
|
|
6
|
+
type Vector3 = CS.UnityEngine.Vector3;
|
|
7
|
+
type Vector3Int = CS.UnityEngine.Vector3Int;
|
|
8
|
+
type Vector4 = CS.UnityEngine.Vector4;
|
|
9
|
+
type RectInt = CS.UnityEngine.RectInt;
|
|
10
|
+
type Bounds = CS.UnityEngine.Bounds;
|
|
11
|
+
type BoundsInt = CS.UnityEngine.BoundsInt;
|
|
12
|
+
type Texture2D = CS.UnityEngine.Texture2D;
|
|
13
|
+
|
|
14
|
+
type AttachToPanelEvent = CS.UnityEngine.UIElements.AttachToPanelEvent;
|
|
15
|
+
type BlurEvent = CS.UnityEngine.UIElements.BlurEvent;
|
|
16
|
+
type ChangeEvent<T> = CS.UnityEngine.UIElements.ChangeEvent<T>;
|
|
17
|
+
type ClickEvent = CS.UnityEngine.UIElements.ClickEvent;
|
|
18
|
+
type DetachFromPanelEvent = CS.UnityEngine.UIElements.DetachFromPanelEvent;
|
|
19
|
+
type DragEnterEvent = CS.UnityEngine.UIElements.DragEnterEvent;
|
|
20
|
+
type DragExitedEvent = CS.UnityEngine.UIElements.DragExitedEvent;
|
|
21
|
+
type DragLeaveEvent = CS.UnityEngine.UIElements.DragLeaveEvent;
|
|
22
|
+
type DragPerformEvent = CS.UnityEngine.UIElements.DragPerformEvent;
|
|
23
|
+
type DragUpdatedEvent = CS.UnityEngine.UIElements.DragUpdatedEvent;
|
|
24
|
+
type ExecuteCommandEvent = CS.UnityEngine.UIElements.ExecuteCommandEvent;
|
|
25
|
+
type FocusEvent = CS.UnityEngine.UIElements.FocusEvent;
|
|
26
|
+
type FocusInEvent = CS.UnityEngine.UIElements.FocusInEvent;
|
|
27
|
+
type FocusOutEvent = CS.UnityEngine.UIElements.FocusOutEvent;
|
|
28
|
+
type GeometryChangedEvent = CS.UnityEngine.UIElements.GeometryChangedEvent;
|
|
29
|
+
type InputEvent = CS.UnityEngine.UIElements.InputEvent;
|
|
30
|
+
type KeyDownEvent = CS.UnityEngine.UIElements.KeyDownEvent;
|
|
31
|
+
type KeyUpEvent = CS.UnityEngine.UIElements.KeyUpEvent;
|
|
32
|
+
type MouseCaptureEvent = CS.UnityEngine.UIElements.MouseCaptureEvent;
|
|
33
|
+
type MouseCaptureOutEvent = CS.UnityEngine.UIElements.MouseCaptureOutEvent;
|
|
34
|
+
type MouseDownEvent = CS.UnityEngine.UIElements.MouseDownEvent;
|
|
35
|
+
type MouseEnterEvent = CS.UnityEngine.UIElements.MouseEnterEvent;
|
|
36
|
+
type MouseEnterWindowEvent = CS.UnityEngine.UIElements.MouseEnterWindowEvent;
|
|
37
|
+
type MouseLeaveEvent = CS.UnityEngine.UIElements.MouseLeaveEvent;
|
|
38
|
+
type MouseLeaveWindowEvent = CS.UnityEngine.UIElements.MouseLeaveWindowEvent;
|
|
39
|
+
type MouseMoveEvent = CS.UnityEngine.UIElements.MouseMoveEvent;
|
|
40
|
+
type MouseOutEvent = CS.UnityEngine.UIElements.MouseOutEvent;
|
|
41
|
+
type MouseOverEvent = CS.UnityEngine.UIElements.MouseOverEvent;
|
|
42
|
+
type MouseUpEvent = CS.UnityEngine.UIElements.MouseUpEvent;
|
|
43
|
+
type NavigationCancelEvent = CS.UnityEngine.UIElements.NavigationCancelEvent;
|
|
44
|
+
type NavigationMoveEvent = CS.UnityEngine.UIElements.NavigationMoveEvent;
|
|
45
|
+
type NavigationSubmitEvent = CS.UnityEngine.UIElements.NavigationSubmitEvent;
|
|
46
|
+
type PickingMode = CS.UnityEngine.UIElements.PickingMode;
|
|
47
|
+
type PointerCancelEvent = CS.UnityEngine.UIElements.PointerCancelEvent;
|
|
48
|
+
type PointerCaptureEvent = CS.UnityEngine.UIElements.PointerCaptureEvent;
|
|
49
|
+
type PointerCaptureOutEvent = CS.UnityEngine.UIElements.PointerCaptureOutEvent;
|
|
50
|
+
type PointerDownEvent = CS.UnityEngine.UIElements.PointerDownEvent;
|
|
51
|
+
type PointerEnterEvent = CS.UnityEngine.UIElements.PointerEnterEvent;
|
|
52
|
+
type PointerLeaveEvent = CS.UnityEngine.UIElements.PointerLeaveEvent;
|
|
53
|
+
type PointerMoveEvent = CS.UnityEngine.UIElements.PointerMoveEvent;
|
|
54
|
+
type PointerOutEvent = CS.UnityEngine.UIElements.PointerOutEvent;
|
|
55
|
+
type PointerOverEvent = CS.UnityEngine.UIElements.PointerOverEvent;
|
|
56
|
+
type PointerStationaryEvent = CS.UnityEngine.UIElements.PointerStationaryEvent;
|
|
57
|
+
type PointerUpEvent = CS.UnityEngine.UIElements.PointerUpEvent;
|
|
58
|
+
type ScrollViewMode = CS.UnityEngine.UIElements.ScrollViewMode;
|
|
59
|
+
type ScrollerVisibility = CS.UnityEngine.UIElements.ScrollerVisibility;
|
|
60
|
+
type TooltipEvent = CS.UnityEngine.UIElements.TooltipEvent;
|
|
61
|
+
type TransitionCancelEvent = CS.UnityEngine.UIElements.TransitionCancelEvent;
|
|
62
|
+
type TransitionEndEvent = CS.UnityEngine.UIElements.TransitionEndEvent;
|
|
63
|
+
type TransitionRunEvent = CS.UnityEngine.UIElements.TransitionRunEvent;
|
|
64
|
+
type TransitionStartEvent = CS.UnityEngine.UIElements.TransitionStartEvent;
|
|
65
|
+
type ValidateCommandEvent = CS.UnityEngine.UIElements.ValidateCommandEvent;
|
|
66
|
+
type VectorImage = CS.UnityEngine.UIElements.VectorImage;
|
|
67
|
+
type WheelEvent = CS.UnityEngine.UIElements.WheelEvent;
|
|
68
|
+
|
|
69
|
+
declare namespace JSX {
|
|
70
|
+
|
|
71
|
+
interface IntrinsicElements {
|
|
72
|
+
[elemName: string]: any; // Allows any element with any props
|
|
73
|
+
// For specific elements, define more strictly, e.g.,
|
|
74
|
+
// div: any; // For a div, replace `any` with a more specific type as needed
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface IntrinsicAttributes {
|
|
78
|
+
id?: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Base elements
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
interface BaseElement {
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type RecursiveElement = string | number | object | bigint | boolean | BaseElement | null | undefined | RecursiveElement[]
|
|
90
|
+
|
|
91
|
+
interface CommonEvents {
|
|
92
|
+
onValidateCommand?: (e: ValidateCommandEvent) => void
|
|
93
|
+
onExecuteCommand?: (e: ExecuteCommandEvent) => void
|
|
94
|
+
onDragExited?: (e: DragExitedEvent) => void
|
|
95
|
+
onDragEnter?: (e: DragEnterEvent) => void
|
|
96
|
+
onDragLeave?: (e: DragLeaveEvent) => void
|
|
97
|
+
onDragUpdated?: (e: DragUpdatedEvent) => void
|
|
98
|
+
onDragPerform?: (e: DragPerformEvent) => void
|
|
99
|
+
onFocusOut?: (e: FocusOutEvent) => void
|
|
100
|
+
onBlur?: (e: BlurEvent) => void
|
|
101
|
+
onFocusIn?: (e: FocusInEvent) => void
|
|
102
|
+
onFocus?: (e: FocusEvent) => void
|
|
103
|
+
onInput?: (e: InputEvent) => void
|
|
104
|
+
onKeyDown?: (e: KeyDownEvent) => void
|
|
105
|
+
onKeyUp?: (e: KeyUpEvent) => void
|
|
106
|
+
onGeometryChanged?: (e: GeometryChangedEvent) => void
|
|
107
|
+
onMouseDown?: (e: MouseDownEvent) => void
|
|
108
|
+
onMouseUp?: (e: MouseUpEvent) => void
|
|
109
|
+
onMouseMove?: (e: MouseMoveEvent) => void
|
|
110
|
+
// onContextClick?: (e: ContextClickEvent) => void
|
|
111
|
+
onWheel?: (e: WheelEvent) => void
|
|
112
|
+
onMouseEnter?: (e: MouseEnterEvent) => void
|
|
113
|
+
onMouseLeave?: (e: MouseLeaveEvent) => void
|
|
114
|
+
onMouseEnterWindow?: (e: MouseEnterWindowEvent) => void
|
|
115
|
+
onMouseLeaveWindow?: (e: MouseLeaveWindowEvent) => void
|
|
116
|
+
onMouseOver?: (e: MouseOverEvent) => void
|
|
117
|
+
onMouseOut?: (e: MouseOutEvent) => void
|
|
118
|
+
// onContextualMenuPopulate?: (e: ContextualMenuPopulateEvent) => void
|
|
119
|
+
onNavigationMove?: (e: NavigationMoveEvent) => void
|
|
120
|
+
// onNavigationTab?: (e: NavigationTabEvent) => void
|
|
121
|
+
onNavigationCancel?: (e: NavigationCancelEvent) => void
|
|
122
|
+
onNavigationSubmit?: (e: NavigationSubmitEvent) => void
|
|
123
|
+
onAttachToPanel?: (e: AttachToPanelEvent) => void
|
|
124
|
+
onDetachFromPanel?: (e: DetachFromPanelEvent) => void
|
|
125
|
+
onPointerDown?: (e: PointerDownEvent) => void
|
|
126
|
+
onPointerMove?: (e: PointerMoveEvent) => void
|
|
127
|
+
onPointerStationary?: (e: PointerStationaryEvent) => void
|
|
128
|
+
onPointerUp?: (e: PointerUpEvent) => void
|
|
129
|
+
onPointerCancel?: (e: PointerCancelEvent) => void
|
|
130
|
+
onClick?: (e: ClickEvent) => void
|
|
131
|
+
onPointerEnter?: (e: PointerEnterEvent) => void
|
|
132
|
+
onPointerLeave?: (e: PointerLeaveEvent) => void
|
|
133
|
+
onPointerOver?: (e: PointerOverEvent) => void
|
|
134
|
+
onPointerOut?: (e: PointerOutEvent) => void
|
|
135
|
+
// onCustomStyleResolved?: (e: CustomStyleResolvedEvent) => void
|
|
136
|
+
onTooltip?: (e: TooltipEvent) => void
|
|
137
|
+
onTransitionRun?: (e: TransitionRunEvent) => void
|
|
138
|
+
onTransitionStart?: (e: TransitionStartEvent) => void
|
|
139
|
+
onTransitionEnd?: (e: TransitionEndEvent) => void
|
|
140
|
+
onTransitionCancel?: (e: TransitionCancelEvent) => void
|
|
141
|
+
// onIMGUI?: (e: IMGUIEvent) => void
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
type AppendCapture<T> = {
|
|
145
|
+
[K in keyof T as `${Extract<K, string>}Capture`]: T[K]
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
type RefObject<T> = { current: T | null };
|
|
149
|
+
type RefCallback<T> = (instance: T | null) => void;
|
|
150
|
+
type Ref<T> = RefObject<T> | RefCallback<T>;
|
|
151
|
+
|
|
152
|
+
interface VisualElement extends CommonEvents, AppendCapture<CommonEvents> {
|
|
153
|
+
id?: string
|
|
154
|
+
ref?: Ref<any>
|
|
155
|
+
key?: string | number
|
|
156
|
+
disabled?: boolean
|
|
157
|
+
|
|
158
|
+
children?: RecursiveElement
|
|
159
|
+
|
|
160
|
+
dangerouslySetInnerHTML?: {
|
|
161
|
+
__html: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
name?: string
|
|
165
|
+
class?: string
|
|
166
|
+
style?: Partial<CS.OneJS.Dom.DomStyle>
|
|
167
|
+
tooltip?: string
|
|
168
|
+
focusable?: boolean
|
|
169
|
+
tabindex?: number
|
|
170
|
+
"picking-mode"?: PickingMode
|
|
171
|
+
"view-data-key"?: string
|
|
172
|
+
|
|
173
|
+
onPointerCaptureOut?: (e: PointerCaptureOutEvent) => void
|
|
174
|
+
onPointerCapture?: (e: PointerCaptureEvent) => void
|
|
175
|
+
onMouseCaptureOut?: (e: MouseCaptureOutEvent) => void
|
|
176
|
+
onMouseCapture?: (e: MouseCaptureEvent) => void
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
type VisualElementNoChildren = Omit<VisualElement, "children">
|
|
180
|
+
type BindableElementNoChildren = Omit<BindableElement, "children">
|
|
181
|
+
|
|
182
|
+
interface BindableElement extends VisualElement {
|
|
183
|
+
"binding-path"?: string
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Utilities
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
interface Box extends VisualElement {
|
|
191
|
+
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface TextElement extends VisualElement {
|
|
195
|
+
text?: string
|
|
196
|
+
enableRichText?: boolean
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
interface Label extends TextElement {
|
|
200
|
+
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface Image extends VisualElementNoChildren {
|
|
204
|
+
image?: Texture
|
|
205
|
+
sprite?: Sprite
|
|
206
|
+
vectorImage?: VectorImage
|
|
207
|
+
sourceRect?: Rect
|
|
208
|
+
uv?: Rect
|
|
209
|
+
scaleMode?: ScaleMode
|
|
210
|
+
tintColor?: Color
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
interface IMGUIContainer extends VisualElementNoChildren {
|
|
214
|
+
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
interface Foldout extends BindableElement {
|
|
218
|
+
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Templates
|
|
223
|
+
*/
|
|
224
|
+
|
|
225
|
+
interface Template extends BindableElementNoChildren {
|
|
226
|
+
name?: string
|
|
227
|
+
path?: string
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
interface Instance extends BindableElementNoChildren {
|
|
231
|
+
template?: string
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
interface TemplateContainer extends BindableElementNoChildren {
|
|
235
|
+
template?: string
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Controls
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
interface BaseField<T> extends BindableElementNoChildren {
|
|
243
|
+
label?: string
|
|
244
|
+
value?: T
|
|
245
|
+
onValueChanged?: (e: ChangeEvent<T>) => void
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
interface BaseBoolField extends BaseField<boolean> {
|
|
249
|
+
text?: string
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
interface Button extends TextElement {
|
|
253
|
+
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
interface RadioButton extends BaseBoolField {
|
|
257
|
+
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
interface RadioButtonGroup extends BindableElement {
|
|
261
|
+
label?: string
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
interface RepeatButton extends TextElement {
|
|
265
|
+
delay?: number
|
|
266
|
+
interva?: number
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
interface Toggle extends BaseBoolField {
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
interface Scroller extends VisualElementNoChildren {
|
|
274
|
+
"low-value"?: number
|
|
275
|
+
"high-value"?: number
|
|
276
|
+
direction?: "Horizontal" | "Vertical"
|
|
277
|
+
value?: number
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
enum SliderDirection {
|
|
281
|
+
Horizontal,
|
|
282
|
+
Vertical
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
interface Slider extends BaseField<number> {
|
|
286
|
+
"low-value"?: number
|
|
287
|
+
"high-value"?: number
|
|
288
|
+
direction?: SliderDirection
|
|
289
|
+
"page-size"?: number
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
interface SliderInt extends BaseField<number> {
|
|
293
|
+
"low-value"?: number
|
|
294
|
+
"high-value"?: number
|
|
295
|
+
direction?: SliderDirection
|
|
296
|
+
"page-size"?: number
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
interface MinMaxSlider extends BaseField<Vector2> {
|
|
300
|
+
"low-limit"?: number
|
|
301
|
+
"high-limit"?: number
|
|
302
|
+
"min-value"?: number
|
|
303
|
+
"max-value"?: number
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
interface EnumField extends BaseField<number> {
|
|
307
|
+
type?: string
|
|
308
|
+
value?: number
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
interface ProgressBar extends BindableElementNoChildren {
|
|
312
|
+
"low-value"?: number
|
|
313
|
+
"high-value"?: number
|
|
314
|
+
value?: number
|
|
315
|
+
title?: string
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Text input
|
|
320
|
+
*/
|
|
321
|
+
|
|
322
|
+
interface TextInputBaseField<T> extends BaseField<T> {
|
|
323
|
+
text?: string
|
|
324
|
+
"max-length"?: number
|
|
325
|
+
"is-password-field"?: boolean
|
|
326
|
+
"mask-char"?: string
|
|
327
|
+
"is-read-only"?: boolean
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
interface TextField extends TextInputBaseField<string> {
|
|
331
|
+
multiline?: boolean
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
interface TextValueField<T> extends TextInputBaseField<T> {
|
|
335
|
+
formatString?: string
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
interface IntegerField extends TextValueField<number> {
|
|
339
|
+
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
interface LongField extends TextValueField<number> {
|
|
343
|
+
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
interface FloatField extends TextValueField<number> {
|
|
347
|
+
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
interface DoubleField extends TextValueField<number> {
|
|
351
|
+
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
interface Vector2Field extends BaseField<Vector2> {
|
|
355
|
+
x?: number
|
|
356
|
+
y?: number
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
interface Vector2IntField extends BaseField<Vector2Int> {
|
|
360
|
+
x?: number
|
|
361
|
+
y?: number
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
interface Vector3Field extends BaseField<Vector3> {
|
|
365
|
+
x?: number
|
|
366
|
+
y?: number
|
|
367
|
+
z?: number
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
interface Vector3IntField extends BaseField<Vector3Int> {
|
|
371
|
+
x?: number
|
|
372
|
+
y?: number
|
|
373
|
+
z?: number
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
interface Vector4Field extends BaseField<Vector4> {
|
|
377
|
+
x?: number
|
|
378
|
+
y?: number
|
|
379
|
+
z?: number
|
|
380
|
+
w?: number
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
interface RectField extends BaseField<Rect> {
|
|
384
|
+
x?: number
|
|
385
|
+
y?: number
|
|
386
|
+
w?: number
|
|
387
|
+
h?: number
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
interface RectIntField extends BaseField<RectInt> {
|
|
391
|
+
x?: number
|
|
392
|
+
y?: number
|
|
393
|
+
w?: number
|
|
394
|
+
h?: number
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
interface BoundsField extends BaseField<Bounds> {
|
|
398
|
+
cx?: number
|
|
399
|
+
cy?: number
|
|
400
|
+
cz?: number
|
|
401
|
+
ex?: number
|
|
402
|
+
ey?: number
|
|
403
|
+
ez?: number
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
interface BoundsIntField extends BaseField<BoundsInt> {
|
|
407
|
+
px?: number
|
|
408
|
+
py?: number
|
|
409
|
+
pz?: number
|
|
410
|
+
sx?: number
|
|
411
|
+
sy?: number
|
|
412
|
+
sz?: number
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
interface ListView extends VisualElementNoChildren {
|
|
416
|
+
"item-height"?: number
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
interface SimpleListView extends ListView {
|
|
420
|
+
make?: () => any
|
|
421
|
+
bind?: (e: any, i: number) => void
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
interface ScrollView extends VisualElement {
|
|
425
|
+
mode?: ScrollViewMode
|
|
426
|
+
"horizontal-scroller-visibility"?: ScrollerVisibility
|
|
427
|
+
"vertical-scroller-visibility"?: ScrollerVisibility
|
|
428
|
+
"horizontal-page-size"?: number
|
|
429
|
+
"vertical-page-size"?: number
|
|
430
|
+
// "touch-scroll-behavior"?: TouchScrollBehavior
|
|
431
|
+
"scroll-deceleration-rate"?: number
|
|
432
|
+
"elasticity"?: number
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
interface TreeView extends VisualElement {
|
|
436
|
+
"item-height"?: number
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
interface PopupWindow extends TextElement {
|
|
440
|
+
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
interface DropdownField extends BaseField<string> {
|
|
444
|
+
text?: string
|
|
445
|
+
label?: string
|
|
446
|
+
index?: number
|
|
447
|
+
choices?: string[]
|
|
448
|
+
value?: string
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* OneJS Elements
|
|
453
|
+
*/
|
|
454
|
+
|
|
455
|
+
interface GradientRect extends VisualElement {
|
|
456
|
+
colors?: Color[]
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
interface Flipbook extends VisualElement {
|
|
460
|
+
src?: string | Texture2D
|
|
461
|
+
count?: number
|
|
462
|
+
interval?: number
|
|
463
|
+
"num-per-row"?: number
|
|
464
|
+
"random-rotation"?: boolean
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* All-in-one
|
|
469
|
+
*/
|
|
470
|
+
|
|
471
|
+
interface IntrinsicElements {
|
|
472
|
+
div: VisualElement
|
|
473
|
+
box: Box
|
|
474
|
+
textelement: TextElement
|
|
475
|
+
label: Label
|
|
476
|
+
image: Image
|
|
477
|
+
foldout: Foldout
|
|
478
|
+
template: Template
|
|
479
|
+
instance: Instance
|
|
480
|
+
templatecontainer: TemplateContainer
|
|
481
|
+
button: Button
|
|
482
|
+
radiobutton: RadioButton
|
|
483
|
+
radiobuttongroup: RadioButtonGroup
|
|
484
|
+
repeatbutton: RepeatButton
|
|
485
|
+
toggle: Toggle
|
|
486
|
+
scroller: Scroller
|
|
487
|
+
slider: Slider
|
|
488
|
+
sliderint: SliderInt
|
|
489
|
+
minmaxslider: MinMaxSlider
|
|
490
|
+
enumfield: EnumField
|
|
491
|
+
progressbar: ProgressBar
|
|
492
|
+
|
|
493
|
+
textfield: TextField
|
|
494
|
+
integerfield: IntegerField
|
|
495
|
+
floatfield: FloatField
|
|
496
|
+
vector2field: Vector2Field
|
|
497
|
+
vector2intfield: Vector2IntField
|
|
498
|
+
vector3field: Vector3Field
|
|
499
|
+
vector3intfield: Vector3IntField
|
|
500
|
+
vector4field: Vector4Field
|
|
501
|
+
rectfield: RectField
|
|
502
|
+
rectintfield: RectIntField
|
|
503
|
+
boundsfield: BoundsField
|
|
504
|
+
boundsintfield: BoundsIntField
|
|
505
|
+
|
|
506
|
+
listview: ListView
|
|
507
|
+
scrollview: ScrollView
|
|
508
|
+
treeview: TreeView
|
|
509
|
+
popupwindow: PopupWindow
|
|
510
|
+
dropdownfield: DropdownField
|
|
511
|
+
|
|
512
|
+
// /* OneJS Custom */
|
|
513
|
+
// gradientrect: GradientRect
|
|
514
|
+
// flipbook: Flipbook
|
|
515
|
+
// simplelistview: SimpleListView
|
|
516
|
+
}
|
|
517
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare module "OneJS" {
|
|
2
|
+
export = CS.OneJS
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
declare module "OneJS/Utils" {
|
|
6
|
+
export = CS.OneJS.Utils
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module "OneJS/Dom" {
|
|
10
|
+
export = CS.OneJS.Dom
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare module "UnityEngine" {
|
|
14
|
+
export = CS.UnityEngine;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare module "UnityEngine/UIElements" {
|
|
18
|
+
export = CS.UnityEngine.UIElements;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare module "Unity/Mathematics" {
|
|
22
|
+
export = CS.Unity.Mathematics;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
import puerts = puer;
|
|
26
|
+
|
|
27
|
+
declare module "puerts" {
|
|
28
|
+
export = puerts;
|
|
29
|
+
}
|