@teo-garcia/react-shared 1.2.1 → 1.3.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.
- package/README.md +138 -136
- package/dist/components/client-only/client-only.d.ts +11 -0
- package/dist/components/client-only/client-only.d.ts.map +1 -0
- package/dist/components/client-only/client-only.js +17 -0
- package/dist/components/client-only/index.d.ts +2 -0
- package/dist/components/client-only/index.d.ts.map +1 -0
- package/dist/components/client-only/index.js +1 -0
- package/dist/components/dev-panel/dev-panel-features.d.ts +10 -0
- package/dist/components/dev-panel/dev-panel-features.d.ts.map +1 -0
- package/dist/components/dev-panel/dev-panel-features.js +29 -0
- package/dist/components/dev-panel/dev-panel.d.ts +15 -17
- package/dist/components/dev-panel/dev-panel.d.ts.map +1 -1
- package/dist/components/dev-panel/dev-panel.js +619 -99
- package/dist/components/dev-panel/index.d.ts +1 -1
- package/dist/components/dev-panel/index.d.ts.map +1 -1
- package/dist/components/dev-panel/index.js +1 -1
- package/dist/components/dev-panel/use-dev-panel-diagnostics.d.ts +39 -0
- package/dist/components/dev-panel/use-dev-panel-diagnostics.d.ts.map +1 -0
- package/dist/components/dev-panel/use-dev-panel-diagnostics.js +384 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/separator/separator.d.ts +4 -4
- package/dist/components/separator/separator.d.ts.map +1 -1
- package/dist/components/separator/separator.js +18 -6
- package/dist/components/skeleton/skeleton.d.ts +1 -1
- package/dist/components/skeleton/skeleton.d.ts.map +1 -1
- package/dist/components/skeleton/skeleton.js +19 -4
- package/dist/components/skip-link/skip-link.d.ts.map +1 -1
- package/dist/components/skip-link/skip-link.js +8 -5
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/use-breakpoint.d.ts +9 -0
- package/dist/hooks/use-breakpoint.d.ts.map +1 -0
- package/dist/hooks/use-breakpoint.js +47 -0
- package/dist/index.d.ts +2 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -7
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -2,197 +2,199 @@
|
|
|
2
2
|
|
|
3
3
|
# @teo-garcia/react-shared
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Self-contained React hooks, components, dev helpers, and test utilities.
|
|
6
6
|
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
[](https://www.npmjs.com/package/@teo-garcia/react-shared)
|
|
9
9
|
[](https://react.dev)
|
|
10
10
|
|
|
11
|
-
Part of the [@teo-garcia/templates](https://github.com/teo-garcia/templates)
|
|
12
|
-
ecosystem
|
|
13
|
-
|
|
14
11
|
</div>
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
`@teo-garcia/react-shared` is the React-specific shared library in the template
|
|
14
|
+
portfolio. It is intentionally narrow:
|
|
15
|
+
|
|
16
|
+
- useful React/browser primitives
|
|
17
|
+
- accessibility helpers
|
|
18
|
+
- dev-only diagnostics
|
|
19
|
+
- test utilities
|
|
20
|
+
- no design-system components
|
|
21
|
+
- no consumer Tailwind scanning or `@source` setup
|
|
22
|
+
|
|
23
|
+
If a future helper is framework-agnostic, it will likely move into a separate
|
|
24
|
+
general-purpose package later instead of growing this package sideways.
|
|
17
25
|
|
|
18
26
|
## Requirements
|
|
19
27
|
|
|
20
28
|
- React 19+
|
|
21
29
|
- TypeScript
|
|
22
|
-
-
|
|
30
|
+
- `@tanstack/react-query` only if you use the test wrapper helpers
|
|
31
|
+
- `@testing-library/react` only if you use the test utilities
|
|
23
32
|
|
|
24
33
|
## Installation
|
|
25
34
|
|
|
26
35
|
```bash
|
|
27
36
|
pnpm add @teo-garcia/react-shared
|
|
28
37
|
|
|
29
|
-
# Optional
|
|
38
|
+
# Optional peer deps for test utilities
|
|
30
39
|
pnpm add @tanstack/react-query
|
|
31
|
-
|
|
32
|
-
# Optional: test utilities
|
|
33
40
|
pnpm add -D @testing-library/react
|
|
34
41
|
```
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
## Design Principles
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
- self-contained runtime styling for shared UI primitives
|
|
46
|
+
- no dependency on Tailwind in consuming apps
|
|
47
|
+
- components should work alongside Tailwind, Material UI, shadcn/ui, or custom
|
|
48
|
+
UI
|
|
49
|
+
- prefer primitives and utilities over opinionated widgets
|
|
50
|
+
- dev-only helpers should disappear in production
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
| --------------------------------- | ---------------------------------------------------------------------------------------------- |
|
|
44
|
-
| `useDebounce(value, delay)` | Returns a debounced copy of `value` that updates after `delay` ms of inactivity |
|
|
45
|
-
| `useLocalStorage(key, initial)` | `localStorage`-backed state as a tuple `[value, set, remove]`. Returns `initial` on the server |
|
|
46
|
-
| `useMediaQuery(query)` | Tracks a CSS media query. Returns `false` on the server |
|
|
47
|
-
| `useOnClickOutside(ref, handler)` | Fires `handler` on `mousedown`/`touchstart` outside the given ref |
|
|
48
|
-
| `usePrevious(value)` | Returns the previous render's value of a state or prop |
|
|
49
|
-
| `useIsomorphicLayoutEffect` | `useLayoutEffect` on the client, `useEffect` on the server — eliminates SSR warnings |
|
|
50
|
-
|
|
51
|
-
Import paths: `@teo-garcia/react-shared/hooks/<hook-name>`
|
|
52
|
+
## Hooks
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
All hooks are SSR-safe unless their entire purpose is browser-only runtime
|
|
55
|
+
state.
|
|
56
|
+
|
|
57
|
+
| Hook | Description |
|
|
58
|
+
| --------------------------- | -------------------------------------------------------------------------- |
|
|
59
|
+
| `useBreakpoint` | Returns `{ breakpoint, width, height }` from a configurable breakpoint map |
|
|
60
|
+
| `useCopyToClipboard` | Copies text and reports copy state |
|
|
61
|
+
| `useDebounce` | Returns a debounced copy of a value |
|
|
62
|
+
| `useEventListener` | Typed event listener hook for `window`, `document`, and elements |
|
|
63
|
+
| `useIdle` | Tracks user idle state |
|
|
64
|
+
| `useIntersectionObserver` | Tracks element visibility/intersection |
|
|
65
|
+
| `useIsomorphicLayoutEffect` | `useLayoutEffect` on the client, `useEffect` on the server |
|
|
66
|
+
| `useLatest` | Keeps a stable ref to the latest value |
|
|
67
|
+
| `useLocalStorage` | `localStorage`-backed state |
|
|
68
|
+
| `useMediaQuery` | Tracks a CSS media query |
|
|
69
|
+
| `useNetworkStatus` | Tracks online/offline state |
|
|
70
|
+
| `useOnClickOutside` | Calls a handler when interaction happens outside a ref |
|
|
71
|
+
| `usePrevious` | Returns the previous render value |
|
|
72
|
+
| `useRenderCount` | Counts renders for debugging |
|
|
73
|
+
| `useToggle` | Small boolean state helper |
|
|
74
|
+
| `useWhyDidYouRender` | Dev helper for prop-change inspection |
|
|
75
|
+
|
|
76
|
+
Primary imports:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { useBreakpoint, useToggle } from '@teo-garcia/react-shared/hooks'
|
|
80
|
+
import { useBreakpoint } from '@teo-garcia/react-shared/hooks/use-breakpoint'
|
|
81
|
+
```
|
|
54
82
|
|
|
55
83
|
## Components
|
|
56
84
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Catches thrown errors in child trees and renders a fallback. Supports four
|
|
60
|
-
fallback patterns, auto-reset on prop changes, and focus-restoring "Try again"
|
|
61
|
-
in the default UI.
|
|
62
|
-
|
|
63
|
-
| Prop | Type | Description |
|
|
64
|
-
| ------------------- | --------------------------------------------- | ---------------------------------------------------------------------- |
|
|
65
|
-
| `FallbackComponent` | `ComponentType<{ error, resetError }>` | Highest-priority fallback — receives the error and a reset callback |
|
|
66
|
-
| `fallbackRender` | `(props: { error, resetError }) => ReactNode` | Render-prop fallback |
|
|
67
|
-
| `fallback` | `ReactNode \| (error) => ReactNode` | Static element or function fallback |
|
|
68
|
-
| `resetKeys` | `unknown[]` | When any value in the array changes, the boundary resets automatically |
|
|
69
|
-
| `onError` | `(error, errorInfo) => void` | Called after every caught error — use for logging or tracking |
|
|
70
|
-
| `onReset` | `() => void` | Called whenever the boundary resets |
|
|
71
|
-
|
|
72
|
-
Import path: `@teo-garcia/react-shared/components/error-boundary`
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
### `VisuallyHidden`
|
|
77
|
-
|
|
78
|
-
Renders content that is invisible on screen but fully accessible to assistive
|
|
79
|
-
technologies. Zero dependencies, RSC-safe, no Tailwind required.
|
|
80
|
-
|
|
81
|
-
Use for: icon-only button labels, skip-navigation links, form hints,
|
|
82
|
-
screen-reader-only status messages.
|
|
85
|
+
These are intentionally utility-oriented and design-system agnostic.
|
|
83
86
|
|
|
84
|
-
|
|
87
|
+
### Runtime primitives
|
|
85
88
|
|
|
86
|
-
|
|
89
|
+
- `AspectRatio`
|
|
90
|
+
- `ClientOnly`
|
|
91
|
+
- `ErrorBoundary`
|
|
92
|
+
- `FocusTrap`
|
|
93
|
+
- `Portal`
|
|
94
|
+
- `VisuallyHidden`
|
|
87
95
|
|
|
88
|
-
###
|
|
96
|
+
### Utility UI
|
|
89
97
|
|
|
90
|
-
|
|
91
|
-
`
|
|
98
|
+
- `Separator`
|
|
99
|
+
- `Skeleton`
|
|
100
|
+
- `SkipLink`
|
|
92
101
|
|
|
93
|
-
|
|
94
|
-
stubs.
|
|
102
|
+
### Dev-only helpers
|
|
95
103
|
|
|
96
|
-
|
|
104
|
+
- `DebugJSON`
|
|
105
|
+
- `DevPanel`
|
|
97
106
|
|
|
98
|
-
|
|
107
|
+
Notes:
|
|
99
108
|
|
|
100
|
-
|
|
109
|
+
- `ClientOnly` renders a fallback on the server and swaps to client content
|
|
110
|
+
after hydration.
|
|
111
|
+
- `Skeleton`, `Separator`, and `SkipLink` are self-styled and do not require
|
|
112
|
+
Tailwind.
|
|
113
|
+
- `DevPanel` is self-contained, remembers collapsed state, and exposes `items`
|
|
114
|
+
plus `children` for custom diagnostics. By default it enables every built-in
|
|
115
|
+
diagnostic (`ALL_DEV_PANEL_FEATURES`); pass `features={[]}` for viewport,
|
|
116
|
+
breakpoint, and theme only.
|
|
101
117
|
|
|
102
|
-
|
|
103
|
-
`createPortal`. SSR-safe — returns `null` until mounted. Treats
|
|
104
|
-
`container={null}` as "not ready" and defers rendering, which pairs cleanly with
|
|
105
|
-
`useRef`.
|
|
118
|
+
Primary imports:
|
|
106
119
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
Traps keyboard focus within its container while `active`. Tab wraps from last to
|
|
117
|
-
first element; Shift+Tab wraps from first to last. Restores focus to the
|
|
118
|
-
previously focused element on deactivation or unmount.
|
|
119
|
-
|
|
120
|
-
Use for: modals, dialogs, drawers, dropdowns — any overlay where focus must not
|
|
121
|
-
escape.
|
|
122
|
-
|
|
123
|
-
| Prop | Type | Default | Description |
|
|
124
|
-
| -------------- | --------- | ------- | ----------------------------------------------- |
|
|
125
|
-
| `active` | `boolean` | `true` | Enables or disables the trap |
|
|
126
|
-
| `initialFocus` | `boolean` | `true` | Focuses the first focusable child on activation |
|
|
127
|
-
|
|
128
|
-
Import path: `@teo-garcia/react-shared/components/focus-trap`
|
|
129
|
-
|
|
130
|
-
---
|
|
120
|
+
```tsx
|
|
121
|
+
import {
|
|
122
|
+
ClientOnly,
|
|
123
|
+
DevPanel,
|
|
124
|
+
SkipLink,
|
|
125
|
+
} from '@teo-garcia/react-shared/components'
|
|
126
|
+
import { DevPanel } from '@teo-garcia/react-shared/components/dev-panel'
|
|
127
|
+
```
|
|
131
128
|
|
|
132
129
|
## Utilities
|
|
133
130
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
131
|
+
| Utility | Description |
|
|
132
|
+
| -------------- | ------------------------------------------------------------------------------------- |
|
|
133
|
+
| `cn` | `clsx` + `tailwind-merge` for Tailwind-heavy apps that want class conflict resolution |
|
|
134
|
+
| `formatDate` | Small date formatting helper |
|
|
135
|
+
| `formatNumber` | Number formatting helper |
|
|
136
|
+
| `truncate` | String truncation helper |
|
|
138
137
|
|
|
139
|
-
|
|
138
|
+
`cn` is kept because it is broadly useful in Tailwind apps, but the package
|
|
139
|
+
itself does not require Tailwind to function.
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
## Test Utilities
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
| Export | Description |
|
|
144
|
+
| ----------------------------------- | --------------------------------------------------- |
|
|
145
|
+
| `createWrapper(options?)` | Creates a reusable `QueryClientProvider` wrapper |
|
|
146
|
+
| `renderWithProviders(ui, options?)` | Convenience wrapper around Testing Library `render` |
|
|
144
147
|
|
|
145
|
-
|
|
148
|
+
Import path:
|
|
146
149
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
```ts
|
|
151
|
+
import {
|
|
152
|
+
createWrapper,
|
|
153
|
+
renderWithProviders,
|
|
154
|
+
} from '@teo-garcia/react-shared/test-utils'
|
|
155
|
+
```
|
|
151
156
|
|
|
152
|
-
|
|
153
|
-
|
|
157
|
+
## DevPanel Example
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
import { DevPanel } from '@teo-garcia/react-shared/components/dev-panel'
|
|
161
|
+
;<DevPanel
|
|
162
|
+
items={[
|
|
163
|
+
{ label: 'route', value: pathname },
|
|
164
|
+
{ label: 'tenant', value: tenantId ?? 'none' },
|
|
165
|
+
]}
|
|
166
|
+
>
|
|
167
|
+
<span>feature-x</span>
|
|
168
|
+
</DevPanel>
|
|
169
|
+
```
|
|
154
170
|
|
|
155
|
-
|
|
171
|
+
With no `features` prop, every built-in diagnostic is enabled (see export
|
|
172
|
+
`ALL_DEV_PANEL_FEATURES`). Pass `features={[]}` for viewport, breakpoint, and
|
|
173
|
+
theme only. Import `ALL_DEV_PANEL_FEATURES` when you need the full list to build
|
|
174
|
+
a custom subset.
|
|
156
175
|
|
|
157
|
-
|
|
176
|
+
## Export Paths
|
|
158
177
|
|
|
159
|
-
|
|
178
|
+
- `@teo-garcia/react-shared`
|
|
179
|
+
- `@teo-garcia/react-shared/components`
|
|
180
|
+
- `@teo-garcia/react-shared/hooks`
|
|
181
|
+
- `@teo-garcia/react-shared/utils`
|
|
182
|
+
- `@teo-garcia/react-shared/test-utils`
|
|
183
|
+
- focused subpaths such as `components/dev-panel` and `hooks/use-breakpoint`
|
|
160
184
|
|
|
161
|
-
|
|
162
|
-
| ------------------------------------------------------------- | -------------------------------------- |
|
|
163
|
-
| `@teo-garcia/react-shared/components` | All components (barrel) |
|
|
164
|
-
| `@teo-garcia/react-shared/components/error-boundary` | `ErrorBoundary`, `FallbackProps` |
|
|
165
|
-
| `@teo-garcia/react-shared/components/focus-trap` | `FocusTrap` |
|
|
166
|
-
| `@teo-garcia/react-shared/components/portal` | `Portal` |
|
|
167
|
-
| `@teo-garcia/react-shared/components/skeleton` | `Skeleton` |
|
|
168
|
-
| `@teo-garcia/react-shared/components/visually-hidden` | `VisuallyHidden` |
|
|
169
|
-
| `@teo-garcia/react-shared/hooks` | All hooks (barrel) |
|
|
170
|
-
| `@teo-garcia/react-shared/hooks/use-debounce` | `useDebounce` |
|
|
171
|
-
| `@teo-garcia/react-shared/hooks/use-isomorphic-layout-effect` | `useIsomorphicLayoutEffect` |
|
|
172
|
-
| `@teo-garcia/react-shared/hooks/use-local-storage` | `useLocalStorage` |
|
|
173
|
-
| `@teo-garcia/react-shared/hooks/use-media-query` | `useMediaQuery` |
|
|
174
|
-
| `@teo-garcia/react-shared/hooks/use-on-click-outside` | `useOnClickOutside` |
|
|
175
|
-
| `@teo-garcia/react-shared/hooks/use-previous` | `usePrevious` |
|
|
176
|
-
| `@teo-garcia/react-shared/utils/cn` | `cn` |
|
|
177
|
-
| `@teo-garcia/react-shared/test-utils` | `createWrapper`, `renderWithProviders` |
|
|
185
|
+
## Scope Boundary
|
|
178
186
|
|
|
179
|
-
|
|
187
|
+
This package should stay React-focused and utility-oriented. It should not grow
|
|
188
|
+
into:
|
|
180
189
|
|
|
181
|
-
|
|
190
|
+
- a design system
|
|
191
|
+
- a component kit for a specific styling stack
|
|
192
|
+
- a dumping ground for framework-agnostic helpers
|
|
193
|
+
- a Nest/shared backend package
|
|
182
194
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
| [@teo-garcia/eslint-config-shared](https://github.com/teo-garcia/eslint-config-shared) | ESLint rules |
|
|
186
|
-
| [@teo-garcia/prettier-config-shared](https://github.com/teo-garcia/prettier-config-shared) | Prettier formatting |
|
|
187
|
-
| [@teo-garcia/tsconfig-shared](https://github.com/teo-garcia/tsconfig-shared) | TypeScript settings |
|
|
188
|
-
| [@teo-garcia/vitest-config-shared](https://github.com/teo-garcia/vitest-config-shared) | Test configuration |
|
|
195
|
+
Those concerns can split later into dedicated packages when the surface area is
|
|
196
|
+
clear enough.
|
|
189
197
|
|
|
190
198
|
## License
|
|
191
199
|
|
|
192
200
|
MIT
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
<div align="center">
|
|
197
|
-
<sub>Built by <a href="https://github.com/teo-garcia">teo-garcia</a></sub>
|
|
198
|
-
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface ClientOnlyProps {
|
|
3
|
+
children: ReactNode | (() => ReactNode);
|
|
4
|
+
fallback?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Renders fallback content on the server and swaps to client-only content after
|
|
8
|
+
* hydration. Useful for anything that depends on browser APIs or mounted state.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ClientOnly({ children, fallback }: ClientOnlyProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=client-only.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-only.d.ts","sourceRoot":"","sources":["../../../src/components/client-only/client-only.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAE3D,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,SAAS,GAAG,CAAC,MAAM,SAAS,CAAC,CAAA;IACvC,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,QAAe,EAAE,EAAE,eAAe,2CAYxE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Renders fallback content on the server and swaps to client-only content after
|
|
6
|
+
* hydration. Useful for anything that depends on browser APIs or mounted state.
|
|
7
|
+
*/
|
|
8
|
+
export function ClientOnly({ children, fallback = null }) {
|
|
9
|
+
const [mounted, setMounted] = useState(false);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setMounted(true);
|
|
12
|
+
}, []);
|
|
13
|
+
if (!mounted) {
|
|
14
|
+
return _jsx(_Fragment, { children: fallback });
|
|
15
|
+
}
|
|
16
|
+
return _jsx(_Fragment, { children: typeof children === 'function' ? children() : children });
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/client-only/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ClientOnly } from './client-only.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional diagnostics toggles for {@link DevPanel}. Subscribe only to what you pass.
|
|
3
|
+
*/
|
|
4
|
+
export type DevPanelFeature = 'colorScheme' | 'connection' | 'contrast' | 'displayMode' | 'dpr' | 'focus' | 'fullscreen' | 'grid' | 'inverted' | 'locale' | 'media' | 'memory' | 'online' | 'orientation' | 'outline' | 'perf' | 'reducedTransparency' | 'safeArea' | 'saveData' | 'scrollbar' | 'scroll' | 'visibility' | 'visualViewport';
|
|
5
|
+
/**
|
|
6
|
+
* Full feature set used when {@link DevPanel} is rendered without a `features` prop.
|
|
7
|
+
* Pass `features={[]}` for viewport, breakpoint, and theme only.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ALL_DEV_PANEL_FEATURES: readonly DevPanelFeature[];
|
|
10
|
+
//# sourceMappingURL=dev-panel-features.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-panel-features.d.ts","sourceRoot":"","sources":["../../../src/components/dev-panel/dev-panel-features.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,aAAa,GACb,YAAY,GACZ,UAAU,GACV,aAAa,GACb,KAAK,GACL,OAAO,GACP,YAAY,GACZ,MAAM,GACN,UAAU,GACV,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,aAAa,GACb,SAAS,GACT,MAAM,GACN,qBAAqB,GACrB,UAAU,GACV,UAAU,GACV,WAAW,GACX,QAAQ,GACR,YAAY,GACZ,gBAAgB,CAAA;AAEpB;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,eAAe,EAwB5D,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full feature set used when {@link DevPanel} is rendered without a `features` prop.
|
|
3
|
+
* Pass `features={[]}` for viewport, breakpoint, and theme only.
|
|
4
|
+
*/
|
|
5
|
+
export const ALL_DEV_PANEL_FEATURES = [
|
|
6
|
+
'colorScheme',
|
|
7
|
+
'connection',
|
|
8
|
+
'contrast',
|
|
9
|
+
'displayMode',
|
|
10
|
+
'dpr',
|
|
11
|
+
'focus',
|
|
12
|
+
'fullscreen',
|
|
13
|
+
'grid',
|
|
14
|
+
'inverted',
|
|
15
|
+
'locale',
|
|
16
|
+
'media',
|
|
17
|
+
'memory',
|
|
18
|
+
'online',
|
|
19
|
+
'orientation',
|
|
20
|
+
'outline',
|
|
21
|
+
'perf',
|
|
22
|
+
'reducedTransparency',
|
|
23
|
+
'safeArea',
|
|
24
|
+
'saveData',
|
|
25
|
+
'scrollbar',
|
|
26
|
+
'scroll',
|
|
27
|
+
'visibility',
|
|
28
|
+
'visualViewport',
|
|
29
|
+
];
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import { type DevPanelFeature } from './dev-panel-features.js';
|
|
3
|
+
export { ALL_DEV_PANEL_FEATURES, type DevPanelFeature, } from './dev-panel-features.js';
|
|
4
|
+
export interface DevPanelItem {
|
|
5
|
+
label: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
value: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export type DevPanelLayout = 'hud' | 'inspector' | 'stack';
|
|
2
10
|
export interface DevPanelProps {
|
|
3
|
-
/**
|
|
4
|
-
* Tailwind breakpoint map. Defaults to standard Tailwind v4 breakpoints.
|
|
5
|
-
* Pass your own if you've customized the theme.
|
|
6
|
-
*/
|
|
7
11
|
breakpoints?: Record<string, number>;
|
|
8
|
-
/** Additional debug content rendered inside the panel. */
|
|
9
12
|
children?: ReactNode;
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
/** Defaults to {@link ALL_DEV_PANEL_FEATURES}. Pass `[]` for core metrics only. */
|
|
14
|
+
features?: DevPanelFeature[];
|
|
15
|
+
items?: DevPanelItem[];
|
|
16
|
+
layout?: DevPanelLayout;
|
|
14
17
|
shortcut?: string;
|
|
18
|
+
storageKey?: string;
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* Positioned at bottom-center to avoid clashing with Next.js (top-left) and
|
|
21
|
-
* TanStack devtools (bottom-right). Collapses to a compact pill on close.
|
|
22
|
-
*
|
|
23
|
-
* Pass `children` to add custom debug rows (route, user ID, feature flags…).
|
|
24
|
-
* Toggle with the keyboard shortcut (default: Shift+D).
|
|
21
|
+
* Development overlay: viewport px, Tailwind-style breakpoint, resolved theme,
|
|
22
|
+
* plus optional diagnostics enabled via `features`.
|
|
25
23
|
*/
|
|
26
24
|
export declare function DevPanel(props: DevPanelProps): import("react/jsx-runtime").JSX.Element | null;
|
|
27
25
|
//# sourceMappingURL=dev-panel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-panel.d.ts","sourceRoot":"","sources":["../../../src/components/dev-panel/dev-panel.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"dev-panel.d.ts","sourceRoot":"","sources":["../../../src/components/dev-panel/dev-panel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAOd,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAA;AAOhC,OAAO,EACL,sBAAsB,EACtB,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAA;AAuEhC,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,SAAS,CAAA;CACjB;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,WAAW,GAAG,OAAO,CAAA;AAE1D,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;IAC5B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAA;IACtB,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAo1BD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,kDAG5C"}
|