canvasengine 2.0.0-beta.42 → 2.0.0-beta.44

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.
Files changed (77) hide show
  1. package/dist/{DebugRenderer-BosXI2Pd.js → DebugRenderer-P5sZ-0Tq.js} +2 -2
  2. package/dist/{DebugRenderer-BosXI2Pd.js.map → DebugRenderer-P5sZ-0Tq.js.map} +1 -1
  3. package/dist/components/Button.d.ts +3 -1
  4. package/dist/components/Button.d.ts.map +1 -1
  5. package/dist/components/Canvas.d.ts +0 -1
  6. package/dist/components/DOMElement.d.ts +0 -1
  7. package/dist/components/DOMElement.d.ts.map +1 -1
  8. package/dist/components/Graphic.d.ts +1 -2
  9. package/dist/components/Graphic.d.ts.map +1 -1
  10. package/dist/components/NineSliceSprite.d.ts +0 -1
  11. package/dist/components/ParticleEmitter.d.ts +0 -1
  12. package/dist/components/Text.d.ts +0 -1
  13. package/dist/components/TilingSprite.d.ts +0 -1
  14. package/dist/components/Video.d.ts +0 -1
  15. package/dist/components/index.d.ts +2 -1
  16. package/dist/components/index.d.ts.map +1 -1
  17. package/dist/components/types/DisplayObject.d.ts +12 -16
  18. package/dist/components/types/DisplayObject.d.ts.map +1 -1
  19. package/dist/components/types/index.d.ts +0 -1
  20. package/dist/directives/Controls.d.ts +0 -1
  21. package/dist/directives/Drag.d.ts +0 -1
  22. package/dist/directives/Flash.d.ts +0 -1
  23. package/dist/directives/FocusNavigation.d.ts +70 -0
  24. package/dist/directives/FocusNavigation.d.ts.map +1 -0
  25. package/dist/directives/GamepadControls.d.ts +0 -1
  26. package/dist/directives/JoystickControls.d.ts +0 -1
  27. package/dist/directives/KeyboardControls.d.ts +0 -1
  28. package/dist/directives/KeyboardControls.d.ts.map +1 -1
  29. package/dist/directives/Scheduler.d.ts +0 -1
  30. package/dist/directives/Shake.d.ts +0 -1
  31. package/dist/directives/Sound.d.ts +0 -1
  32. package/dist/directives/Transition.d.ts +0 -1
  33. package/dist/directives/ViewportCull.d.ts +0 -1
  34. package/dist/directives/ViewportFollow.d.ts +0 -1
  35. package/dist/directives/ViewportFollow.d.ts.map +1 -1
  36. package/dist/engine/FocusManager.d.ts +173 -0
  37. package/dist/engine/FocusManager.d.ts.map +1 -0
  38. package/dist/engine/animation.d.ts +0 -1
  39. package/dist/engine/bootstrap.d.ts +0 -1
  40. package/dist/engine/directive.d.ts +0 -1
  41. package/dist/engine/reactive.d.ts +0 -1
  42. package/dist/engine/reactive.d.ts.map +1 -1
  43. package/dist/engine/signal.d.ts +0 -1
  44. package/dist/engine/utils.d.ts +0 -1
  45. package/dist/hooks/useFocus.d.ts +60 -0
  46. package/dist/hooks/useFocus.d.ts.map +1 -0
  47. package/dist/hooks/useRef.d.ts +0 -1
  48. package/dist/{index-DNwqVzaq.js → index-VPoz4ufu.js} +6792 -6117
  49. package/dist/index-VPoz4ufu.js.map +1 -0
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.global.js +4 -28
  53. package/dist/index.global.js.map +1 -1
  54. package/dist/index.js +67 -61
  55. package/dist/utils/RadialGradient.d.ts +0 -1
  56. package/package.json +4 -4
  57. package/src/components/Button.ts +7 -4
  58. package/src/components/Canvas.ts +1 -1
  59. package/src/components/DOMContainer.ts +27 -2
  60. package/src/components/DOMElement.ts +37 -29
  61. package/src/components/DisplayObject.ts +15 -3
  62. package/src/components/FocusContainer.ts +372 -0
  63. package/src/components/Graphic.ts +43 -48
  64. package/src/components/Sprite.ts +4 -2
  65. package/src/components/Viewport.ts +65 -26
  66. package/src/components/index.ts +2 -1
  67. package/src/components/types/DisplayObject.ts +7 -4
  68. package/src/directives/Controls.ts +1 -1
  69. package/src/directives/ControlsBase.ts +1 -1
  70. package/src/directives/FocusNavigation.ts +251 -0
  71. package/src/directives/KeyboardControls.ts +12 -8
  72. package/src/directives/ViewportFollow.ts +8 -5
  73. package/src/engine/FocusManager.ts +495 -0
  74. package/src/engine/reactive.ts +20 -19
  75. package/src/hooks/useFocus.ts +94 -0
  76. package/src/index.ts +2 -0
  77. package/dist/index-DNwqVzaq.js.map +0 -1
