@pixerate/editor-react 0.208.0 → 0.209.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.
@@ -0,0 +1,36 @@
1
+ import { type FocusEvent, type KeyboardEvent } from "react";
2
+ import { type LinkFocusModel, type LinkFocusOptions, type LinkFocusState } from "@pixerate/editor/tools";
3
+ export interface UseLinkFocusOptions extends Partial<LinkFocusOptions> {
4
+ /** Use an existing model instead of creating one from `marks` and `links`. */
5
+ model?: LinkFocusModel;
6
+ }
7
+ /** Handlers for one mark's element: hover and keyboard focus put its key in focus. */
8
+ export interface LinkFocusMarkProps {
9
+ onPointerEnter: () => void;
10
+ onFocus: () => void;
11
+ "data-link-focus": string;
12
+ }
13
+ /** Handlers for the picture's container: arrow keys, Home, End, Escape, and clearing on leave. */
14
+ export interface LinkFocusRootProps {
15
+ onKeyDown: (event: KeyboardEvent) => void;
16
+ onPointerLeave: () => void;
17
+ onBlur: (event: FocusEvent) => void;
18
+ }
19
+ export interface UseLinkFocusResult {
20
+ model: LinkFocusModel;
21
+ state: LinkFocusState;
22
+ /** Spread on a mark's element (the key it focuses: an item or a tag). */
23
+ markProps(key: string): LinkFocusMarkProps;
24
+ /** Spread on the picture's container. */
25
+ rootProps: LinkFocusRootProps;
26
+ /** Opacity for the mark at `index`: 1 when lit, the model's `dim` otherwise. */
27
+ opacity(index: number): number;
28
+ /** The focused key and its links, for a live region. */
29
+ description: string;
30
+ }
31
+ /**
32
+ * Focus across linked marks (#812): creates (or adopts) a `createLinkFocus` model and re-renders on
33
+ * its changes. Hovering or focusing a mark lights it and everything linked to it; arrow keys walk
34
+ * the keys, Escape clears, and leaving the picture (pointer or focus) clears too.
35
+ */
36
+ export declare function useLinkFocus(options: UseLinkFocusOptions): UseLinkFocusResult;
@@ -0,0 +1,36 @@
1
+ import { type FocusEvent, type KeyboardEvent } from "react";
2
+ import { type LinkFocusModel, type LinkFocusOptions, type LinkFocusState } from "@pixerate/editor/tools";
3
+ export interface UseLinkFocusOptions extends Partial<LinkFocusOptions> {
4
+ /** Use an existing model instead of creating one from `marks` and `links`. */
5
+ model?: LinkFocusModel;
6
+ }
7
+ /** Handlers for one mark's element: hover and keyboard focus put its key in focus. */
8
+ export interface LinkFocusMarkProps {
9
+ onPointerEnter: () => void;
10
+ onFocus: () => void;
11
+ "data-link-focus": string;
12
+ }
13
+ /** Handlers for the picture's container: arrow keys, Home, End, Escape, and clearing on leave. */
14
+ export interface LinkFocusRootProps {
15
+ onKeyDown: (event: KeyboardEvent) => void;
16
+ onPointerLeave: () => void;
17
+ onBlur: (event: FocusEvent) => void;
18
+ }
19
+ export interface UseLinkFocusResult {
20
+ model: LinkFocusModel;
21
+ state: LinkFocusState;
22
+ /** Spread on a mark's element (the key it focuses: an item or a tag). */
23
+ markProps(key: string): LinkFocusMarkProps;
24
+ /** Spread on the picture's container. */
25
+ rootProps: LinkFocusRootProps;
26
+ /** Opacity for the mark at `index`: 1 when lit, the model's `dim` otherwise. */
27
+ opacity(index: number): number;
28
+ /** The focused key and its links, for a live region. */
29
+ description: string;
30
+ }
31
+ /**
32
+ * Focus across linked marks (#812): creates (or adopts) a `createLinkFocus` model and re-renders on
33
+ * its changes. Hovering or focusing a mark lights it and everything linked to it; arrow keys walk
34
+ * the keys, Escape clears, and leaving the picture (pointer or focus) clears too.
35
+ */
36
+ export declare function useLinkFocus(options: UseLinkFocusOptions): UseLinkFocusResult;