@galacean/effects-plugin-gui 2.10.0-alpha.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/LICENSE +22 -0
- package/README.md +33 -0
- package/dist/components/gui-window-component.d.ts +15 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/ui-canvas.d.ts +28 -0
- package/dist/components/ui-control.d.ts +40 -0
- package/dist/controls/base-button.d.ts +85 -0
- package/dist/controls/button.d.ts +44 -0
- package/dist/controls/check-button.d.ts +10 -0
- package/dist/controls/checkbox.d.ts +12 -0
- package/dist/controls/color-picker.d.ts +59 -0
- package/dist/controls/color-rect.d.ts +11 -0
- package/dist/controls/enums.d.ts +68 -0
- package/dist/controls/index.d.ts +19 -0
- package/dist/controls/label.d.ts +46 -0
- package/dist/controls/line-edit.d.ts +28 -0
- package/dist/controls/menu-button.d.ts +39 -0
- package/dist/controls/nine-patch-rect.d.ts +35 -0
- package/dist/controls/panel.d.ts +9 -0
- package/dist/controls/popup-menu.d.ts +44 -0
- package/dist/controls/popup.d.ts +23 -0
- package/dist/controls/progress-bar.d.ts +19 -0
- package/dist/controls/slider.d.ts +63 -0
- package/dist/controls/text-edit.d.ts +21 -0
- package/dist/controls/text-input.d.ts +92 -0
- package/dist/controls/texture-rect.d.ts +30 -0
- package/dist/core/control.d.ts +379 -0
- package/dist/core/data.d.ts +88 -0
- package/dist/core/enums.d.ts +42 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/roots.d.ts +97 -0
- package/dist/core/theme.d.ts +186 -0
- package/dist/data.d.ts +147 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +10886 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +8 -0
- package/dist/index.min.js.map +1 -0
- package/dist/index.mjs +10858 -0
- package/dist/index.mjs.map +1 -0
- package/dist/layout/aspect-ratio-container.d.ts +26 -0
- package/dist/layout/box-container.d.ts +35 -0
- package/dist/layout/center-container.d.ts +15 -0
- package/dist/layout/enums.d.ts +15 -0
- package/dist/layout/grid-container.d.ts +19 -0
- package/dist/layout/margin-container.d.ts +10 -0
- package/dist/layout/panel-container.d.ts +10 -0
- package/dist/layout/separator.d.ts +19 -0
- package/dist/layout/utils.d.ts +10 -0
- package/dist/plugin/gui-plugin.d.ts +8 -0
- package/dist/plugin/index.d.ts +1 -0
- package/dist/scroll/enums.d.ts +8 -0
- package/dist/scroll/range.d.ts +56 -0
- package/dist/scroll/scroll-bar.d.ts +69 -0
- package/dist/scroll/scroll-container.d.ts +84 -0
- package/dist/theme/default-theme.d.ts +1 -0
- package/dist/theme/index.d.ts +2 -0
- package/package.json +36 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { FontStyle, FontWeight, spec } from '@galacean/effects';
|
|
2
|
+
export interface ThemeFontData {
|
|
3
|
+
family: string;
|
|
4
|
+
weight?: FontWeight;
|
|
5
|
+
style?: FontStyle;
|
|
6
|
+
}
|
|
7
|
+
export interface StyleBoxMarginsData {
|
|
8
|
+
left?: number;
|
|
9
|
+
top?: number;
|
|
10
|
+
right?: number;
|
|
11
|
+
bottom?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface StyleBoxEmptyData {
|
|
14
|
+
type: 'empty';
|
|
15
|
+
contentMargins?: StyleBoxMarginsData;
|
|
16
|
+
}
|
|
17
|
+
export interface StyleBoxFlatData {
|
|
18
|
+
type: 'flat';
|
|
19
|
+
backgroundColor?: spec.ColorData;
|
|
20
|
+
borderColor?: spec.ColorData;
|
|
21
|
+
borderWidths?: StyleBoxMarginsData;
|
|
22
|
+
cornerRadii?: StyleBoxMarginsData;
|
|
23
|
+
contentMargins?: StyleBoxMarginsData;
|
|
24
|
+
}
|
|
25
|
+
export interface StyleBoxTextureData {
|
|
26
|
+
type: 'texture';
|
|
27
|
+
texture: spec.DataPath | null;
|
|
28
|
+
sourceRect?: RectData;
|
|
29
|
+
patchMargins?: StyleBoxMarginsData;
|
|
30
|
+
contentMargins?: StyleBoxMarginsData;
|
|
31
|
+
horizontalAxisStretchMode?: number;
|
|
32
|
+
verticalAxisStretchMode?: number;
|
|
33
|
+
drawCenter?: boolean;
|
|
34
|
+
tint?: spec.ColorData;
|
|
35
|
+
}
|
|
36
|
+
export type StyleBoxData = StyleBoxEmptyData | StyleBoxFlatData | StyleBoxTextureData;
|
|
37
|
+
export interface ThemeItemCollectionData {
|
|
38
|
+
colors?: Record<string, spec.ColorData>;
|
|
39
|
+
constants?: Record<string, number>;
|
|
40
|
+
fonts?: Record<string, ThemeFontData>;
|
|
41
|
+
fontSizes?: Record<string, number>;
|
|
42
|
+
icons?: Record<string, spec.DataPath | null>;
|
|
43
|
+
styleBoxes?: Record<string, StyleBoxData>;
|
|
44
|
+
}
|
|
45
|
+
export interface ThemeData {
|
|
46
|
+
types: Record<string, ThemeItemCollectionData>;
|
|
47
|
+
variations?: Record<string, string>;
|
|
48
|
+
}
|
|
49
|
+
export interface ThemeOverridesData extends ThemeItemCollectionData {
|
|
50
|
+
}
|
|
51
|
+
/** Common serialized properties shared by every GUI Control. */
|
|
52
|
+
export interface ControlData {
|
|
53
|
+
anchorMin?: spec.vec2;
|
|
54
|
+
anchorMax?: spec.vec2;
|
|
55
|
+
offsetMin?: spec.vec2;
|
|
56
|
+
offsetMax?: spec.vec2;
|
|
57
|
+
pivot?: spec.vec2;
|
|
58
|
+
scale?: spec.vec2;
|
|
59
|
+
shear?: spec.vec2;
|
|
60
|
+
rotation?: number;
|
|
61
|
+
customMinimumSize?: spec.vec2;
|
|
62
|
+
customMaximumSize?: spec.vec2;
|
|
63
|
+
horizontalSizeFlags?: number;
|
|
64
|
+
verticalSizeFlags?: number;
|
|
65
|
+
stretchRatio?: number;
|
|
66
|
+
horizontalGrowDirection?: number;
|
|
67
|
+
verticalGrowDirection?: number;
|
|
68
|
+
mouseFilter?: number;
|
|
69
|
+
mouseBehaviorRecursive?: number;
|
|
70
|
+
mouseForcePassScrollEvents?: boolean;
|
|
71
|
+
focusMode?: number;
|
|
72
|
+
focusBehaviorRecursive?: number;
|
|
73
|
+
defaultCursorShape?: number | string;
|
|
74
|
+
clipContents?: boolean;
|
|
75
|
+
themeTypeVariation?: string;
|
|
76
|
+
themeOverrides?: ThemeOverridesData;
|
|
77
|
+
}
|
|
78
|
+
export interface SerializedControlData<T extends ControlData = ControlData> {
|
|
79
|
+
type: string;
|
|
80
|
+
data: T;
|
|
81
|
+
}
|
|
82
|
+
export interface UIControlData<T extends ControlData = ControlData> extends spec.ComponentData {
|
|
83
|
+
control: SerializedControlData<T>;
|
|
84
|
+
}
|
|
85
|
+
export interface RectData {
|
|
86
|
+
position: spec.vec2;
|
|
87
|
+
size: spec.vec2;
|
|
88
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare enum MouseFilter {
|
|
2
|
+
Stop = 0,
|
|
3
|
+
Pass = 1,
|
|
4
|
+
Ignore = 2
|
|
5
|
+
}
|
|
6
|
+
export declare enum MouseBehaviorRecursive {
|
|
7
|
+
Inherited = 0,
|
|
8
|
+
Disabled = 1,
|
|
9
|
+
Enabled = 2
|
|
10
|
+
}
|
|
11
|
+
export declare enum FocusMode {
|
|
12
|
+
None = 0,
|
|
13
|
+
Click = 1,
|
|
14
|
+
All = 2,
|
|
15
|
+
Accessibility = 3
|
|
16
|
+
}
|
|
17
|
+
export declare enum FocusBehaviorRecursive {
|
|
18
|
+
Inherited = 0,
|
|
19
|
+
Disabled = 1,
|
|
20
|
+
Enabled = 2
|
|
21
|
+
}
|
|
22
|
+
export declare enum CursorShape {
|
|
23
|
+
Arrow = 0,
|
|
24
|
+
Ibeam = 1,
|
|
25
|
+
PointingHand = 2,
|
|
26
|
+
Cross = 3,
|
|
27
|
+
Wait = 4,
|
|
28
|
+
Busy = 5,
|
|
29
|
+
Drag = 6,
|
|
30
|
+
CanDrop = 7,
|
|
31
|
+
Forbidden = 8,
|
|
32
|
+
Vsize = 9,
|
|
33
|
+
Hsize = 10,
|
|
34
|
+
Bdiagsize = 11,
|
|
35
|
+
Fdiagsize = 12,
|
|
36
|
+
Move = 13,
|
|
37
|
+
Vsplit = 14,
|
|
38
|
+
Hsplit = 15,
|
|
39
|
+
Help = 16
|
|
40
|
+
}
|
|
41
|
+
/** A preset cursor shape or a complete CSS cursor value. */
|
|
42
|
+
export type CursorStyle = CursorShape | string;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { UICanvas } from '../components/ui-canvas';
|
|
2
|
+
import { InputEvent, math } from '@galacean/effects';
|
|
3
|
+
import type { Engine } from '@galacean/effects';
|
|
4
|
+
import type { Container } from './control';
|
|
5
|
+
import { Control, RootControl } from './control';
|
|
6
|
+
type Vector2 = math.Vector2;
|
|
7
|
+
declare const Vector2: typeof math.Vector2;
|
|
8
|
+
/** CanvasLayer-like boundary for a single UICanvas GUI tree. */
|
|
9
|
+
export declare class CanvasRootControl extends Control {
|
|
10
|
+
readonly canvas: UICanvas;
|
|
11
|
+
constructor(engine: Engine, canvas: UICanvas);
|
|
12
|
+
get inputDisabled(): boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Global ordered collection of UICanvas roots. */
|
|
15
|
+
export declare class CanvasContainer extends Control {
|
|
16
|
+
constructor(engine: Engine);
|
|
17
|
+
sortCanvases(): void;
|
|
18
|
+
addChildInternal(child: Control): void;
|
|
19
|
+
protected drawChildren(): void;
|
|
20
|
+
}
|
|
21
|
+
/** Engine window GUI root. Routes events across all UICanvas roots. */
|
|
22
|
+
export declare class WindowRootControl extends RootControl {
|
|
23
|
+
readonly canvases: CanvasContainer;
|
|
24
|
+
private readonly popupLayer;
|
|
25
|
+
private readonly popupStack;
|
|
26
|
+
dragThreshold: number;
|
|
27
|
+
private lastInput;
|
|
28
|
+
private readonly dirtyContainers;
|
|
29
|
+
private readonly dirtyMeasurements;
|
|
30
|
+
private readonly gui;
|
|
31
|
+
constructor(engine: Engine);
|
|
32
|
+
pushInput(event: InputEvent): void;
|
|
33
|
+
isInputHandled(): boolean;
|
|
34
|
+
getMousePosition(): Vector2;
|
|
35
|
+
guiGetFocusOwner(): Control | null;
|
|
36
|
+
guiControlHasFocus(control: Control, visibleOnly?: boolean): boolean;
|
|
37
|
+
guiReleaseFocus(): void;
|
|
38
|
+
guiIsDragging(): boolean;
|
|
39
|
+
guiGetDragData(): unknown;
|
|
40
|
+
guiIsDragSuccessful(): boolean;
|
|
41
|
+
guiCancelDrag(): void;
|
|
42
|
+
grabControlFocus(control: Control, hideFocus?: boolean): void;
|
|
43
|
+
grabControlClickFocus(control: Control): void;
|
|
44
|
+
releaseControlFocus(control?: Control): void;
|
|
45
|
+
warpControlMouse(position: Vector2): void;
|
|
46
|
+
updateMouseCursorState(): void;
|
|
47
|
+
controlStateChanged(control: Control): void;
|
|
48
|
+
controlRemoved(control: Control): void;
|
|
49
|
+
controlTreeChanged(): void;
|
|
50
|
+
popupControl(control: Control, source: Control | null, position: Vector2): void;
|
|
51
|
+
closePopupControl(control: Control): void;
|
|
52
|
+
queueLayout(container: Container): void;
|
|
53
|
+
queueMeasurementChange(control: Control): void;
|
|
54
|
+
cancelPointerInput(): void;
|
|
55
|
+
onCanvasBlur(): void;
|
|
56
|
+
cancelPointerPress(control: Control, touchIndex: number): void;
|
|
57
|
+
resize(width: number, height: number): void;
|
|
58
|
+
render(): void;
|
|
59
|
+
update(deltaTime: number): void;
|
|
60
|
+
dispose(): void;
|
|
61
|
+
private flushLayout;
|
|
62
|
+
private getControlDepth;
|
|
63
|
+
private processGUIInput;
|
|
64
|
+
private processMouseButton;
|
|
65
|
+
private processMouseMotion;
|
|
66
|
+
private processScreenTouch;
|
|
67
|
+
private processScreenDrag;
|
|
68
|
+
private callGUIInput;
|
|
69
|
+
private callControlInput;
|
|
70
|
+
private findInputControl;
|
|
71
|
+
private findControlAtPosition;
|
|
72
|
+
private toControlLocal;
|
|
73
|
+
private updateMouseOver;
|
|
74
|
+
private updateMouseOverHierarchy;
|
|
75
|
+
private applyMouseOver;
|
|
76
|
+
private buildHoverHierarchy;
|
|
77
|
+
private findClickFocus;
|
|
78
|
+
private beginDragging;
|
|
79
|
+
private finishDrop;
|
|
80
|
+
private findDropTarget;
|
|
81
|
+
private endDragging;
|
|
82
|
+
private updateCursor;
|
|
83
|
+
private postGrabClickFocus;
|
|
84
|
+
private cleanupInternalState;
|
|
85
|
+
private dropMouseFocus;
|
|
86
|
+
private dropMouseOver;
|
|
87
|
+
private dropControlState;
|
|
88
|
+
private getGlobalInverse;
|
|
89
|
+
private toLocal;
|
|
90
|
+
private controlBelongsToSubtree;
|
|
91
|
+
private isControlValid;
|
|
92
|
+
private isControlUsable;
|
|
93
|
+
private findCanvasRoot;
|
|
94
|
+
private notifyFocusOwnerChanged;
|
|
95
|
+
private isFocusTargetUsable;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { math } from '@galacean/effects';
|
|
2
|
+
import type { Engine, EventEmitterListener, FontStyle, FontWeight, Graphics, Texture } from '@galacean/effects';
|
|
3
|
+
import type { StyleBoxData, ThemeData } from './data';
|
|
4
|
+
type Color = math.Color;
|
|
5
|
+
type Vector2 = math.Vector2;
|
|
6
|
+
declare const Color: typeof math.Color;
|
|
7
|
+
declare const Vector2: typeof math.Vector2;
|
|
8
|
+
export declare enum ThemeItemType {
|
|
9
|
+
Color = "color",
|
|
10
|
+
Constant = "constant",
|
|
11
|
+
Font = "font",
|
|
12
|
+
FontSize = "fontSize",
|
|
13
|
+
Icon = "icon",
|
|
14
|
+
StyleBox = "styleBox"
|
|
15
|
+
}
|
|
16
|
+
export interface ThemeFont {
|
|
17
|
+
family: string;
|
|
18
|
+
weight: FontWeight;
|
|
19
|
+
style: FontStyle;
|
|
20
|
+
}
|
|
21
|
+
export interface StyleBoxMargins {
|
|
22
|
+
left: number;
|
|
23
|
+
top: number;
|
|
24
|
+
right: number;
|
|
25
|
+
bottom: number;
|
|
26
|
+
}
|
|
27
|
+
export interface StyleBoxRect {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
}
|
|
33
|
+
export declare enum PatchStretchMode {
|
|
34
|
+
Stretch = 0,
|
|
35
|
+
Tile = 1,
|
|
36
|
+
TileFit = 2
|
|
37
|
+
}
|
|
38
|
+
export type ThemeValue = Color | number | ThemeFont | Texture | StyleBox | null;
|
|
39
|
+
export interface ThemeItemDefinition<T extends ThemeValue = ThemeValue> {
|
|
40
|
+
type: ThemeItemType;
|
|
41
|
+
defaultValue: T;
|
|
42
|
+
affectsLayout?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export type ThemeItemDefinitions = Record<string, ThemeItemDefinition>;
|
|
45
|
+
type StyleBoxEvent = {
|
|
46
|
+
changed: [styleBox: StyleBox];
|
|
47
|
+
};
|
|
48
|
+
type ThemeEvent = {
|
|
49
|
+
changed: [theme: Theme, affectsLayout: boolean];
|
|
50
|
+
};
|
|
51
|
+
export declare function cloneThemeValue<T extends ThemeValue>(value: T): T;
|
|
52
|
+
/** Drawable box resource used for rendering and content measurement. */
|
|
53
|
+
export declare abstract class StyleBox {
|
|
54
|
+
private readonly eventEmitter;
|
|
55
|
+
private contentMargins;
|
|
56
|
+
private readOnly;
|
|
57
|
+
on(eventName: 'changed', listener: EventEmitterListener<StyleBoxEvent['changed']>): void;
|
|
58
|
+
off(eventName: 'changed', listener: EventEmitterListener<StyleBoxEvent['changed']>): void;
|
|
59
|
+
getContentMargins(): StyleBoxMargins;
|
|
60
|
+
get isReadOnly(): boolean;
|
|
61
|
+
setContentMargins(left: number, top: number, right: number, bottom: number): void;
|
|
62
|
+
getMinimumSize(): Vector2;
|
|
63
|
+
abstract draw(graphics: Graphics, rect: StyleBoxRect): void;
|
|
64
|
+
protected notifyChanged(): void;
|
|
65
|
+
protected assertMutable(): void;
|
|
66
|
+
}
|
|
67
|
+
export declare class StyleBoxEmpty extends StyleBox {
|
|
68
|
+
static readonly shared: StyleBoxEmpty;
|
|
69
|
+
draw(): void;
|
|
70
|
+
}
|
|
71
|
+
export declare class StyleBoxFlat extends StyleBox {
|
|
72
|
+
private backgroundColor;
|
|
73
|
+
private borderColor;
|
|
74
|
+
private borderWidths;
|
|
75
|
+
private cornerRadii;
|
|
76
|
+
getBackgroundColor(): Color;
|
|
77
|
+
getBorderColor(): Color;
|
|
78
|
+
getBorderWidths(): StyleBoxMargins;
|
|
79
|
+
getCornerRadii(): StyleBoxMargins;
|
|
80
|
+
setBackgroundColor(value: Color): void;
|
|
81
|
+
setBorderColor(value: Color): void;
|
|
82
|
+
setBorderWidths(left: number, top: number, right: number, bottom: number): void;
|
|
83
|
+
setCornerRadii(topLeft: number, topRight: number, bottomRight: number, bottomLeft: number): void;
|
|
84
|
+
draw(graphics: Graphics, rect: StyleBoxRect): void;
|
|
85
|
+
private hasRoundedCorners;
|
|
86
|
+
private drawRounded;
|
|
87
|
+
}
|
|
88
|
+
export declare class StyleBoxTexture extends StyleBox {
|
|
89
|
+
private _texture;
|
|
90
|
+
private sourceRect;
|
|
91
|
+
private patchMargins;
|
|
92
|
+
private tint;
|
|
93
|
+
private _horizontalAxisStretchMode;
|
|
94
|
+
private _verticalAxisStretchMode;
|
|
95
|
+
private _drawCenter;
|
|
96
|
+
get texture(): Texture | null;
|
|
97
|
+
set texture(value: Texture | null);
|
|
98
|
+
get horizontalAxisStretchMode(): PatchStretchMode;
|
|
99
|
+
set horizontalAxisStretchMode(value: PatchStretchMode);
|
|
100
|
+
get verticalAxisStretchMode(): PatchStretchMode;
|
|
101
|
+
set verticalAxisStretchMode(value: PatchStretchMode);
|
|
102
|
+
get drawCenter(): boolean;
|
|
103
|
+
set drawCenter(value: boolean);
|
|
104
|
+
getSourceRect(): StyleBoxRect | null;
|
|
105
|
+
getPatchMargins(): StyleBoxMargins;
|
|
106
|
+
getTint(): Color;
|
|
107
|
+
setSourceRect(x: number, y: number, width: number, height: number): void;
|
|
108
|
+
clearSourceRect(): void;
|
|
109
|
+
setPatchMargins(left: number, top: number, right: number, bottom: number): void;
|
|
110
|
+
setTint(value: Color): void;
|
|
111
|
+
draw(graphics: Graphics, rect: StyleBoxRect): void;
|
|
112
|
+
}
|
|
113
|
+
/** Registry for stable control type inheritance and immutable native defaults. */
|
|
114
|
+
export declare class ThemeRegistry {
|
|
115
|
+
private static readonly types;
|
|
116
|
+
static registerType(type: string, baseType: string | null, definitions?: ThemeItemDefinitions): void;
|
|
117
|
+
static hasType(type: string): boolean;
|
|
118
|
+
static getTypeChain(type: string): string[];
|
|
119
|
+
static getDefault(type: string, itemType: ThemeItemType, name: string): ThemeValue | undefined;
|
|
120
|
+
static getItemDefinition(type: string, itemType: ThemeItemType, name: string): ThemeItemDefinition | undefined;
|
|
121
|
+
static affectsLayout(type: string, itemType: ThemeItemType, name: string): boolean;
|
|
122
|
+
static getItemDefinitions(type: string, includeInherited?: boolean): ThemeItemDefinitions;
|
|
123
|
+
}
|
|
124
|
+
export declare class Theme {
|
|
125
|
+
private readonly eventEmitter;
|
|
126
|
+
private readonly values;
|
|
127
|
+
private readonly variations;
|
|
128
|
+
private readonly styleBoxReferences;
|
|
129
|
+
private batchDepth;
|
|
130
|
+
private changePending;
|
|
131
|
+
private layoutChangePending;
|
|
132
|
+
private readonly styleBoxChanged;
|
|
133
|
+
on(eventName: 'changed', listener: EventEmitterListener<ThemeEvent['changed']>): void;
|
|
134
|
+
off(eventName: 'changed', listener: EventEmitterListener<ThemeEvent['changed']>): void;
|
|
135
|
+
batch<T>(callback: () => T): T;
|
|
136
|
+
setTypeVariation(variation: string, baseType: string): void;
|
|
137
|
+
clearTypeVariation(variation: string): void;
|
|
138
|
+
hasTypeVariation(variation: string): boolean;
|
|
139
|
+
getTypeVariationBase(variation: string): string | undefined;
|
|
140
|
+
getTypeDependencies(variation: string): string[];
|
|
141
|
+
setColor(type: string, name: string, value: Color): void;
|
|
142
|
+
getColor(type: string, name: string): Color | undefined;
|
|
143
|
+
hasColor(type: string, name: string): boolean;
|
|
144
|
+
clearColor(type: string, name: string): void;
|
|
145
|
+
setConstant(type: string, name: string, value: number): void;
|
|
146
|
+
getConstant(type: string, name: string): number | undefined;
|
|
147
|
+
hasConstant(type: string, name: string): boolean;
|
|
148
|
+
clearConstant(type: string, name: string): void;
|
|
149
|
+
setFont(type: string, name: string, value: ThemeFont): void;
|
|
150
|
+
getFont(type: string, name: string): ThemeFont | undefined;
|
|
151
|
+
hasFont(type: string, name: string): boolean;
|
|
152
|
+
clearFont(type: string, name: string): void;
|
|
153
|
+
setFontSize(type: string, name: string, value: number): void;
|
|
154
|
+
getFontSize(type: string, name: string): number | undefined;
|
|
155
|
+
hasFontSize(type: string, name: string): boolean;
|
|
156
|
+
clearFontSize(type: string, name: string): void;
|
|
157
|
+
setIcon(type: string, name: string, value: Texture | null): void;
|
|
158
|
+
getIcon(type: string, name: string): Texture | null | undefined;
|
|
159
|
+
hasIcon(type: string, name: string): boolean;
|
|
160
|
+
clearIcon(type: string, name: string): void;
|
|
161
|
+
setStyleBox(type: string, name: string, value: StyleBox): void;
|
|
162
|
+
getStyleBox(type: string, name: string): StyleBox | undefined;
|
|
163
|
+
hasStyleBox(type: string, name: string): boolean;
|
|
164
|
+
clearStyleBox(type: string, name: string): void;
|
|
165
|
+
hasItem(type: string, itemType: ThemeItemType, name: string): boolean;
|
|
166
|
+
getItem(type: string, itemType: ThemeItemType, name: string): ThemeValue | undefined;
|
|
167
|
+
clearItem(type: string, itemType: ThemeItemType, name: string): void;
|
|
168
|
+
clear(): void;
|
|
169
|
+
static fromData(engine: Engine, data: ThemeData): Theme;
|
|
170
|
+
private setCollectionFromData;
|
|
171
|
+
private setItem;
|
|
172
|
+
private retainStyleBox;
|
|
173
|
+
private releaseStyleBox;
|
|
174
|
+
private notifyChanged;
|
|
175
|
+
private affectsLayout;
|
|
176
|
+
}
|
|
177
|
+
export declare function styleBoxFromData(engine: Engine, data: StyleBoxData): StyleBox;
|
|
178
|
+
export declare const themeFallbacks: {
|
|
179
|
+
color: math.Color;
|
|
180
|
+
constant: number;
|
|
181
|
+
font: ThemeFont;
|
|
182
|
+
fontSize: number;
|
|
183
|
+
icon: Texture | null;
|
|
184
|
+
styleBox: StyleBoxEmpty;
|
|
185
|
+
};
|
|
186
|
+
export {};
|
package/dist/data.d.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { spec } from '@galacean/effects';
|
|
2
|
+
import type { ControlData, RectData } from './core/data';
|
|
3
|
+
import type { AspectRatioStretchMode, LayoutAlignment } from './layout/enums';
|
|
4
|
+
import type { ScrollMode } from './scroll/enums';
|
|
5
|
+
import type { AutowrapMode, AxisStretchMode, ButtonActionMode, HorizontalAlignment, ProgressFillMode, TextOverflow, TextureExpandMode, TextureStretchMode, VerticalAlignment } from './controls/enums';
|
|
6
|
+
export interface BoxContainerData extends ControlData {
|
|
7
|
+
alignment?: LayoutAlignment;
|
|
8
|
+
reverse?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface GridContainerData extends ControlData {
|
|
11
|
+
columns?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface MarginContainerData extends ControlData {
|
|
14
|
+
}
|
|
15
|
+
export interface CenterContainerData extends ControlData {
|
|
16
|
+
useTopLeft?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface AspectRatioContainerData extends ControlData {
|
|
19
|
+
ratio?: number;
|
|
20
|
+
stretchMode?: AspectRatioStretchMode;
|
|
21
|
+
horizontalAlignment?: LayoutAlignment;
|
|
22
|
+
verticalAlignment?: LayoutAlignment;
|
|
23
|
+
}
|
|
24
|
+
export interface RangeData extends ControlData {
|
|
25
|
+
minValue?: number;
|
|
26
|
+
maxValue?: number;
|
|
27
|
+
step?: number;
|
|
28
|
+
page?: number;
|
|
29
|
+
value?: number;
|
|
30
|
+
exponentialRatio?: boolean;
|
|
31
|
+
rounded?: boolean;
|
|
32
|
+
allowGreater?: boolean;
|
|
33
|
+
allowLesser?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface ScrollBarData extends RangeData {
|
|
36
|
+
customStep?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface ScrollContainerData extends ControlData {
|
|
39
|
+
hScroll?: number;
|
|
40
|
+
vScroll?: number;
|
|
41
|
+
horizontalScrollMode?: ScrollMode;
|
|
42
|
+
verticalScrollMode?: ScrollMode;
|
|
43
|
+
horizontalCustomStep?: number;
|
|
44
|
+
verticalCustomStep?: number;
|
|
45
|
+
scrollHorizontalByDefault?: boolean;
|
|
46
|
+
deadzone?: number;
|
|
47
|
+
followFocus?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface LabelData extends ControlData {
|
|
50
|
+
text?: string;
|
|
51
|
+
horizontalAlignment?: HorizontalAlignment;
|
|
52
|
+
verticalAlignment?: VerticalAlignment;
|
|
53
|
+
autowrapMode?: AutowrapMode;
|
|
54
|
+
textOverflow?: TextOverflow;
|
|
55
|
+
}
|
|
56
|
+
export interface TextureRectData extends ControlData {
|
|
57
|
+
texture?: spec.DataPath | null;
|
|
58
|
+
expandMode?: TextureExpandMode;
|
|
59
|
+
stretchMode?: TextureStretchMode;
|
|
60
|
+
flipH?: boolean;
|
|
61
|
+
flipV?: boolean;
|
|
62
|
+
tint?: spec.ColorData;
|
|
63
|
+
}
|
|
64
|
+
export interface NinePatchRectData extends ControlData {
|
|
65
|
+
texture?: spec.DataPath | null;
|
|
66
|
+
regionRect?: RectData;
|
|
67
|
+
patchMarginLeft?: number;
|
|
68
|
+
patchMarginTop?: number;
|
|
69
|
+
patchMarginRight?: number;
|
|
70
|
+
patchMarginBottom?: number;
|
|
71
|
+
drawCenter?: boolean;
|
|
72
|
+
horizontalAxisStretchMode?: AxisStretchMode;
|
|
73
|
+
verticalAxisStretchMode?: AxisStretchMode;
|
|
74
|
+
tint?: spec.ColorData;
|
|
75
|
+
}
|
|
76
|
+
export interface ColorRectData extends ControlData {
|
|
77
|
+
color?: spec.ColorData;
|
|
78
|
+
}
|
|
79
|
+
export interface PanelData extends ControlData {
|
|
80
|
+
}
|
|
81
|
+
export interface BaseButtonData extends ControlData {
|
|
82
|
+
disabled?: boolean;
|
|
83
|
+
toggleMode?: boolean;
|
|
84
|
+
buttonPressed?: boolean;
|
|
85
|
+
buttonMask?: number;
|
|
86
|
+
actionMode?: ButtonActionMode;
|
|
87
|
+
keepPressedOutside?: boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface ButtonData extends BaseButtonData {
|
|
90
|
+
text?: string;
|
|
91
|
+
icon?: spec.DataPath | null;
|
|
92
|
+
flat?: boolean;
|
|
93
|
+
clipText?: boolean;
|
|
94
|
+
expandIcon?: boolean;
|
|
95
|
+
textAlignment?: HorizontalAlignment;
|
|
96
|
+
iconAlignment?: HorizontalAlignment;
|
|
97
|
+
iconVerticalAlignment?: VerticalAlignment;
|
|
98
|
+
}
|
|
99
|
+
export interface CheckboxData extends ButtonData {
|
|
100
|
+
}
|
|
101
|
+
export interface CheckButtonData extends ButtonData {
|
|
102
|
+
}
|
|
103
|
+
export interface SliderData extends RangeData {
|
|
104
|
+
editable?: boolean;
|
|
105
|
+
scrollable?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export interface ProgressBarData extends RangeData {
|
|
108
|
+
showPercentage?: boolean;
|
|
109
|
+
fillMode?: ProgressFillMode;
|
|
110
|
+
}
|
|
111
|
+
export interface TextInputData extends ControlData {
|
|
112
|
+
text?: string;
|
|
113
|
+
placeholderText?: string;
|
|
114
|
+
editable?: boolean;
|
|
115
|
+
maxLength?: number;
|
|
116
|
+
}
|
|
117
|
+
export interface LineEditData extends TextInputData {
|
|
118
|
+
secret?: boolean;
|
|
119
|
+
secretCharacter?: string;
|
|
120
|
+
alignment?: HorizontalAlignment;
|
|
121
|
+
}
|
|
122
|
+
export interface TextEditData extends TextInputData {
|
|
123
|
+
}
|
|
124
|
+
export interface PopupMenuItemData {
|
|
125
|
+
id: number | string;
|
|
126
|
+
text: string;
|
|
127
|
+
disabled?: boolean;
|
|
128
|
+
separator?: boolean;
|
|
129
|
+
checked?: boolean;
|
|
130
|
+
}
|
|
131
|
+
export interface PopupMenuData extends ControlData {
|
|
132
|
+
items?: PopupMenuItemData[];
|
|
133
|
+
}
|
|
134
|
+
export interface MenuButtonData extends ButtonData {
|
|
135
|
+
items?: PopupMenuItemData[];
|
|
136
|
+
}
|
|
137
|
+
export interface OptionButtonData extends MenuButtonData {
|
|
138
|
+
selected?: number;
|
|
139
|
+
}
|
|
140
|
+
export interface ColorPickerData extends ControlData {
|
|
141
|
+
color?: spec.ColorData;
|
|
142
|
+
editAlpha?: boolean;
|
|
143
|
+
}
|
|
144
|
+
export interface ColorPickerButtonData extends ButtonData {
|
|
145
|
+
color?: spec.ColorData;
|
|
146
|
+
editAlpha?: boolean;
|
|
147
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './core';
|
|
2
|
+
export * from './components';
|
|
3
|
+
export * from './data';
|
|
4
|
+
export * from './layout/enums';
|
|
5
|
+
export * from './layout/box-container';
|
|
6
|
+
export * from './layout/grid-container';
|
|
7
|
+
export * from './layout/margin-container';
|
|
8
|
+
export * from './layout/center-container';
|
|
9
|
+
export * from './layout/aspect-ratio-container';
|
|
10
|
+
export * from './layout/panel-container';
|
|
11
|
+
export * from './layout/separator';
|
|
12
|
+
export * from './scroll/enums';
|
|
13
|
+
export * from './scroll/range';
|
|
14
|
+
export * from './scroll/scroll-bar';
|
|
15
|
+
export * from './scroll/scroll-container';
|
|
16
|
+
export * from './theme';
|
|
17
|
+
export * from './controls';
|
|
18
|
+
export * from './plugin';
|
|
19
|
+
/** GUI plugin package version. Importing this package registers the GUI runtime and native fallback theme. */
|
|
20
|
+
export declare const version: string;
|