@@ -0,0 +1,173 @@
1
+ import { Signal } from '@signe/reactive';
2
+ import { Element } from './reactive';
3
+ import { CanvasViewport } from '../components/Viewport';
4
+ import { SignalOrPrimitive } from '../components/types';
5
+ /**
6
+ * Options for scroll behavior when navigating to focused elements
7
+ *
8
+ * @property padding - Padding around the element in pixels (default: 0)
9
+ * @property smooth - Enable smooth scrolling animation (default: false)
10
+ * @property center - Center the element in the viewport (default: true)
11
+ * @property duration - Animation duration in ms if smooth=true (default: 300)
12
+ */
13
+ export interface ScrollOptions {
14
+ padding?: number;
15
+ smooth?: boolean;
16
+ center?: boolean;
17
+ duration?: number;
18
+ }
19
+ /**
20
+ * Data structure for a focus container
21
+ */
22
+ interface FocusContainerData {
23
+ id: string;
24
+ element?: Element;
25
+ focusables: Map<number, Element>;
26
+ currentIndex: Signal<number | null>;
27
+ focusedElement: Signal<Element | null>;
28
+ onFocusChange?: (index: number, element: Element | null) => void;
29
+ autoScroll?: boolean | ScrollOptions;
30
+ viewport?: CanvasViewport;
31
+ throttle?: number;
32
+ lastNavigateTime?: number;
33
+ tabindex?: SignalOrPrimitive<number>;
34
+ tabindexSubscription?: any;
35
+ }
36
+ /**
37
+ * Central manager for focus navigation system
38
+ *
39
+ * Manages focusable elements within containers, handles navigation,
40
+ * and provides scroll integration with Viewport.
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * const manager = FocusManager.getInstance();
45
+ * manager.registerContainer('menu', containerData);
46
+ * manager.navigate('menu', 'next');
47
+ * ```
48
+ */
49
+ export declare class FocusManager {
50
+ private static instance;
51
+ private containers;
52
+ private scrollAnimations;
53
+ /**
54
+ * Get the singleton instance of FocusManager
55
+ *
56
+ * @returns The FocusManager instance
57
+ */
58
+ static getInstance(): FocusManager;
59
+ /**
60
+ * Register a focus container
61
+ *
62
+ * @param id - Unique identifier for the container
63
+ * @param data - Container data including signals and callbacks
64
+ */
65
+ registerContainer(id: string, data: Omit<FocusContainerData, 'id'>): void;
66
+ /**
67
+ * Update a focus container's data
68
+ *
69
+ * @param id - Container identifier
70
+ * @param data - Partial container data to update
71
+ */
72
+ updateContainer(id: string, data: Partial<Omit<FocusContainerData, 'id'>>): void;
73
+ setTabindex(id: string, tabindex: SignalOrPrimitive<number>): void;
74
+ /**
75
+ * Unregister a focus container
76
+ *
77
+ * @param id - Container identifier to remove
78
+ */
79
+ unregisterContainer(id: string): void;
80
+ /**
81
+ * Register a focusable element in a container
82
+ *
83
+ * @param containerId - Container identifier
84
+ * @param element - Element to register
85
+ * @param index - Focus index for this element
86
+ */
87
+ registerFocusable(containerId: string, element: Element, index: number): void;
88
+ /**
89
+ * Unregister a focusable element from a container
90
+ *
91
+ * @param containerId - Container identifier
92
+ * @param index - Focus index to remove
93
+ */
94
+ unregisterFocusable(containerId: string, index: number): void;
95
+ /**
96
+ * Navigate to next or previous focusable element
97
+ *
98
+ * @param containerId - Container identifier
99
+ * @param direction - Navigation direction ('next' or 'previous')
100
+ */
101
+ navigate(containerId: string, direction: 'next' | 'previous'): void;
102
+ /**
103
+ * Set the focus index for a container
104
+ *
105
+ * @param containerId - Container identifier
106
+ * @param index - Focus index to set
107
+ */
108
+ setIndex(containerId: string, index: number): void;
109
+ /**
110
+ * Get the element at a specific index
111
+ *
112
+ * @param containerId - Container identifier
113
+ * @param index - Focus index
114
+ * @returns Element at index or null
115
+ */
116
+ getElement(containerId: string, index: number): Element | null;
117
+ /**
118
+ * Get current focus index for a container
119
+ *
120
+ * @param containerId - Container identifier
121
+ * @returns Current index signal
122
+ */
123
+ getCurrentIndexSignal(containerId: string): Signal<number | null> | null;
124
+ /**
125
+ * Get current focused element signal for a container
126
+ *
127
+ * @param containerId - Container identifier
128
+ * @returns Current element signal
129
+ */
130
+ getFocusedElementSignal(containerId: string): Signal<Element | null> | null;
131
+ /**
132
+ * Check if an element is visible in the viewport
133
+ *
134
+ * @param element - Element to check
135
+ * @param viewport - Viewport to check against (optional)
136
+ * @returns True if element is visible
137
+ */
138
+ isElementVisible(element: Element, viewport?: CanvasViewport): boolean;
139
+ /**
140
+ * Get global bounds of an element
141
+ *
142
+ * @param element - Element to get bounds for
143
+ * @returns Bounds object with x, y, width, height
144
+ */
145
+ getElementBounds(element: Element): {
146
+ x: number;
147
+ y: number;
148
+ width: number;
149
+ height: number;
150
+ };
151
+ /**
152
+ * Scroll viewport to show an element
153
+ *
154
+ * @param containerId - Container identifier
155
+ * @param index - Focus index of element to scroll to
156
+ * @param viewport - Viewport instance (optional, uses container's viewport if not provided)
157
+ * @param options - Scroll options
158
+ */
159
+ scrollToElement(containerId: string, index: number, viewport?: CanvasViewport, options?: ScrollOptions): void;
160
+ /**
161
+ * Animate smooth scrolling
162
+ *
163
+ * @param containerId - Container identifier
164
+ * @param viewport - Viewport instance
165
+ * @param targetX - Target X position
166
+ * @param targetY - Target Y position
167
+ * @param duration - Animation duration in ms
168
+ */
169
+ private animateScroll;
170
+ }
171
+ export declare const focusManager: FocusManager;
172
+ export {};
173
+ //# sourceMappingURL=FocusManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FocusManager.d.ts","sourceRoot":"","sources":["../../src/engine/FocusManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAmB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,UAAU,kBAAkB;IAC1B,EA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YAAY,cAA6B,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { WritableSignal, Signal } from '@signe/reactive';
2
2
  import { Tick } from '../directives/Scheduler';
