@momoyu-ink/kit 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -259,6 +259,8 @@ Sandbox 为剧本表达式提供受控求值环境:
259
259
  | 组件 | 用途 | 关键 Props |
260
260
  | ------------- | -------- | -------------------------------------------- |
261
261
  | `<container>` | 容器 | 基础变换属性 |
262
+ | `<vbox>` | 纵向布局 | `width`, `height`, `gap`, `padding`, `justifyContent`, `alignItems` |
263
+ | `<hbox>` | 横向布局 | `width`, `height`, `gap`, `padding`, `justifyContent`, `alignItems` |
262
264
  | `<sprite>` | 图片精灵 | `src`, `area`, `mode`, `bounds` |
263
265
  | `<text>` | 文本 | `text`, `fontSize`, `fillColor`, `printMode`, `onFinish`, `onProgress` |
264
266
  | `<clip>` | 裁剪 | 区域尺寸 |
@@ -277,7 +279,7 @@ Sandbox 为剧本表达式提供受控求值环境:
277
279
  type NodeProps = {
278
280
  label?: string;
279
281
  anchor?: [number, number]; // 0.0-1.0
280
- pivot?: [number, number]; // pixels
282
+ pivot?: [number, number]; // 0.0-1.0
281
283
  x?: number; y?: number;
282
284
  scale?: number; scaleX?: number; scaleY?: number;
283
285
  rotation?: number;
@@ -332,72 +332,6 @@ type TextCommand = {
332
332
  subCommand: 'getCursorPosition';
333
333
  };
334
334
 
335
- declare function getStageSize(): {
336
- width: number;
337
- height: number;
338
- scaleFactor: number;
339
- };
340
- type MakeNullOptional<T> = T extends any ? {
341
- [K in keyof T as null extends T[K] ? never : K]: T[K];
342
- } & {
343
- [K in keyof T as null extends T[K] ? K : never]?: T[K];
344
- } : never;
345
-
346
- type ShaderDirection = 'left' | 'right' | 'up' | 'down';
347
-
348
- type ShaderParamType = 'float' | 'int';
349
-
350
- type ShaderParam = {
351
- name: string;
352
- type: ShaderParamType;
353
- value: number;
354
- };
355
-
356
- type ShaderSource = ({
357
- type: 'builtin';
358
- } & ({
359
- name: 'crossfade';
360
- } | {
361
- name: 'wipe';
362
- softness: number;
363
- direction: ShaderDirection;
364
- } | {
365
- name: 'fade';
366
- out: number;
367
- hold: number;
368
- in: number;
369
- color: string;
370
- } | {
371
- name: 'push';
372
- direction: ShaderDirection;
373
- } | {
374
- name: 'slideaway';
375
- direction: ShaderDirection;
376
- } | {
377
- name: 'zoom';
378
- startScale: number;
379
- endScale: number;
380
- origin: [number, number];
381
- } | {
382
- name: 'pixellate';
383
- steps: number;
384
- } | {
385
- name: 'mask';
386
- rule: string;
387
- softness: number;
388
- reverse: boolean;
389
- })) | {
390
- type: 'raw';
391
- content: string;
392
- params?: Array<ShaderParam>;
393
- };
394
-
395
- type ShaderTimeControl = 'auto' | 'manual' | 'transition';
396
-
397
- type _Command = AudioCommand | TextCommand | GamepadCommand | ScenarioCommand | ShaderCommand | SystemCommand;
398
- type Command = MakeNullOptional<_Command>;
399
- type MaybePromise = any;
400
-
401
335
  interface MoyuEvent<T extends Record<string, unknown> = Record<string, unknown>> {
402
336
  name: string;
403
337
  body: T;
@@ -415,6 +349,54 @@ declare function createBubbleEvent<T extends BubbleEvent>(body: Record<string, a
415
349
  bubbleTargetIds: number[];
416
350
  }, targetId: number): T;
417
351
 
352
+ declare class Node {
353
+ nodeId: number;
354
+ label?: string;
355
+ props: Record<string, any>;
356
+ listeners: Record<string, (evt?: BubbleEvent | Record<string, any>) => any>;
357
+ static create(label: string, type: string, props: Record<string, any>): Node;
358
+ static rootNode(): Node;
359
+ addChild(child: Node): void;
360
+ insertChild(_index: number, child: Node): void;
361
+ insertChildBefore(beforeChild: Node, child: Node): void;
362
+ removeChild(child: Node): void;
363
+ updateProps(props: Record<string, any>): void;
364
+ executeCommand(payload: Command): any;
365
+ }
366
+
367
+ type MouseEventKind = 'MouseEnter' | 'MouseLeave' | 'MouseDown' | 'MouseUp' | 'MouseMove' | 'Click' | 'DoubleClick' | 'ContextMenu';
368
+
369
+ interface MouseEvent extends BubbleEvent {
370
+ kind: MouseEventKind;
371
+ targetId: number;
372
+ currentTargetId: number;
373
+ targetLabel?: string;
374
+ currentTargetLabel?: string;
375
+ clientX: number;
376
+ clientY: number;
377
+ screenX: number;
378
+ screenY: number;
379
+ offsetX: number;
380
+ offsetY: number;
381
+ }
382
+
383
+ type TouchEventKind = 'TouchStart' | 'TouchMove' | 'TouchEnd' | 'TouchCancel';
384
+
385
+ interface TouchEvent extends BubbleEvent {
386
+ kind: TouchEventKind;
387
+ targetId: number;
388
+ currentTargetId: number;
389
+ targetLabel: string;
390
+ currentTargetLabel: string;
391
+ clientX: number;
392
+ clientY: number;
393
+ screenX: number;
394
+ screenY: number;
395
+ offsetX: number;
396
+ offsetY: number;
397
+ identifier: number;
398
+ }
399
+
418
400
  type KeyboardEventKind = 'KeyDown' | 'KeyUp' | 'KeyPress';
419
401
 
420
402
  /**
@@ -453,52 +435,19 @@ interface KeyboardEvent extends BubbleEvent {
453
435
  readonly DOM_KEY_LOCATION_NUMPAD: 0x03;
454
436
  }
455
437
 
456
- type MouseEventKind = 'MouseEnter' | 'MouseLeave' | 'MouseDown' | 'MouseUp' | 'MouseMove' | 'Click' | 'DoubleClick' | 'ContextMenu';
457
-
458
- interface MouseEvent extends BubbleEvent {
459
- kind: MouseEventKind;
460
- targetId: number;
461
- currentTargetId: number;
462
- targetLabel?: string;
463
- currentTargetLabel?: string;
464
- clientX: number;
465
- clientY: number;
466
- screenX: number;
467
- screenY: number;
468
- offsetX: number;
469
- offsetY: number;
470
- }
471
-
472
- type TouchEventKind = 'TouchStart' | 'TouchMove' | 'TouchEnd' | 'TouchCancel';
438
+ type LayoutEvent = {
439
+ width: number;
440
+ height: number;
441
+ };
473
442
 
474
- interface TouchEvent extends BubbleEvent {
475
- kind: TouchEventKind;
476
- targetId: number;
477
- currentTargetId: number;
478
- targetLabel: string;
479
- currentTargetLabel: string;
480
- clientX: number;
481
- clientY: number;
482
- screenX: number;
483
- screenY: number;
484
- offsetX: number;
485
- offsetY: number;
486
- identifier: number;
487
- }
443
+ type WheelEventDeltaMode = 'pixel' | 'line' | 'page';
488
444
 
489
- declare class Node {
490
- nodeId: number;
491
- label?: string;
492
- props: Record<string, any>;
493
- listeners: Record<string, (evt?: BubbleEvent | Record<string, any>) => any>;
494
- static create(label: string, type: string, props: Record<string, any>): Node;
495
- static rootNode(): Node;
496
- addChild(child: Node): void;
497
- insertChild(_index: number, child: Node): void;
498
- insertChildBefore(beforeChild: Node, child: Node): void;
499
- removeChild(child: Node): void;
500
- updateProps(props: Record<string, any>): void;
501
- executeCommand(payload: Command): any;
445
+ interface WheelEvent extends Omit<MouseEvent, 'kind'> {
446
+ kind: 'Wheel';
447
+ deltaX: number;
448
+ deltaY: number;
449
+ deltaZ: number;
450
+ deltaMode: WheelEventDeltaMode;
502
451
  }
503
452
 
504
453
  type MoyuCursor = 'hidden' | 'default' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out' | 'dnd-ask' | 'all-resize';
@@ -521,6 +470,33 @@ type NodeProps = {
521
470
  opacity?: number;
522
471
  interactive?: boolean;
523
472
  cursor?: MoyuCursor;
473
+ zIndex?: number;
474
+ };
475
+
476
+ type AlignItems = 'start' | 'center' | 'end';
477
+
478
+ type JustifyContent = 'start' | 'center' | 'end' | 'space-between';
479
+
480
+ type VBoxProps = {
481
+ width?: number;
482
+ height?: number;
483
+ gap?: number;
484
+ padding?: number;
485
+ paddingX?: number;
486
+ paddingY?: number;
487
+ justifyContent?: JustifyContent;
488
+ alignItems?: AlignItems;
489
+ };
490
+
491
+ type HBoxProps = {
492
+ width?: number;
493
+ height?: number;
494
+ gap?: number;
495
+ padding?: number;
496
+ paddingX?: number;
497
+ paddingY?: number;
498
+ justifyContent?: JustifyContent;
499
+ alignItems?: AlignItems;
524
500
  };
525
501
 
526
502
  type ClipProps = {
@@ -633,7 +609,60 @@ type TextProps = {
633
609
  shadowWidth?: number;
634
610
  };
635
611
 
612
+ type ShaderDirection = 'left' | 'right' | 'up' | 'down';
613
+
614
+ type ShaderParamType = 'float' | 'int';
615
+
616
+ type ShaderParam = {
617
+ name: string;
618
+ type: ShaderParamType;
619
+ value: number;
620
+ };
621
+
622
+ type ShaderSource = ({
623
+ type: 'builtin';
624
+ } & ({
625
+ name: 'crossfade';
626
+ } | {
627
+ name: 'wipe';
628
+ softness: number;
629
+ direction: ShaderDirection;
630
+ } | {
631
+ name: 'fade';
632
+ out: number;
633
+ hold: number;
634
+ in: number;
635
+ color: string;
636
+ } | {
637
+ name: 'push';
638
+ direction: ShaderDirection;
639
+ } | {
640
+ name: 'slideaway';
641
+ direction: ShaderDirection;
642
+ } | {
643
+ name: 'zoom';
644
+ startScale: number;
645
+ endScale: number;
646
+ origin: [number, number];
647
+ } | {
648
+ name: 'pixellate';
649
+ steps: number;
650
+ } | {
651
+ name: 'mask';
652
+ rule: string;
653
+ softness: number;
654
+ reverse: boolean;
655
+ })) | {
656
+ type: 'raw';
657
+ content: string;
658
+ params?: Array<ShaderParam>;
659
+ };
660
+
661
+ type ShaderTimeControl = 'auto' | 'manual' | 'transition';
662
+
636
663
  type ShaderProps = {
664
+ width?: number;
665
+ height?: number;
637
666
  shader?: ShaderSource;
638
667
  timeControl?: ShaderTimeControl;
639
668
  displayChannel?: number | null;
@@ -681,6 +710,7 @@ interface MoyuListenerAttributes {
681
710
  onKeyDown?: MoyuEventHandler<KeyboardEvent>;
682
711
  onKeyUp?: MoyuEventHandler<KeyboardEvent>;
683
712
  onKeyPress?: MoyuEventHandler<KeyboardEvent>;
713
+ onWheel?: MoyuEventHandler<WheelEvent>;
684
714
  onTouchStart?: MoyuEventHandler<TouchEvent>;
685
715
  onTouchMove?: MoyuEventHandler<TouchEvent>;
686
716
  onTouchEnd?: MoyuEventHandler<TouchEvent>;
@@ -690,6 +720,12 @@ type MoyuNodeAttributes = MoyuListenerAttributes & NodeProps & {
690
720
  children?: ReactNode;
691
721
  };
692
722
  type MoyuContainerAttributes = MoyuNodeAttributes;
723
+ type MoyuVBoxAttributes = VBoxProps & MoyuNodeAttributes & {
724
+ onLayout?: (event: LayoutEvent) => void;
725
+ };
726
+ type MoyuHBoxAttributes = HBoxProps & MoyuNodeAttributes & {
727
+ onLayout?: (event: LayoutEvent) => void;
728
+ };
693
729
  type MoyuClipAttributes = ClipProps & MoyuNodeAttributes;
694
730
  type MoyuFilterAttributes = FilterProps & MoyuNodeAttributes;
695
731
  type MoyuBackdropAttributes = BackdropProps & MoyuNodeAttributes;
@@ -728,6 +764,8 @@ declare namespace JSX {
728
764
  }
729
765
  interface IntrinsicElements {
730
766
  container: DetailedMoyuProps<MoyuContainerAttributes>;
767
+ vbox: DetailedMoyuProps<MoyuVBoxAttributes>;
768
+ hbox: DetailedMoyuProps<MoyuHBoxAttributes>;
731
769
  sprite: DetailedMoyuProps<MoyuSpriteAttributes>;
732
770
  text: DetailedMoyuProps<MoyuTextAttributes>;
733
771
  clip: DetailedMoyuProps<MoyuClipAttributes>;
@@ -740,4 +778,20 @@ declare namespace JSX {
740
778
  }
741
779
  }
742
780
 
743
- export { type AudioCommand as A, type BubbleEvent as B, type Command as C, type DetailedMoyuProps as D, type EffectParams as E, type SystemCommand as F, type GamepadCommand as G, type TouchEvent as H, type TouchEventKind as I, JSX as J, type KeyboardEvent as K, type Tuple2 as L, type MouseEvent as M, Node as N, type Tuple3 as O, type Tuple4 as P, createBubbleEvent as Q, type RetainMode as R, type ShaderDirection as S, type TextCommand as T, getStageSize as U, type WindowState as W, type MoyuEvent as a, type MaybePromise as b, type JsonValue as c, type AudioSettings as d, type KeyboardEventKind as e, type MakeNullOptional as f, type MouseEventKind as g, type MoyuAnimationAttributes as h, type MoyuBackdropAttributes as i, type MoyuClipAttributes as j, type MoyuContainerAttributes as k, type MoyuEventHandler as l, type MoyuFilterAttributes as m, type MoyuListenerAttributes as n, type MoyuNodeAttributes as o, type MoyuShaderAttributes as p, type MoyuShaderSlotAttributes as q, type MoyuSpriteAttributes as r, type MoyuTextAttributes as s, type MoyuVideoAttributes as t, type ScenarioCommand as u, type ShaderCommand as v, type ShaderParam as w, type ShaderParamType as x, type ShaderSource as y, type ShaderTimeControl as z };
781
+ declare function getStageSize(): {
782
+ width: number;
783
+ height: number;
784
+ scaleFactor: number;
785
+ };
786
+ type MakeNullOptional<T> = T extends unknown ? {
787
+ [K in keyof T as null extends T[K] ? never : K]: T[K];
788
+ } & {
789
+ [K in keyof T as null extends T[K] ? K : never]?: T[K];
790
+ } : never;
791
+ declare function mergeEvent<T extends BubbleEvent, K extends BubbleEvent>(handlers: MoyuEventHandler<T> | readonly MoyuEventHandler<T>[] | undefined, defaultHandler?: MoyuEventHandler<K>): (event: T | K) => void;
792
+
793
+ type _Command = AudioCommand | TextCommand | GamepadCommand | ScenarioCommand | ShaderCommand | SystemCommand;
794
+ type Command = MakeNullOptional<_Command>;
795
+ type MaybePromise = any;
796
+
797
+ export { createBubbleEvent as $, type AudioCommand as A, type BubbleEvent as B, type Command as C, type DetailedMoyuProps as D, type EffectParams as E, type ShaderParam as F, type GamepadCommand as G, type ShaderParamType as H, type ShaderSource as I, JSX as J, type KeyboardEvent as K, type LayoutEvent as L, type MoyuEvent as M, Node as N, type ShaderTimeControl as O, type SystemCommand as P, type TextCommand as Q, type RetainMode as R, type ShaderDirection as S, type TouchEvent as T, type TouchEventKind as U, type Tuple2 as V, type WheelEvent as W, type Tuple3 as X, type Tuple4 as Y, type WheelEventDeltaMode as Z, type WindowState as _, type MaybePromise as a, getStageSize as a0, mergeEvent as a1, type MoyuClipAttributes as b, type MoyuVBoxAttributes as c, type MoyuSpriteAttributes as d, type TextProps as e, type MoyuNodeAttributes as f, type MouseEvent as g, type SpriteProps as h, type JsonValue as i, type AudioSettings as j, type KeyboardEventKind as k, type MakeNullOptional as l, type MouseEventKind as m, type MoyuAnimationAttributes as n, type MoyuBackdropAttributes as o, type MoyuContainerAttributes as p, type MoyuEventHandler as q, type MoyuFilterAttributes as r, type MoyuHBoxAttributes as s, type MoyuListenerAttributes as t, type MoyuShaderAttributes as u, type MoyuShaderSlotAttributes as v, type MoyuTextAttributes as w, type MoyuVideoAttributes as x, type ScenarioCommand as y, type ShaderCommand as z };
@@ -332,72 +332,6 @@ type TextCommand = {
332
332
  subCommand: 'getCursorPosition';
333
333
  };
334
334
 
335
- declare function getStageSize(): {
336
- width: number;
337
- height: number;
338
- scaleFactor: number;
339
- };
340
- type MakeNullOptional<T> = T extends any ? {
341
- [K in keyof T as null extends T[K] ? never : K]: T[K];
342
- } & {
343
- [K in keyof T as null extends T[K] ? K : never]?: T[K];
344
- } : never;
345
-
346
- type ShaderDirection = 'left' | 'right' | 'up' | 'down';
347
-
348
- type ShaderParamType = 'float' | 'int';
349
-
350
- type ShaderParam = {
351
- name: string;
352
- type: ShaderParamType;
353
- value: number;
354
- };
355
-
356
- type ShaderSource = ({
357
- type: 'builtin';
358
- } & ({
359
- name: 'crossfade';
360
- } | {
361
- name: 'wipe';
362
- softness: number;
363
- direction: ShaderDirection;
364
- } | {
365
- name: 'fade';
366
- out: number;
367
- hold: number;
368
- in: number;
369
- color: string;
370
- } | {
371
- name: 'push';
372
- direction: ShaderDirection;
373
- } | {
374
- name: 'slideaway';
375
- direction: ShaderDirection;
376
- } | {
377
- name: 'zoom';
378
- startScale: number;
379
- endScale: number;
380
- origin: [number, number];
381
- } | {
382
- name: 'pixellate';
383
- steps: number;
384
- } | {
385
- name: 'mask';
386
- rule: string;
387
- softness: number;
388
- reverse: boolean;
389
- })) | {
390
- type: 'raw';
391
- content: string;
392
- params?: Array<ShaderParam>;
393
- };
394
-
395
- type ShaderTimeControl = 'auto' | 'manual' | 'transition';
396
-
397
- type _Command = AudioCommand | TextCommand | GamepadCommand | ScenarioCommand | ShaderCommand | SystemCommand;
398
- type Command = MakeNullOptional<_Command>;
399
- type MaybePromise = any;
400
-
401
335
  interface MoyuEvent<T extends Record<string, unknown> = Record<string, unknown>> {
402
336
  name: string;
403
337
  body: T;
@@ -415,6 +349,54 @@ declare function createBubbleEvent<T extends BubbleEvent>(body: Record<string, a
415
349
  bubbleTargetIds: number[];
416
350
  }, targetId: number): T;
417
351
 
352
+ declare class Node {
353
+ nodeId: number;
354
+ label?: string;
355
+ props: Record<string, any>;
356
+ listeners: Record<string, (evt?: BubbleEvent | Record<string, any>) => any>;
357
+ static create(label: string, type: string, props: Record<string, any>): Node;
358
+ static rootNode(): Node;
359
+ addChild(child: Node): void;
360
+ insertChild(_index: number, child: Node): void;
361
+ insertChildBefore(beforeChild: Node, child: Node): void;
362
+ removeChild(child: Node): void;
363
+ updateProps(props: Record<string, any>): void;
364
+ executeCommand(payload: Command): any;
365
+ }
366
+
367
+ type MouseEventKind = 'MouseEnter' | 'MouseLeave' | 'MouseDown' | 'MouseUp' | 'MouseMove' | 'Click' | 'DoubleClick' | 'ContextMenu';
368
+
369
+ interface MouseEvent extends BubbleEvent {
370
+ kind: MouseEventKind;
371
+ targetId: number;
372
+ currentTargetId: number;
373
+ targetLabel?: string;
374
+ currentTargetLabel?: string;
375
+ clientX: number;
376
+ clientY: number;
377
+ screenX: number;
378
+ screenY: number;
379
+ offsetX: number;
380
+ offsetY: number;
381
+ }
382
+
383
+ type TouchEventKind = 'TouchStart' | 'TouchMove' | 'TouchEnd' | 'TouchCancel';
384
+
385
+ interface TouchEvent extends BubbleEvent {
386
+ kind: TouchEventKind;
387
+ targetId: number;
388
+ currentTargetId: number;
389
+ targetLabel: string;
390
+ currentTargetLabel: string;
391
+ clientX: number;
392
+ clientY: number;
393
+ screenX: number;
394
+ screenY: number;
395
+ offsetX: number;
396
+ offsetY: number;
397
+ identifier: number;
398
+ }
399
+
418
400
  type KeyboardEventKind = 'KeyDown' | 'KeyUp' | 'KeyPress';
419
401
 
420
402
  /**
@@ -453,52 +435,19 @@ interface KeyboardEvent extends BubbleEvent {
453
435
  readonly DOM_KEY_LOCATION_NUMPAD: 0x03;
454
436
  }
455
437
 
456
- type MouseEventKind = 'MouseEnter' | 'MouseLeave' | 'MouseDown' | 'MouseUp' | 'MouseMove' | 'Click' | 'DoubleClick' | 'ContextMenu';
457
-
458
- interface MouseEvent extends BubbleEvent {
459
- kind: MouseEventKind;
460
- targetId: number;
461
- currentTargetId: number;
462
- targetLabel?: string;
463
- currentTargetLabel?: string;
464
- clientX: number;
465
- clientY: number;
466
- screenX: number;
467
- screenY: number;
468
- offsetX: number;
469
- offsetY: number;
470
- }
471
-
472
- type TouchEventKind = 'TouchStart' | 'TouchMove' | 'TouchEnd' | 'TouchCancel';
438
+ type LayoutEvent = {
439
+ width: number;
440
+ height: number;
441
+ };
473
442
 
474
- interface TouchEvent extends BubbleEvent {
475
- kind: TouchEventKind;
476
- targetId: number;
477
- currentTargetId: number;
478
- targetLabel: string;
479
- currentTargetLabel: string;
480
- clientX: number;
481
- clientY: number;
482
- screenX: number;
483
- screenY: number;
484
- offsetX: number;
485
- offsetY: number;
486
- identifier: number;
487
- }
443
+ type WheelEventDeltaMode = 'pixel' | 'line' | 'page';
488
444
 
489
- declare class Node {
490
- nodeId: number;
491
- label?: string;
492
- props: Record<string, any>;
493
- listeners: Record<string, (evt?: BubbleEvent | Record<string, any>) => any>;
494
- static create(label: string, type: string, props: Record<string, any>): Node;
495
- static rootNode(): Node;
496
- addChild(child: Node): void;
497
- insertChild(_index: number, child: Node): void;
498
- insertChildBefore(beforeChild: Node, child: Node): void;
499
- removeChild(child: Node): void;
500
- updateProps(props: Record<string, any>): void;
501
- executeCommand(payload: Command): any;
445
+ interface WheelEvent extends Omit<MouseEvent, 'kind'> {
446
+ kind: 'Wheel';
447
+ deltaX: number;
448
+ deltaY: number;
449
+ deltaZ: number;
450
+ deltaMode: WheelEventDeltaMode;
502
451
  }
503
452
 
504
453
  type MoyuCursor = 'hidden' | 'default' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out' | 'dnd-ask' | 'all-resize';
@@ -521,6 +470,33 @@ type NodeProps = {
521
470
  opacity?: number;
522
471
  interactive?: boolean;
523
472
  cursor?: MoyuCursor;
473
+ zIndex?: number;
474
+ };
475
+
476
+ type AlignItems = 'start' | 'center' | 'end';
477
+
478
+ type JustifyContent = 'start' | 'center' | 'end' | 'space-between';
479
+
480
+ type VBoxProps = {
481
+ width?: number;
482
+ height?: number;
483
+ gap?: number;
484
+ padding?: number;
485
+ paddingX?: number;
486
+ paddingY?: number;
487
+ justifyContent?: JustifyContent;
488
+ alignItems?: AlignItems;
489
+ };
490
+
491
+ type HBoxProps = {
492
+ width?: number;
493
+ height?: number;
494
+ gap?: number;
495
+ padding?: number;
496
+ paddingX?: number;
497
+ paddingY?: number;
498
+ justifyContent?: JustifyContent;
499
+ alignItems?: AlignItems;
524
500
  };
525
501
 
526
502
  type ClipProps = {
@@ -633,7 +609,60 @@ type TextProps = {
633
609
  shadowWidth?: number;
634
610
  };
635
611
 
612
+ type ShaderDirection = 'left' | 'right' | 'up' | 'down';
613
+
614
+ type ShaderParamType = 'float' | 'int';
615
+
616
+ type ShaderParam = {
617
+ name: string;
618
+ type: ShaderParamType;
619
+ value: number;
620
+ };
621
+
622
+ type ShaderSource = ({
623
+ type: 'builtin';
624
+ } & ({
625
+ name: 'crossfade';
626
+ } | {
627
+ name: 'wipe';
628
+ softness: number;
629
+ direction: ShaderDirection;
630
+ } | {
631
+ name: 'fade';
632
+ out: number;
633
+ hold: number;
634
+ in: number;
635
+ color: string;
636
+ } | {
637
+ name: 'push';
638
+ direction: ShaderDirection;
639
+ } | {
640
+ name: 'slideaway';
641
+ direction: ShaderDirection;
642
+ } | {
643
+ name: 'zoom';
644
+ startScale: number;
645
+ endScale: number;
646
+ origin: [number, number];
647
+ } | {
648
+ name: 'pixellate';
649
+ steps: number;
650
+ } | {
651
+ name: 'mask';
652
+ rule: string;
653
+ softness: number;
654
+ reverse: boolean;
655
+ })) | {
656
+ type: 'raw';
657
+ content: string;
658
+ params?: Array<ShaderParam>;
659
+ };
660
+
661
+ type ShaderTimeControl = 'auto' | 'manual' | 'transition';
662
+
636
663
  type ShaderProps = {
664
+ width?: number;
665
+ height?: number;
637
666
  shader?: ShaderSource;
638
667
  timeControl?: ShaderTimeControl;
639
668
  displayChannel?: number | null;
@@ -681,6 +710,7 @@ interface MoyuListenerAttributes {
681
710
  onKeyDown?: MoyuEventHandler<KeyboardEvent>;
682
711
  onKeyUp?: MoyuEventHandler<KeyboardEvent>;
683
712
  onKeyPress?: MoyuEventHandler<KeyboardEvent>;
713
+ onWheel?: MoyuEventHandler<WheelEvent>;
684
714
  onTouchStart?: MoyuEventHandler<TouchEvent>;
685
715
  onTouchMove?: MoyuEventHandler<TouchEvent>;
686
716
  onTouchEnd?: MoyuEventHandler<TouchEvent>;
@@ -690,6 +720,12 @@ type MoyuNodeAttributes = MoyuListenerAttributes & NodeProps & {
690
720
  children?: ReactNode;
691
721
  };
692
722
  type MoyuContainerAttributes = MoyuNodeAttributes;
723
+ type MoyuVBoxAttributes = VBoxProps & MoyuNodeAttributes & {
724
+ onLayout?: (event: LayoutEvent) => void;
725
+ };
726
+ type MoyuHBoxAttributes = HBoxProps & MoyuNodeAttributes & {
727
+ onLayout?: (event: LayoutEvent) => void;
728
+ };
693
729
  type MoyuClipAttributes = ClipProps & MoyuNodeAttributes;
694
730
  type MoyuFilterAttributes = FilterProps & MoyuNodeAttributes;
695
731
  type MoyuBackdropAttributes = BackdropProps & MoyuNodeAttributes;
@@ -728,6 +764,8 @@ declare namespace JSX {
728
764
  }
729
765
  interface IntrinsicElements {
730
766
  container: DetailedMoyuProps<MoyuContainerAttributes>;
767
+ vbox: DetailedMoyuProps<MoyuVBoxAttributes>;
768
+ hbox: DetailedMoyuProps<MoyuHBoxAttributes>;
731
769
  sprite: DetailedMoyuProps<MoyuSpriteAttributes>;
732
770
  text: DetailedMoyuProps<MoyuTextAttributes>;
733
771
  clip: DetailedMoyuProps<MoyuClipAttributes>;
@@ -740,4 +778,20 @@ declare namespace JSX {
740
778
  }
741
779
  }
742
780
 
743
- export { type AudioCommand as A, type BubbleEvent as B, type Command as C, type DetailedMoyuProps as D, type EffectParams as E, type SystemCommand as F, type GamepadCommand as G, type TouchEvent as H, type TouchEventKind as I, JSX as J, type KeyboardEvent as K, type Tuple2 as L, type MouseEvent as M, Node as N, type Tuple3 as O, type Tuple4 as P, createBubbleEvent as Q, type RetainMode as R, type ShaderDirection as S, type TextCommand as T, getStageSize as U, type WindowState as W, type MoyuEvent as a, type MaybePromise as b, type JsonValue as c, type AudioSettings as d, type KeyboardEventKind as e, type MakeNullOptional as f, type MouseEventKind as g, type MoyuAnimationAttributes as h, type MoyuBackdropAttributes as i, type MoyuClipAttributes as j, type MoyuContainerAttributes as k, type MoyuEventHandler as l, type MoyuFilterAttributes as m, type MoyuListenerAttributes as n, type MoyuNodeAttributes as o, type MoyuShaderAttributes as p, type MoyuShaderSlotAttributes as q, type MoyuSpriteAttributes as r, type MoyuTextAttributes as s, type MoyuVideoAttributes as t, type ScenarioCommand as u, type ShaderCommand as v, type ShaderParam as w, type ShaderParamType as x, type ShaderSource as y, type ShaderTimeControl as z };
781
+ declare function getStageSize(): {
782
+ width: number;
783
+ height: number;
784
+ scaleFactor: number;
785
+ };
786
+ type MakeNullOptional<T> = T extends unknown ? {
787
+ [K in keyof T as null extends T[K] ? never : K]: T[K];
788
+ } & {
789
+ [K in keyof T as null extends T[K] ? K : never]?: T[K];
790
+ } : never;
791
+ declare function mergeEvent<T extends BubbleEvent, K extends BubbleEvent>(handlers: MoyuEventHandler<T> | readonly MoyuEventHandler<T>[] | undefined, defaultHandler?: MoyuEventHandler<K>): (event: T | K) => void;
792
+
793
+ type _Command = AudioCommand | TextCommand | GamepadCommand | ScenarioCommand | ShaderCommand | SystemCommand;
794
+ type Command = MakeNullOptional<_Command>;
795
+ type MaybePromise = any;
796
+
797
+ export { createBubbleEvent as $, type AudioCommand as A, type BubbleEvent as B, type Command as C, type DetailedMoyuProps as D, type EffectParams as E, type ShaderParam as F, type GamepadCommand as G, type ShaderParamType as H, type ShaderSource as I, JSX as J, type KeyboardEvent as K, type LayoutEvent as L, type MoyuEvent as M, Node as N, type ShaderTimeControl as O, type SystemCommand as P, type TextCommand as Q, type RetainMode as R, type ShaderDirection as S, type TouchEvent as T, type TouchEventKind as U, type Tuple2 as V, type WheelEvent as W, type Tuple3 as X, type Tuple4 as Y, type WheelEventDeltaMode as Z, type WindowState as _, type MaybePromise as a, getStageSize as a0, mergeEvent as a1, type MoyuClipAttributes as b, type MoyuVBoxAttributes as c, type MoyuSpriteAttributes as d, type TextProps as e, type MoyuNodeAttributes as f, type MouseEvent as g, type SpriteProps as h, type JsonValue as i, type AudioSettings as j, type KeyboardEventKind as k, type MakeNullOptional as l, type MouseEventKind as m, type MoyuAnimationAttributes as n, type MoyuBackdropAttributes as o, type MoyuContainerAttributes as p, type MoyuEventHandler as q, type MoyuFilterAttributes as r, type MoyuHBoxAttributes as s, type MoyuListenerAttributes as t, type MoyuShaderAttributes as u, type MoyuShaderSlotAttributes as v, type MoyuTextAttributes as w, type MoyuVideoAttributes as x, type ScenarioCommand as y, type ShaderCommand as z };