@aznabee/freehand-ui 0.1.1

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,66 @@
1
+ import type {
2
+ ComponentPropsWithoutRef,
3
+ ElementType,
4
+ ReactNode,
5
+ Ref,
6
+ RefObject,
7
+ } from "react";
8
+ import type { DoodleOptions } from "./index";
9
+
10
+ export type {
11
+ DoodleOptions,
12
+ DoodleInstance,
13
+ DoodlePosition,
14
+ DecorationType,
15
+ NoteOptions,
16
+ ArrowOptions,
17
+ DecorationOptions,
18
+ BreakOptions,
19
+ } from "./index";
20
+
21
+ type DoodleOptionProps = Omit<DoodleOptions, "children">;
22
+
23
+ export interface DoodleOwnProps extends DoodleOptionProps {
24
+ children?: ReactNode;
25
+ /** Wrapper element to render. Default `"span"`. */
26
+ as?: ElementType;
27
+ /** Skip drawing entirely — useful for reduced-motion or feature flags. */
28
+ disabled?: boolean;
29
+ /**
30
+ * Selector for decorating descendants instead of the wrapper as a whole.
31
+ * Maps to the core's `children` option, which `children` already shadows on
32
+ * a React component.
33
+ */
34
+ childSelector?: string | null;
35
+ }
36
+
37
+ export type DoodleProps<T extends ElementType = "span"> = DoodleOwnProps &
38
+ Omit<ComponentPropsWithoutRef<T>, keyof DoodleOwnProps> & {
39
+ ref?: Ref<Element>;
40
+ };
41
+
42
+ /**
43
+ * Wrap any component in a hand-drawn doodle layer.
44
+ *
45
+ * ```tsx
46
+ * <Doodle note="start chat" strokeWidth={2}>
47
+ * <Button />
48
+ * </Doodle>
49
+ * ```
50
+ *
51
+ * The doodle is drawn around the wrapper as a whole; children are never
52
+ * decorated individually unless you opt in with `childSelector`.
53
+ */
54
+ declare const Doodle: <T extends ElementType = "span">(
55
+ props: DoodleProps<T>
56
+ ) => JSX.Element;
57
+
58
+ export default Doodle;
59
+ export { Doodle };
60
+
61
+ /** Draw a doodle around an element you already hold a ref to. */
62
+ export function useDoodle(
63
+ ref: RefObject<Element | null>,
64
+ options?: DoodleOptions,
65
+ enabled?: boolean
66
+ ): void;