canvasengine 2.0.0-beta.41 → 2.0.0-beta.43
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/dist/{DebugRenderer-BxfW34YG.js → DebugRenderer-K2IZBznP.js} +2 -2
- package/dist/{DebugRenderer-BxfW34YG.js.map → DebugRenderer-K2IZBznP.js.map} +1 -1
- package/dist/components/Button.d.ts +3 -0
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/DOMElement.d.ts.map +1 -1
- package/dist/components/Graphic.d.ts +1 -1
- package/dist/components/Graphic.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/types/DisplayObject.d.ts +12 -16
- package/dist/components/types/DisplayObject.d.ts.map +1 -1
- package/dist/directives/FocusNavigation.d.ts +71 -0
- package/dist/directives/FocusNavigation.d.ts.map +1 -0
- package/dist/directives/KeyboardControls.d.ts.map +1 -1
- package/dist/directives/ViewportFollow.d.ts.map +1 -1
- package/dist/engine/FocusManager.d.ts +174 -0
- package/dist/engine/FocusManager.d.ts.map +1 -0
- package/dist/engine/bootstrap.d.ts +33 -1
- package/dist/engine/bootstrap.d.ts.map +1 -1
- package/dist/engine/reactive.d.ts +20 -0
- package/dist/engine/reactive.d.ts.map +1 -1
- package/dist/hooks/useFocus.d.ts +61 -0
- package/dist/hooks/useFocus.d.ts.map +1 -0
- package/dist/{index-BnuKipxl.js → index-B4hYyfVE.js} +5479 -4677
- package/dist/index-B4hYyfVE.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.global.js +7 -7
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +70 -63
- package/package.json +2 -2
- package/src/components/Button.ts +7 -4
- package/src/components/Canvas.ts +1 -1
- package/src/components/DOMContainer.ts +27 -2
- package/src/components/DOMElement.ts +37 -29
- package/src/components/DisplayObject.ts +15 -3
- package/src/components/FocusContainer.ts +372 -0
- package/src/components/Graphic.ts +43 -48
- package/src/components/Sprite.ts +4 -2
- package/src/components/Viewport.ts +65 -26
- package/src/components/index.ts +2 -1
- package/src/components/types/DisplayObject.ts +7 -4
- package/src/directives/Controls.ts +1 -1
- package/src/directives/ControlsBase.ts +1 -1
- package/src/directives/FocusNavigation.ts +252 -0
- package/src/directives/KeyboardControls.ts +12 -8
- package/src/directives/ViewportFollow.ts +8 -5
- package/src/engine/FocusManager.ts +495 -0
- package/src/engine/bootstrap.ts +69 -2
- package/src/engine/reactive.ts +54 -18
- package/src/hooks/useFocus.ts +94 -0
- package/src/index.ts +3 -0
- package/dist/index-BnuKipxl.js.map +0 -1
|
@@ -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,
|
|
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,EAcb,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,iBAAi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,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"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Signal } from '@signe/reactive';
|
|
2
|
+
import { Element } from '../engine/reactive';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get the current focus index signal for a container
|
|
6
|
+
*
|
|
7
|
+
* Returns a reactive signal that updates when the focus index changes.
|
|
8
|
+
*
|
|
9
|
+
* @param containerId - Container identifier
|
|
10
|
+
* @returns Signal for current focus index, or null if container not found
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const focusIndex = useFocusIndex('myContainer');
|
|
15
|
+
* effect(() => {
|
|
16
|
+
* console.log('Current focus index:', focusIndex?.());
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function useFocusIndex(containerId: string): Signal<number | null> | null;
|
|
21
|
+
/**
|
|
22
|
+
* Get the current focused element signal for a container
|
|
23
|
+
*
|
|
24
|
+
* Returns a reactive signal that updates when the focused element changes.
|
|
25
|
+
*
|
|
26
|
+
* @param containerId - Container identifier
|
|
27
|
+
* @returns Signal for current focused element, or null if container not found
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const focusedElement = useFocusedElement('myContainer');
|
|
32
|
+
* effect(() => {
|
|
33
|
+
* const element = focusedElement?.();
|
|
34
|
+
* if (element) {
|
|
35
|
+
* console.log('Focused element:', element);
|
|
36
|
+
* }
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function useFocusedElement(containerId: string): Signal<Element | null> | null;
|
|
41
|
+
/**
|
|
42
|
+
* Hook to react to focus changes
|
|
43
|
+
*
|
|
44
|
+
* Sets up a reactive effect that calls the callback whenever the focus changes.
|
|
45
|
+
*
|
|
46
|
+
* @param containerId - Container identifier
|
|
47
|
+
* @param callback - Function to call when focus changes
|
|
48
|
+
* @returns Cleanup function to unsubscribe
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* useFocusChange('myContainer', (index, element) => {
|
|
53
|
+
* console.log('Focus changed to index', index);
|
|
54
|
+
* if (element) {
|
|
55
|
+
* console.log('Focused element:', element);
|
|
56
|
+
* }
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function useFocusChange(containerId: string, callback: (index: number | null, element: Element | null) => void): () => void;
|
|
61
|
+
//# 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"}
|