3
-
4
3
  export interface AnimateOptions<T> {
5
4
  duration?: number;
6
5
  ease?: (t: number) => number;
@@ -1,6 +1,5 @@
1
1
  import { Application, ApplicationOptions } from 'pixi.js';
2
2
  import { ComponentFunction } from './signal';
3
-
4
3
  /**
5
4
  * Extended options for bootstrapCanvas that includes component registration configuration.
6
5
  *
@@ -1,5 +1,4 @@
1
1
  import { Element } from './reactive';
2
-
3
2
  export declare const directives: {
4
3
  [key: string]: any;
5
4
  };
@@ -2,7 +2,6 @@ import { Signal } from '@signe/reactive';
2
2
  import { Observable, Subject, Subscription } from 'rxjs';
3
3
  import { ComponentInstance } from '../components/DisplayObject';
4
4
  import { Directive } from './directive';
5
-
6
5
  export interface Props {
7
6
  [key: string]: any;
8
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reactive.d.ts","sourceRoot":"","sources":["../../src/engine/reactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,MAAM,EAAqF,MAAM,iBAAiB,CAAC;AAEvJ,OAAO,EACL,UAAU,EACV,OAAO,EACP,YAAY,EAab,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAC;AAGxD,MAAM,WAAW,KAAK;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,KAAK,mBAAmB,GAAG;KACxB,GAAG,IAAI,MAAM,GAAG,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC;CACnD,CAAC;AAEF,MAAM,WAAW,OAAO,CAAC,CAAC,GAAG,iBAAiB;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;IACb,iBAAiB,EAAE,CAAC,CAAC;IACrB,iBAAiB,EAAE,YA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EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,CAgZnE;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,CAAC,EACpB,YAAY,EAAE,GAAG,EACjB,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO,GAAG,IAAI,GACnE,cAAc,CAiNhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,IAAI,CAClB,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,EACtD,eAAe,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EACjD,GAAG,oBAAoB,EAAE,KAAK,CAC1B,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,GAClC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAClF,GACA,cAAc,CA4IhB"}
@@ -1,7 +1,6 @@
1
1
  import { Subscription } from 'rxjs';
2
2
  import { Element } from './reactive';
3
3
  import { Tick } from '../directives/Scheduler';
4
-
5
4
  type MountFunction = (fn: (element: Element) => void) => void;
6
5
  export type ComponentFunction<P = {}> = (props: P) => Element | Promise<Element>;
7
6
  export declare let currentSubscriptionsTracker: ((subscription: Subscription) => void) | null;
@@ -1,5 +1,4 @@
1
1
  import { ObservablePoint } from 'pixi.js';
2
-
3
2
  /**
4
3
  * Checks if code is running in a browser environment
5
4
  * @returns {boolean} True if running in browser, false otherwise
@@ -0,0 +1,60 @@
1
+ import { Signal } from '@signe/reactive';
2
+ import { Element } from '../engine/reactive';
3
+ /**
4
+ * Get the current focus index signal for a container
5
+ *
6
+ * Returns a reactive signal that updates when the focus index changes.
7
+ *
8
+ * @param containerId - Container identifier
9
+ * @returns Signal for current focus index, or null if container not found
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const focusIndex = useFocusIndex('myContainer');
14
+ * effect(() => {
15
+ * console.log('Current focus index:', focusIndex?.());
16
+ * });
17
+ * ```
18
+ */
19
+ export declare function useFocusIndex(containerId: string): Signal<number | null> | null;
20
+ /**
21
+ * Get the current focused element signal for a container
22
+ *
23
+ * Returns a reactive signal that updates when the focused element changes.
24
+ *
25
+ * @param containerId - Container identifier
26
+ * @returns Signal for current focused element, or null if container not found
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const focusedElement = useFocusedElement('myContainer');
31
+ * effect(() => {
32
+ * const element = focusedElement?.();
33
+ * if (element) {
34
+ * console.log('Focused element:', element);
35
+ * }
36
+ * });
37
+ * ```
38
+ */
39
+ export declare function useFocusedElement(containerId: string): Signal<Element | null> | null;
40
+ /**
41
+ * Hook to react to focus changes
42
+ *
43
+ * Sets up a reactive effect that calls the callback whenever the focus changes.
44
+ *
45
+ * @param containerId - Container identifier
46
+ * @param callback - Function to call when focus changes
47
+ * @returns Cleanup function to unsubscribe
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * useFocusChange('myContainer', (index, element) => {
52
+ * console.log('Focus changed to index', index);
53
+ * if (element) {
54
+ * console.log('Focused element:', element);
55
+ * }
56
+ * });
57
+ * ```
58
+ */
59
+ export declare function useFocusChange(containerId: string, callback: (index: number | null, element: Element | null) => void): () => void;
60
+ //# sourceMappingURL=useFocus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocus.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAI7C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAE/E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,IAAI,CAEpF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,GAChE,MAAM,IAAI,CAsBZ"}
@@ -1,5 +1,4 @@
1
1
  import { Element } from '../engine/reactive';
2
2
  import { ComponentInstance } from '../components/DisplayObject';
3
-
4
3
  export declare function useRef(element: Element<ComponentInstance>, ref: string): Element<ComponentInstance> | null;
5
4
  //# sourceMappingURL=useRef.d.ts.map