@abuzareal/contour-ui 0.1.1 → 0.2.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +86 -11
  2. package/CODE_OF_CONDUCT.md +5 -0
  3. package/CONTRIBUTING.md +15 -0
  4. package/NEXTJS.md +51 -0
  5. package/README.md +176 -76
  6. package/RELEASING.md +14 -28
  7. package/SECURITY.md +1 -1
  8. package/dist/components/hero/SceneBoundary.js +1 -0
  9. package/dist/components/hero/Sculpture.js +6 -4
  10. package/dist/components/three/ObjectStudy.js +7 -3
  11. package/dist/components/ui/Alert.js +1 -0
  12. package/dist/components/ui/BrandMark.js +1 -0
  13. package/dist/components/ui/Checkbox.js +1 -0
  14. package/dist/components/ui/CountUp.js +1 -0
  15. package/dist/components/ui/DataTable.js +1 -0
  16. package/dist/components/ui/Dialog.js +1 -0
  17. package/dist/components/ui/DropdownMenu.d.ts +7 -1
  18. package/dist/components/ui/DropdownMenu.js +62 -14
  19. package/dist/components/ui/FlipCard.js +1 -0
  20. package/dist/components/ui/Magnetic.js +1 -0
  21. package/dist/components/ui/Pagination.js +1 -0
  22. package/dist/components/ui/Popover.d.ts +4 -1
  23. package/dist/components/ui/Popover.js +7 -5
  24. package/dist/components/ui/RadioGroup.js +1 -0
  25. package/dist/components/ui/Reveal.js +1 -0
  26. package/dist/components/ui/ScrollProgress.js +1 -0
  27. package/dist/components/ui/SegmentedControl.js +1 -0
  28. package/dist/components/ui/SelectField.d.ts +11 -1
  29. package/dist/components/ui/SelectField.js +6 -4
  30. package/dist/components/ui/Slider.js +1 -0
  31. package/dist/components/ui/Switch.js +1 -0
  32. package/dist/components/ui/Tabs.d.ts +4 -1
  33. package/dist/components/ui/Tabs.js +12 -5
  34. package/dist/components/ui/Tag.js +1 -0
  35. package/dist/components/ui/TextArea.d.ts +8 -1
  36. package/dist/components/ui/TextArea.js +21 -7
  37. package/dist/components/ui/TextField.d.ts +10 -1
  38. package/dist/components/ui/TextField.js +17 -6
  39. package/dist/components/ui/ThemeToggle.js +1 -0
  40. package/dist/components/ui/TiltCard.js +1 -0
  41. package/dist/components/ui/ToastProvider.js +1 -0
  42. package/dist/components/ui/Tooltip.js +1 -0
  43. package/dist/fonts/dm-mono-LICENSE.txt +93 -0
  44. package/dist/fonts/dm-mono-latin-400-normal.woff2 +0 -0
  45. package/dist/fonts/dm-sans-LICENSE.txt +93 -0
  46. package/dist/fonts/dm-sans-latin-wght-normal.woff2 +0 -0
  47. package/dist/fonts/space-grotesk-LICENSE.txt +93 -0
  48. package/dist/fonts/space-grotesk-latin-wght-normal.woff2 +0 -0
  49. package/dist/fonts-latin.css +35 -0
  50. package/dist/hooks/useClipboardCopy.js +1 -0
  51. package/dist/hooks/useControlRef.d.ts +6 -0
  52. package/dist/hooks/useControlRef.js +13 -0
  53. package/dist/hooks/useDismiss.js +1 -0
  54. package/dist/hooks/useFormReset.d.ts +3 -0
  55. package/dist/hooks/useFormReset.js +31 -0
  56. package/dist/hooks/useHeaderScroll.js +1 -0
  57. package/dist/hooks/useIdleTrigger.js +1 -0
  58. package/dist/hooks/useInitialHashScroll.js +1 -0
  59. package/dist/hooks/useMobileMenu.js +1 -0
  60. package/dist/hooks/useMotionPreference.js +1 -0
  61. package/dist/hooks/useOpenState.d.ts +2 -0
  62. package/dist/hooks/useOpenState.js +15 -0
  63. package/dist/hooks/usePrintPreparation.js +1 -0
  64. package/dist/hooks/useScrollSpy.js +1 -0
  65. package/dist/hooks/useSmoothScroll.js +1 -0
  66. package/dist/hooks/useTheme.js +1 -0
  67. package/dist/hooks/useThreeStage.d.ts +4 -0
  68. package/dist/hooks/useThreeStage.js +165 -128
  69. package/dist/hooks/useToast.js +1 -0
  70. package/package.json +29 -12
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The DM Mono Project Authors (https://www.github.com/googlefonts/dm-mono) DMMono-LightItalic.ttf: Copyright 2020 The DM Mono Project Authors (https://www.github.com/googlefonts/dm-mono) DMMono-Regular.ttf: Copyright 2020 The DM Mono Project Authors (https://www.github.com/googlefonts/dm-mono) DMMono-Italic.ttf: Copyright 2020 The DM Mono Project Authors (https://www.github.com/googlefonts/dm-mono) DMMono-Medium.ttf: Copyright 2020 The DM Mono Project Authors (https://www.github.com/googlefonts/dm-mono) DMMono-MediumItalic.ttf: Copyright 2020 The DM Mono Project Authors (https://www.github.com/googlefonts/dm-mono)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2014 The DM Sans Project Authors (https://github.com/googlefonts/dm-fonts) DMSans-Italic[opsz,wght].ttf: Copyright 2014 The DM Sans Project Authors (https://github.com/googlefonts/dm-fonts)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The Space Grotesk Project Authors (https://github.com/floriankarsten/space-grotesk)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,35 @@
1
+ /* Optional Latin-only WOFF2 fonts. Use fonts.css for the complete character sets. */
2
+ @font-face {
3
+ font-family: "DM Sans Variable";
4
+ font-style: normal;
5
+ font-display: swap;
6
+ font-weight: 100 1000;
7
+ src: url("./fonts/dm-sans-latin-wght-normal.woff2")
8
+ format("woff2-variations");
9
+ unicode-range:
10
+ U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
11
+ U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
12
+ U+2215, U+FEFF, U+FFFD;
13
+ }
14
+
15
+ @font-face {
16
+ font-family: "Space Grotesk Variable";
17
+ font-style: normal;
18
+ font-display: swap;
19
+ font-weight: 300 700;
20
+ src: url("./fonts/space-grotesk-latin-wght-normal.woff2")
21
+ format("woff2-variations");
22
+ unicode-range:
23
+ U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
24
+ U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
25
+ U+2215, U+FEFF, U+FFFD;
26
+ }
27
+
28
+ @font-face {
29
+ font-family: "DM Mono";
30
+ font-style: normal;
31
+ font-display: swap;
32
+ font-weight: 400;
33
+ src: url("./fonts/dm-mono-latin-400-normal.woff2")
34
+ format("woff2");
35
+ }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Copies text to the clipboard and reports the outcome, resetting after a few seconds. */
2
3
  import { useCallback, useEffect, useRef, useState } from "react";
3
4
  const resetDelay = 4000;
@@ -0,0 +1,6 @@
1
+ import { type ForwardedRef } from "react";
2
+ /** Expose the native control while retaining an internal ref for reset/size behavior. */
3
+ export default function useControlRef<T extends HTMLElement>(forwarded: ForwardedRef<T>): {
4
+ ref: import("react").MutableRefObject<T | null>;
5
+ attach: import("react").MutableRefObject<T | null>;
6
+ };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { useImperativeHandle, useRef } from "react";
3
+ /** Expose the native control while retaining an internal ref for reset/size behavior. */
4
+ export default function useControlRef(forwarded) {
5
+ const ref = useRef(null);
6
+ useImperativeHandle(forwarded, () => {
7
+ const element = ref.current;
8
+ if (!element)
9
+ throw new Error("The field control must be mounted before exposing its ref.");
10
+ return element;
11
+ });
12
+ return { ref, attach: ref };
13
+ }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Calls onDismiss on Escape or a pointer press outside the container while `active`. */
2
3
  import { useEffect } from "react";
3
4
  export default function useDismiss(container, active, onDismiss) {
@@ -0,0 +1,3 @@
1
+ import { type RefObject } from "react";
2
+ /** Native reset fires before the browser restores default values. */
3
+ export default function useFormReset<T extends HTMLInputElement | HTMLTextAreaElement>(ref: RefObject<T | null>, sync: () => void): void;
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { useEffect, useLayoutEffect, useRef } from "react";
3
+ /** Native reset fires before the browser restores default values. */
4
+ export default function useFormReset(ref, sync) {
5
+ const synchronize = useRef(sync);
6
+ useLayoutEffect(() => {
7
+ synchronize.current = sync;
8
+ });
9
+ useEffect(() => {
10
+ const element = ref.current;
11
+ if (!element)
12
+ return;
13
+ let timer;
14
+ const reset = (event) => {
15
+ if (!element.form || event.target !== element.form)
16
+ return;
17
+ clearTimeout(timer);
18
+ // A microtask can run before the reset default action for browser-originated
19
+ // events. A task observes the restored value and later preventDefault calls.
20
+ timer = setTimeout(() => {
21
+ if (!event.defaultPrevented)
22
+ synchronize.current();
23
+ }, 0);
24
+ };
25
+ element.ownerDocument.addEventListener("reset", reset, true);
26
+ return () => {
27
+ clearTimeout(timer);
28
+ element.ownerDocument.removeEventListener("reset", reset, true);
29
+ };
30
+ }, [ref]);
31
+ }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Derives header state from scroll position: scrolled, over a dark area, and the active section. */
2
3
  import { useEffect, useState } from "react";
3
4
  /** Fraction of the viewport height at which a section becomes "current". */
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Becomes true once the browser is idle after `enabled` turns on; used to defer heavy work. */
2
3
  import { useEffect, useState } from "react";
3
4
  const idleTimeout = 1200;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Scrolls to the URL fragment after first render; the section does not exist yet when the browser first tries. */
2
3
  import { useEffect } from "react";
3
4
  const userScrollEvents = ["wheel", "touchstart", "keydown"];
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Open state for the mobile menu, closing on Escape, outside pointer, or desktop resize. */
2
3
  import { useEffect, useState } from "react";
3
4
  const desktopQuery = "(min-width: 768px)";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Tracks the user's `prefers-reduced-motion` setting and updates when it changes. */
2
3
  import { useEffect, useState } from "react";
3
4
  const query = "(prefers-reduced-motion: reduce)";
@@ -0,0 +1,2 @@
1
+ /** Controlled and uncontrolled disclosure state share the same change contract. */
2
+ export default function useOpenState(open: boolean | undefined, defaultOpen: boolean, onOpenChange?: (open: boolean) => void): readonly [boolean, (next: boolean) => void];
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { useCallback, useState } from "react";
3
+ /** Controlled and uncontrolled disclosure state share the same change contract. */
4
+ export default function useOpenState(open, defaultOpen, onOpenChange) {
5
+ const [internalOpen, setInternalOpen] = useState(defaultOpen);
6
+ const current = open ?? internalOpen;
7
+ const change = useCallback((next) => {
8
+ if (next === current)
9
+ return;
10
+ if (open === undefined)
11
+ setInternalOpen(next);
12
+ onOpenChange?.(next);
13
+ }, [current, open, onOpenChange]);
14
+ return [current, change];
15
+ }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Prints the full page: opens collapsed disclosures and uses the light theme, then restores both. */
2
3
  import { useEffect } from "react";
3
4
  export default function usePrintPreparation() {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Returns the id of the last listed element whose top has scrolled past the activation line. */
2
3
  import { useEffect, useState } from "react";
3
4
  /** Fraction of the viewport height at which an element becomes "current". */
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Enables Lenis smooth scrolling (and animated anchor jumps) while motion is allowed. */
2
3
  import { useEffect } from "react";
3
4
  import Lenis from "lenis";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Light/dark theme state: persisted choice, system fallback, and the animated switch. */
2
3
  import { useCallback, useEffect, useSyncExternalStore } from "react";
3
4
  import { flushSync } from "react-dom";
@@ -12,11 +12,15 @@ export type StageScene = {
12
12
  /** Snaps to a still pose when motion is turned off. */
13
13
  rest: () => void;
14
14
  dispose: () => void;
15
+ /** Reflows the still or animated scene after the camera aspect changes. */
16
+ resize?: () => void;
15
17
  };
16
18
  export type StageContext = {
17
19
  scene: THREE.Scene;
18
20
  camera: THREE.PerspectiveCamera;
19
21
  renderer: THREE.WebGLRenderer;
22
+ /** Register resources immediately, including those allocated before setup returns. */
23
+ onDispose?: (cleanup: () => void) => void;
20
24
  };
21
25
  type StageOptions = {
22
26
  motionEnabled: boolean;