canvasengine 2.0.0-beta.56 → 2.0.0-beta.59

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.
@@ -50,7 +50,7 @@ export declare class RadialGradient {
50
50
  y: number;
51
51
  };
52
52
  }): {
53
- texture: Texture<import('pixi.js').TextureSource<any>>;
53
+ texture: Texture<import('pixi.js').TextureSource<any>> | null;
54
54
  matrix: Matrix;
55
55
  };
56
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvasengine",
3
- "version": "2.0.0-beta.56",
3
+ "version": "2.0.0-beta.59",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,18 +10,18 @@
10
10
  "dependencies": {
11
11
  "@barvynkoa/particle-emitter": "^0.0.1",
12
12
  "@pixi/layout": "^3.2.0",
13
- "@signe/reactive": "^2.6.0",
13
+ "@signe/reactive": "^2.9.0",
14
14
  "howler": "^2.2.4",
15
15
  "joypad.js": "^2.3.5",
16
- "pixi-filters": "^6.0.5",
16
+ "pixi-filters": "^6.1.5",
17
17
  "pixi-viewport": "^6.0.3",
18
18
  "popmotion": "^11.0.5",
19
- "rxjs": "^7.8.1",
19
+ "rxjs": "^7.8.2",
20
20
  "yoga-layout": "^3.2.1"
21
21
  },
22
22
  "devDependencies": {
23
- "@types/howler": "^2.2.11",
24
- "vite": "^7.3.0",
23
+ "@types/howler": "^2.2.12",
24
+ "vite": "^8.0.10",
25
25
  "vite-plugin-dts": "^4.5.4"
26
26
  },
27
27
  "author": "Samuel Ronce",
@@ -375,13 +375,11 @@ export class CanvasSprite extends DisplayObject(PixiSprite) {
375
375
 
376
376
  if (!this.isMounted) return;
377
377
 
378
- if (_isMoving) {
379
- this.sheetCurrentAnimation = StandardAnimation.Walk;
380
- } else {
381
- this.sheetCurrentAnimation = StandardAnimation.Stand;
382
- }
378
+ const animationName = this.getMovementAnimationName(_isMoving);
379
+ if (!animationName) return;
383
380
 
384
- if (this.spritesheet && this.has(this.sheetCurrentAnimation)) this.play(this.sheetCurrentAnimation, [this.sheetParams]);
381
+ this.sheetCurrentAnimation = animationName;
382
+ if (this.spritesheet) this.play(this.sheetCurrentAnimation, [this.sheetParams]);
385
383
  });
386
384
  super.onMount(params);
387
385
  }
@@ -521,6 +519,35 @@ export class CanvasSprite extends DisplayObject(PixiSprite) {
521
519
  return this.currentAnimation.name == name;
522
520
  }
523
521
 
522
+ private getFirstAnimationName(): string | undefined {
523
+ return this.animations.keys().next().value;
524
+ }
525
+
526
+ private getPlayableAnimationName(preferred?: string): string | undefined {
527
+ if (preferred && this.has(preferred)) {
528
+ return preferred;
529
+ }
530
+ return this.getFirstAnimationName();
531
+ }
532
+
533
+ private getMovementAnimationName(isMoving: boolean): string | undefined {
534
+ const standardAnimation = isMoving
535
+ ? StandardAnimation.Walk
536
+ : StandardAnimation.Stand;
537
+
538
+ if (this.has(standardAnimation)) {
539
+ return standardAnimation;
540
+ }
541
+
542
+ if (this.sheetCurrentAnimation && this.has(this.sheetCurrentAnimation)) {
543
+ return this.sheetCurrentAnimation;
544
+ }
545
+
546
+ if (this.currentAnimation?.name && this.has(this.currentAnimation.name)) {
547
+ return this.currentAnimation.name;
548
+ }
549
+ }
550
+
524
551
  stop() {
525
552
  this.currentAnimation = null;
526
553
  }
@@ -612,7 +639,11 @@ export class CanvasSprite extends DisplayObject(PixiSprite) {
612
639
  // Recreate animations from spritesheet
613
640
  if (this.spritesheet) {
614
641
  await this.createAnimations();
615
- this.play(this.sheetCurrentAnimation, [this.sheetParams]);
642
+ const animationName = this.getPlayableAnimationName(this.sheetCurrentAnimation);
643
+ if (animationName) {
644
+ this.sheetCurrentAnimation = animationName;
645
+ this.play(animationName, [this.sheetParams]);
646
+ }
616
647
  }
617
648
  }
618
649
 
@@ -609,9 +609,10 @@ export function createComponent(tag: string, props?: Props): Element {
609
609
  if (!element.props.children) {
610
610
  return;
611
611
  }
612
- for (let child of element.props.children) {
612
+ for (let i = 0; i < element.props.children.length; i++) {
613
+ const child = element.props.children[i];
613
614
  if (!child) continue;
614
- await createElement(element, child)
615
+ await createElement(element, child, i)
615
616
  }
616
617
  };
617
618
 
@@ -648,25 +649,87 @@ export function createComponent(tag: string, props?: Props): Element {
648
649
  * await createElement(parent, import('./MyComponent').then(mod => h(mod.default)));
649
650
  * ```
650
651
  */
651
- async function createElement(parent: Element, child: Element | Observable<any> | Promise<Element>) {
652
+ async function createElement(parent: Element, child: Element | Observable<any> | Promise<Element>, childOrder?: number) {
652
653
  if (isPromise(child)) {
653
654
  child = await child;
654
655
  }
656
+
657
+ const childGroups = ((parent as any).__childGroups ??= []);
658
+ const resolvedOrder =
659
+ childOrder ??
660
+ (parent.props.children ? parent.props.children.indexOf(child as any) : -1);
661
+ const childGroup = {
662
+ order: resolvedOrder >= 0 ? resolvedOrder : childGroups.length,
663
+ mounted: new Map<any, Element>(),
664
+ };
665
+ childGroups.push(childGroup);
666
+
667
+ const getMountedIndex = (element?: Element): number | undefined => {
668
+ const children = (parent.componentInstance as any)?.children;
669
+ if (!element || !children) return;
670
+ const index = children.indexOf(element.componentInstance);
671
+ return index >= 0 ? index : undefined;
672
+ };
673
+
674
+ const getNextGroupIndex = (): number | undefined => {
675
+ const nextGroups = childGroups
676
+ .filter((group) => group !== childGroup && group.order > childGroup.order)
677
+ .sort((a, b) => a.order - b.order);
678
+
679
+ for (const group of nextGroups) {
680
+ for (const mounted of group.mounted.values()) {
681
+ const index = getMountedIndex(mounted);
682
+ if (index !== undefined) return index;
683
+ }
684
+ }
685
+ };
686
+
687
+ const getInsertIndex = (
688
+ sourceIndex: number,
689
+ orderedSources: any[]
690
+ ): number | undefined => {
691
+ for (let i = sourceIndex + 1; i < orderedSources.length; i++) {
692
+ const index = getMountedIndex(childGroup.mounted.get(orderedSources[i]));
693
+ if (index !== undefined) return index;
694
+ }
695
+ return getNextGroupIndex();
696
+ };
697
+
655
698
  if (child instanceof Observable) {
656
- const mountedFlowElements = new Map<Element, Element>();
699
+ const mountedFlowElements = childGroup.mounted;
700
+
701
+ const createFragmentOwner = (): Element => ({
702
+ tag: 'fragment',
703
+ props: { children: [] },
704
+ componentInstance: {} as any,
705
+ propSubscriptions: [],
706
+ effectSubscriptions: [],
707
+ effectMounts: [],
708
+ effectUnmounts: [],
709
+ propObservables: {},
710
+ parent,
711
+ directives: {},
712
+ destroy() { destroyElement(this) },
713
+ allElements: new Subject(),
714
+ isFrozen: false
715
+ });
657
716
 
658
- const mountFlowElement = (element: Element, index?: number) => {
717
+ const mountFlowElement = (
718
+ element: Element,
719
+ sourceIndex: number,
720
+ orderedSources: any[]
721
+ ) => {
659
722
  if (mountedFlowElements.has(element)) {
660
723
  return;
661
724
  }
662
725
 
663
726
  const routed = routeDomComponent(parent, element);
664
727
  mountedFlowElements.set(element, routed);
665
- onMount(parent, routed, index);
728
+ onMount(parent, routed, getInsertIndex(sourceIndex, orderedSources));
666
729
  propagateContext(routed);
667
730
  };
668
731
 
669
- const syncFlowElements = (nextElements: Set<Element>) => {
732
+ const syncFlowElements = (nextElements: Set<any>) => {
670
733
  mountedFlowElements.forEach((mounted, source) => {
671
734
  if (nextElements.has(source)) {
672
735
  return;
@@ -680,16 +743,22 @@ export function createComponent(tag: string, props?: Props): Element {
680
743
 
681
744
  const processFlowComponent = (
682
745
  component: any,
683
- nextElements: Set<Element>,
684
- index?: number
746
+ nextElements: Set<any>,
747
+ index: number,
748
+ orderedSources: any[]
685
749
  ) => {
686
750
  if (component instanceof Observable) {
687
- void createElement(parent, component);
751
+ nextElements.add(component);
752
+ if (!mountedFlowElements.has(component)) {
753
+ const owner = createFragmentOwner();
754
+ mountedFlowElements.set(component, owner);
755
+ void createElement(owner, component);
756
+ }
688
757
  return;
689
758
  }
690
759
  if (Array.isArray(component)) {
691
760
  component.forEach((comp) =>
692
- processFlowComponent(comp, nextElements, index)
761
+ processFlowComponent(comp, nextElements, index, orderedSources)
693
762
  );
694
763
  return;
695
764
  }
@@ -698,7 +767,7 @@ export function createComponent(tag: string, props?: Props): Element {
698
767
  }
699
768
 
700
769
  nextElements.add(component);
701
- mountFlowElement(component, index);
770
+ mountFlowElement(component, index, orderedSources);
702
771
  };
703
772
 
704
773
  // Subscribe to the observable and handle the emitted values
@@ -716,46 +785,50 @@ export function createComponent(tag: string, props?: Props): Element {
716
785
  } = value;
717
786
 
718
787
  const components = comp.filter((c) => c !== null);
719
- const nextElements = new Set<Element>();
788
+ const nextElements = new Set<any>();
720
789
  if (prev) {
721
790
  components.forEach((c) => {
722
791
  const index = parent.props.children.indexOf(prev.props.key);
723
- processFlowComponent(c, nextElements, index + 1);
792
+ processFlowComponent(c, nextElements, index + 1, components);
724
793
  });
725
794
  syncFlowElements(nextElements);
726
795
  return;
727
796
  }
728
797
  components.forEach((component, index) => {
729
- processFlowComponent(component, nextElements, index);
798
+ processFlowComponent(component, nextElements, index, components);
730
799
  });
731
800
  syncFlowElements(nextElements);
732
801
  } else if (isElement(value)) {
733
802
  // Handle direct Element emission
734
803
  const routed = routeDomComponent(parent, value);
735
- onMount(parent, routed);
804
+ childGroup.mounted.set(value, routed);
805
+ onMount(parent, routed, getInsertIndex(0, [value]));
736
806
  propagateContext(routed);
737
807
  } else if (Array.isArray(value)) {
738
808
  // Handle array of elements (which can also be observables)
739
- value.forEach(async (element) => {
740
- if (element instanceof Observable) {
741
- // Handle observable element recursively
742
- await createElement(parent, element);
743
- } else if (isElement(element)) {
744
- const routed = routeDomComponent(parent, element);
745
- onMount(parent, routed);
746
- propagateContext(routed);
747
- }
809
+ const nextElements = new Set<any>();
810
+ value.forEach((element, index) => {
811
+ processFlowComponent(element, nextElements, index, value);
748
812
  });
813
+ syncFlowElements(nextElements);
749
814
  }
750
815
  elementsListen.next(undefined);
751
816
  }
752
817
  );
753
818
 
819
+ subscription.add(() => {
820
+ mountedFlowElements.forEach((mounted) => {
821
+ destroyElement(mounted);
822
+ });
823
+ mountedFlowElements.clear();
824
+ });
825
+
754
826
  // Store subscription for cleanup
755
827
  parent.effectSubscriptions.push(subscription);
756
828
  } else if (isElement(child)) {
757
829
  const routed = routeDomComponent(parent, child);
758
- onMount(parent, routed);
830
+ childGroup.mounted.set(child, routed);
831
+ onMount(parent, routed, getInsertIndex(0, [child]));
759
832
  await propagateContext(routed);
760
833
  }
761
834
  }
@@ -1,86 +0,0 @@
1
- import { ComponentFunction } from '../engine/signal';
2
- import { DisplayObjectProps } from './types/DisplayObject';
3
- interface ContainerProps extends DisplayObjectProps {
4
- sortableChildren?: boolean;
5
- }
6
- declare const CanvasContainer_base: {
7
- new (): {
8
- [x: string]: any;
9
- "__#private@#canvasContext": {
10
- [key: string]: any;
11
- } | null;
12
- isFlex: boolean;
13
- fullProps: import('..').Props;
14
- isMounted: boolean;
15
- _anchorPoints: import('pixi.js').ObservablePoint;
16
- isCustomAnchor: boolean;
17
- displayWidth: import('@signe/reactive').WritableSignal<number>;
18
- displayHeight: import('@signe/reactive').WritableSignal<number>;
19
- overrideProps: string[];
20
- layout: any;
21
- onBeforeDestroy: import('./DisplayObject').OnHook | null;
22
- onAfterMount: import('./DisplayObject').OnHook | null;
23
- subjectInit: import('rxjs').BehaviorSubject<any>;
24
- disableLayout: boolean;
25
- "__#private@#registeredEvents": Map<string, Function>;
26
- "__#private@#computedLayoutBox": {
27
- width?: number;
28
- height?: number;
29
- } | null;
30
- "__#private@#element": import('..').Element<any> | null;
31
- getElement(): import('..').Element<any> | null;
32
- onLayoutComputed(_event: any): void;
33
- get deltaRatio(): any;
34
- get parentIsFlex(): any;
35
- onInit(props: import('..').Props): void;
36
- onMount(element: import('..').Element<any>, index?: number): Promise<void>;
37
- onUpdate(props: import('..').Props): void;
38
- onDestroy(parent: import('..').Element, afterDestroy?: () => void): Promise<void>;
39
- setFlexDirection(direction: import('./types/DisplayObject').FlexDirection): void;
40
- setFlexWrap(wrap: "wrap" | "nowrap" | "wrap-reverse"): void;
41
- setAlignContent(align: import('./types/DisplayObject').AlignContent): void;
42
- setAlignSelf(align: import('./types/DisplayObject').AlignContent): void;
43
- setAlignItems(align: import('./types/DisplayObject').AlignContent): void;
44
- setJustifyContent(justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around"): void;
45
- setPosition(position: import('./types/DisplayObject').EdgeSize): void;
46
- setX(x: number): void;
47
- setY(y: number): void;
48
- setPadding(padding: import('./types/DisplayObject').EdgeSize): void;
49
- setMargin(margin: import('./types/DisplayObject').EdgeSize): void;
50
- setGap(gap: import('./types/DisplayObject').EdgeSize): void;
51
- setBorder(border: import('./types/DisplayObject').EdgeSize): void;
52
- setPositionType(positionType: "relative" | "absolute"): void;
53
- setWidth(width: number): void;
54
- setHeight(height: number): void;
55
- getWidth(): number;
56
- getHeight(): number;
57
- setMinWidth(minWidth: number | string): void;
58
- setMinHeight(minHeight: number | string): void;
59
- setMaxWidth(maxWidth: number | string): void;
60
- setMaxHeight(maxHeight: number | string): void;
61
- setAspectRatio(aspectRatio: number): void;
62
- setFlexGrow(flexGrow: number): void;
63
- setFlexShrink(flexShrink: number): void;
64
- setFlexBasis(flexBasis: number | string): void;
65
- setRowGap(rowGap: number): void;
66
- setColumnGap(columnGap: number): void;
67
- setTop(top: number | string): void;
68
- setLeft(left: number | string): void;
69
- setRight(right: number | string): void;
70
- setBottom(bottom: number | string): void;
71
- setObjectFit(objectFit: import('./types/DisplayObject').ObjectFit): void;
72
- setObjectPosition(objectPosition: import('./types/DisplayObject').ObjectPosition): void;
73
- setTransformOrigin(transformOrigin: import('./types/DisplayObject').TransformOrigin): void;
74
- };
75
- [x: string]: any;
76
- };
77
- export declare class CanvasContainer extends CanvasContainer_base {
78
- isCustomAnchor: boolean;
79
- onUpdate(props: any): void;
80
- onMount(args: any): Promise<void>;
81
- }
82
- export interface CanvasContainer extends DisplayObjectProps {
83
- }
84
- export declare const Container: ComponentFunction<ContainerProps>;
85
- export {};
86
- //# sourceMappingURL=Container.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../src/components/Container.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI3D,UAAU,cAAe,SAAQ,kBAAkB;IACjD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;;;;;;;;;;;;;;;;;;;;;;iBAuDq/B,CAAC;kBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AArDxgC,qBAAa,eAAgB,SAAQ,oBAA4B;IAC/D,cAAc,UAAQ;IAEtB,QAAQ,CAAC,KAAK,KAAA;IAaR,OAAO,CAAC,IAAI,KAAA;CA0BnB;AAED,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;CAAG;AAI9D,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,CAIvD,CAAC"}
@@ -1,98 +0,0 @@
1
- import { Element } from '../engine/reactive';
2
- import { ComponentFunction } from '../engine/signal';
3
- import { DisplayObjectProps } from './types/DisplayObject';
4
- declare const CanvasDOMContainer_base: {
5
- new (): {
6
- [x: string]: any;
7
- "__#private@#canvasContext": {
8
- [key: string]: any;
9
- } | null;
10
- isFlex: boolean;
11
- fullProps: import('..').Props;
12
- isMounted: boolean;
13
- _anchorPoints: import('pixi.js').ObservablePoint;
14
- isCustomAnchor: boolean;
15
- displayWidth: import('@signe/reactive').WritableSignal<number>;
16
- displayHeight: import('@signe/reactive').WritableSignal<number>;
17
- overrideProps: string[];
18
- layout: any;
19
- onBeforeDestroy: import('./DisplayObject').OnHook | null;
20
- onAfterMount: import('./DisplayObject').OnHook | null;
21
- subjectInit: import('rxjs').BehaviorSubject<any>;
22
- disableLayout: boolean;
23
- "__#private@#registeredEvents": Map<string, Function>;
24
- "__#private@#computedLayoutBox": {
25
- width?: number;
26
- height?: number;
27
- } | null;
28
- "__#private@#element": Element<any> | null;
29
- getElement(): Element<any> | null;
30
- onLayoutComputed(_event: any): void;
31
- get deltaRatio(): any;
32
- get parentIsFlex(): any;
33
- onInit(props: import('..').Props): void;
34
- onMount(element: Element<any>, index?: number): Promise<void>;
35
- onUpdate(props: import('..').Props): void;
36
- onDestroy(parent: Element, afterDestroy?: () => void): Promise<void>;
37
- setFlexDirection(direction: import('./types/DisplayObject').FlexDirection): void;
38
- setFlexWrap(wrap: "wrap" | "nowrap" | "wrap-reverse"): void;
39
- setAlignContent(align: import('./types/DisplayObject').AlignContent): void;
40
- setAlignSelf(align: import('./types/DisplayObject').AlignContent): void;
41
- setAlignItems(align: import('./types/DisplayObject').AlignContent): void;
42
- setJustifyContent(justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around"): void;
43
- setPosition(position: import('./types/DisplayObject').EdgeSize): void;
44
- setX(x: number): void;
45
- setY(y: number): void;
46
- setPadding(padding: import('./types/DisplayObject').EdgeSize): void;
47
- setMargin(margin: import('./types/DisplayObject').EdgeSize): void;
48
- setGap(gap: import('./types/DisplayObject').EdgeSize): void;
49
- setBorder(border: import('./types/DisplayObject').EdgeSize): void;
50
- setPositionType(positionType: "relative" | "absolute"): void;
51
- setWidth(width: number): void;
52
- setHeight(height: number): void;
53
- getWidth(): number;
54
- getHeight(): number;
55
- setMinWidth(minWidth: number | string): void;
56
- setMinHeight(minHeight: number | string): void;
57
- setMaxWidth(maxWidth: number | string): void;
58
- setMaxHeight(maxHeight: number | string): void;
59
- setAspectRatio(aspectRatio: number): void;
60
- setFlexGrow(flexGrow: number): void;
61
- setFlexShrink(flexShrink: number): void;
62
- setFlexBasis(flexBasis: number | string): void;
63
- setRowGap(rowGap: number): void;
64
- setColumnGap(columnGap: number): void;
65
- setTop(top: number | string): void;
66
- setLeft(left: number | string): void;
67
- setRight(right: number | string): void;
68
- setBottom(bottom: number | string): void;
69
- setObjectFit(objectFit: import('./types/DisplayObject').ObjectFit): void;
70
- setObjectPosition(objectPosition: import('./types/DisplayObject').ObjectPosition): void;
71
- setTransformOrigin(transformOrigin: import('./types/DisplayObject').TransformOrigin): void;
72
- };
73
- [x: string]: any;
74
- };
75
- export declare class CanvasDOMContainer extends CanvasDOMContainer_base {
76
- disableLayout: boolean;
77
- private canvasSizeEffect;
78
- private static readonly DOM_ROUTING_MAP;
79
- private static readonly DOM_ALLOWED_TAGS;
80
- private static readonly DOM_UNSUPPORTED_TAGS;
81
- private hasDomContainerAncestor;
82
- private getPercentRatio;
83
- private getCanvasSize;
84
- private shouldUseCanvasPercent;
85
- private syncCanvasSizeEffect;
86
- private applyElementSize;
87
- private routeDomChildren;
88
- onInit(props: any): void;
89
- onMount(element: Element<any>, index?: number): Promise<void>;
90
- onUpdate(props: any): void;
91
- onLayoutComputed(): void;
92
- onDestroy(parent: Element<any>, afterDestroy?: () => void): Promise<void>;
93
- }
94
- export interface CanvasDOMContainer extends DisplayObjectProps {
95
- }
96
- export declare const DOMContainer: ComponentFunction<any>;
97
- export {};
98
- //# sourceMappingURL=DOMContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DOMContainer.d.ts","sourceRoot":"","sources":["../../src/components/DOMContainer.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,OAAO,EAGR,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAK,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;;;;;;;;;;;;;;;;;;;;;;iBAsHnD,CAAC;kBACA,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAnBV,qBAAa,kBAAmB,SAAQ,uBAA+B;IACrE,aAAa,UAAQ;IACrB,OAAO,CAAC,gBAAgB,CAAa;IACrC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAErC;IACF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAIrC;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAqBzC;IAEH,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,sBAAsB;IAO9B,OAAO,CAAC,oBAAoB;IAgB5B,OAAO,CAAC,gBAAgB;IAgDxB,OAAO,CAAC,gBAAgB;IA8BxB,MAAM,CAAC,KAAK,EAAE,GAAG;IA8EX,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM;IAMnD,QAAQ,CAAC,KAAK,EAAE,GAAG;IAMnB,gBAAgB;IAIV,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,IAAI;CAUhE;AAED,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;CAAI;AAIlE,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,GAAG,CAE/C,CAAC"}
@@ -1,94 +0,0 @@
1
- import { Element, Props } from '../engine/reactive';
2
- import { AlignContent, EdgeSize, FlexDirection, ObjectFit, ObjectPosition, TransformOrigin } from './types/DisplayObject';
3
- import { ObservablePoint, Point, Rectangle } from 'pixi.js';
4
- import { BehaviorSubject } from 'rxjs';
5
- export interface ComponentInstance extends PixiMixins.ContainerOptions {
6
- id?: string;
7
- children?: ComponentInstance[];
8
- onInit?(props: Props): void;
9
- onUpdate?(props: Props): void;
10
- onDestroy?(parent: Element, afterDestroy: () => void): void;
11
- onMount?(context: Element<any>, index?: number): void;
12
- setWidth(width: number): void;
13
- setHeight(height: number): void;
14
- getLocalBounds?(): Rectangle;
15
- getGlobalPosition?(): Point;
16
- }
17
- export declare const EVENTS: string[];
18
- export type OnHook = (() => void) | (() => Promise<void> | void);
19
- export declare function DisplayObject(extendClass: any): {
20
- new (): {
21
- [x: string]: any;
22
- "__#private@#canvasContext": {
23
- [key: string]: any;
24
- } | null;
25
- isFlex: boolean;
26
- fullProps: Props;
27
- isMounted: boolean;
28
- _anchorPoints: ObservablePoint;
29
- isCustomAnchor: boolean;
30
- displayWidth: import('@signe/reactive').WritableSignal<number>;
31
- displayHeight: import('@signe/reactive').WritableSignal<number>;
32
- overrideProps: string[];
33
- layout: any;
34
- onBeforeDestroy: OnHook | null;
35
- onAfterMount: OnHook | null;
36
- subjectInit: BehaviorSubject<any>;
37
- disableLayout: boolean;
38
- "__#private@#registeredEvents": Map<string, Function>;
39
- "__#private@#computedLayoutBox": {
40
- width?: number;
41
- height?: number;
42
- } | null;
43
- "__#private@#element": Element<any> | null;
44
- /**
45
- * Get the element reference for freeze checking
46
- * @returns The element reference or null
47
- */
48
- getElement(): Element<any> | null;
49
- onLayoutComputed(_event: any): void;
50
- get deltaRatio(): any;
51
- get parentIsFlex(): any;
52
- onInit(props: Props): void;
53
- onMount(element: Element<any>, index?: number): Promise<void>;
54
- onUpdate(props: Props): void;
55
- onDestroy(parent: Element, afterDestroy?: () => void): Promise<void>;
56
- setFlexDirection(direction: FlexDirection): void;
57
- setFlexWrap(wrap: "wrap" | "nowrap" | "wrap-reverse"): void;
58
- setAlignContent(align: AlignContent): void;
59
- setAlignSelf(align: AlignContent): void;
60
- setAlignItems(align: AlignContent): void;
61
- setJustifyContent(justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around"): void;
62
- setPosition(position: EdgeSize): void;
63
- setX(x: number): void;
64
- setY(y: number): void;
65
- setPadding(padding: EdgeSize): void;
66
- setMargin(margin: EdgeSize): void;
67
- setGap(gap: EdgeSize): void;
68
- setBorder(border: EdgeSize): void;
69
- setPositionType(positionType: "relative" | "absolute"): void;
70
- setWidth(width: number): void;
71
- setHeight(height: number): void;
72
- getWidth(): number;
73
- getHeight(): number;
74
- setMinWidth(minWidth: number | string): void;
75
- setMinHeight(minHeight: number | string): void;
76
- setMaxWidth(maxWidth: number | string): void;
77
- setMaxHeight(maxHeight: number | string): void;
78
- setAspectRatio(aspectRatio: number): void;
79
- setFlexGrow(flexGrow: number): void;
80
- setFlexShrink(flexShrink: number): void;
81
- setFlexBasis(flexBasis: number | string): void;
82
- setRowGap(rowGap: number): void;
83
- setColumnGap(columnGap: number): void;
84
- setTop(top: number | string): void;
85
- setLeft(left: number | string): void;
86
- setRight(right: number | string): void;
87
- setBottom(bottom: number | string): void;
88
- setObjectFit(objectFit: ObjectFit): void;
89
- setObjectPosition(objectPosition: ObjectPosition): void;
90
- setTransformOrigin(transformOrigin: TransformOrigin): void;
91
- };
92
- [x: string]: any;
93
- };
94
- //# sourceMappingURL=DisplayObject.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DisplayObject.d.ts","sourceRoot":"","sources":["../../src/components/DisplayObject.ts"],"names":[],"mappings":"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"}