@sheetxl/utils-react 0.8.0-beta.2 → 0.8.0-beta.21

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 (78) hide show
  1. package/LICENSE.md +17 -7
  2. package/browser/esm/{C0YaChjA6T3amxUK.mjs → B6U1YOdlMBIiMwIo.mjs} +2 -2
  3. package/browser/esm/B8oCr4YRlNEgrVTE.mjs +100 -0
  4. package/browser/esm/{DaDIU3EpB96qbvar.mjs → C74v7_u2uwgwlCTV.mjs} +20 -19
  5. package/browser/esm/index.mjs +2381 -1782
  6. package/licenses/dependencies.txt +1 -39
  7. package/node/esm/{ab6S2ZLIze6opqOt.mjs → BRFcIf1L6jIUdzP7.mjs} +2 -2
  8. package/node/esm/CZoJwu33P3QdiHsu.mjs +100 -0
  9. package/node/esm/index.mjs +2274 -1684
  10. package/package.json +9 -12
  11. package/types/src/animation/useAnimatedMeasure.d.ts +2 -3
  12. package/types/src/command/CommandButtonRegistry.d.ts +3 -1
  13. package/types/src/command/CommandScope.d.ts +23 -2
  14. package/types/src/components/RenderSlot.d.ts +32 -0
  15. package/types/src/components/index.d.ts +1 -1
  16. package/types/src/float/FloatPanel.d.ts +7 -6
  17. package/types/src/float/FloatPopper.d.ts +84 -10
  18. package/types/src/float/FloatPopup.d.ts +1 -1
  19. package/types/src/float/FloatProvider.d.ts +3 -2
  20. package/types/src/float/FloatStackContext.d.ts +8 -0
  21. package/types/src/float/FloatUtils.d.ts +3 -2
  22. package/types/src/float/_FloatTheme.d.ts +17 -0
  23. package/types/src/float/_FloatUtils.d.ts +6 -0
  24. package/types/src/float/index.d.ts +0 -1
  25. package/types/src/float/useFloatStack.d.ts +6 -5
  26. package/types/src/hooks/LanguageState.d.ts +1 -1
  27. package/types/src/hooks/index.d.ts +4 -0
  28. package/types/src/hooks/useCallbackRef.d.ts +19 -6
  29. package/types/src/hooks/useEditMode.d.ts +24 -4
  30. package/types/src/hooks/useInputModality.d.ts +26 -0
  31. package/types/src/hooks/useLocationSearch.d.ts +9 -0
  32. package/types/src/hooks/useMeasure.d.ts +32 -0
  33. package/types/src/hooks/useNotifier.d.ts +35 -34
  34. package/types/src/hooks/useSynchronizedPointerHandler.d.ts +3 -7
  35. package/types/src/hooks/useVisualViewportRect.d.ts +40 -0
  36. package/types/src/icons/packs/Base.json.d.ts +3624 -0
  37. package/types/src/index.d.ts +2 -0
  38. package/types/src/lazy/lazyComponent.d.ts +9 -2
  39. package/types/src/persistence/PersistentStateProvider.d.ts +3 -0
  40. package/types/src/persistence/Types.d.ts +22 -6
  41. package/types/src/persistence/_Context.d.ts +3 -2
  42. package/types/src/persistence/index.d.ts +2 -2
  43. package/types/src/persistence/{usePersistenceState.d.ts → usePersistentState.d.ts} +13 -8
  44. package/types/src/render/PendingRender.d.ts +43 -0
  45. package/types/src/render/index.d.ts +2 -0
  46. package/types/src/scroll/AxisViewport.d.ts +6 -2
  47. package/types/src/scroll/IScrollPane.d.ts +17 -4
  48. package/types/src/scroll/IScrollbar.d.ts +5 -2
  49. package/types/src/scroll/ScrollButton.d.ts +3 -3
  50. package/types/src/scroll/Utils.d.ts +1 -0
  51. package/types/src/scroll/Viewport.d.ts +50 -2
  52. package/types/src/scroll/VirtualScrollbar.d.ts +2 -1
  53. package/types/src/scroll/touchOwner.d.ts +19 -0
  54. package/types/src/scroll/useWheelScroll.d.ts +15 -2
  55. package/types/src/scroll/wheelOwner.d.ts +18 -0
  56. package/types/src/scroller/Scroller.d.ts +44 -5
  57. package/types/src/splitPane/SplitPane.d.ts +3 -1
  58. package/types/src/theme/TokenTheme.d.ts +8 -0
  59. package/types/src/theme/index.d.ts +1 -0
  60. package/types/src/theme/useResolvedThemeMode.d.ts +22 -4
  61. package/types/src/theme/zIndex.d.ts +24 -0
  62. package/types/src/utils/index.d.ts +1 -0
  63. package/types/src/utils/measureUIText.d.ts +24 -0
  64. package/types/src/virtualKeyboard/KeyboardAccessory.d.ts +73 -0
  65. package/types/src/virtualKeyboard/VirtualKeyboard.d.ts +128 -0
  66. package/types/src/virtualKeyboard/_keyboardApi.d.ts +13 -0
  67. package/types/src/virtualKeyboard/index.d.ts +4 -0
  68. package/types/src/virtualKeyboard/useKeyboardResize.d.ts +41 -0
  69. package/browser/cjs/DO0nIGKXa_DxYcn6.cjs +0 -1
  70. package/browser/cjs/DZSvmqU8nRas1uz6.cjs +0 -1
  71. package/browser/cjs/fw5WNnhzqSBOfVql.cjs +0 -1
  72. package/browser/cjs/index.cjs +0 -5
  73. package/browser/esm/DKup4mMzT8WdXz0e.mjs +0 -2217
  74. package/node/esm/ErznqJafEjYJ3e0H.mjs +0 -2217
  75. package/types/src/components/ITooltip.d.ts +0 -38
  76. package/types/src/float/FloatTooltip.d.ts +0 -22
  77. package/types/src/persistence/PersistenceStateProvider.d.ts +0 -3
  78. package/types/src/utils/PinchZoom.d.ts +0 -3
@@ -1,13 +1,31 @@
1
1
  import { ThemeMode } from './TokenTheme';
2
- type Source = 'prop' | 'class' | 'media';
2
+ type Source = 'prop' | 'class' | 'media' | 'fallback';
3
+ /**
4
+ * What {@link useResolvedThemeMode} uses when neither an explicit mode nor a `dark`/`light` class on
5
+ * `<html>`/`<body>` decides: `'system'` follows `prefers-color-scheme`; a {@link ThemeMode} is used as is.
6
+ */
7
+ export type ThemeModeFallback = 'system' | ThemeMode;
8
+ /**
9
+ * The {@link ThemeModeFallback} for every {@link useResolvedThemeMode} below it that does not pass its own.
10
+ *
11
+ * @remarks
12
+ * Defaults to `'light'`: a component embedded in a page cannot know whether the page follows the OS, and
13
+ * most pages are light, so it stays light unless the host says otherwise. An app shell that owns the whole
14
+ * surface (Studio) provides `'system'`. Provided once per tree so every layer that resolves the mode
15
+ * independently (workbook, sheet, charts, floats) agrees.
16
+ */
17
+ export declare const ThemeModeFallbackContext: import('react').Context<ThemeModeFallback>;
3
18
  interface UseThemeOptions {
4
19
  mode?: ThemeMode;
20
+ /** Overrides {@link ThemeModeFallbackContext} for this call. */
21
+ fallback?: ThemeModeFallback;
5
22
  }
6
23
  /**
7
24
  * Resolves the effective light/dark mode from (in priority order) an explicit `mode`, a `dark`/`light`
8
- * class on `<html>`/`<body>`, then `prefers-color-scheme`. Framework-neutral (DOM only) — lives here so
9
- * both the neutral `@sheetxl/react` layer and the MUI studio resolve the SAME preference the same way
10
- * (no drift). Re-resolves on class mutations + media changes when no explicit `mode` is given.
25
+ * class on `<html>`/`<body>`, then the {@link ThemeModeFallback} (`prefers-color-scheme` when `'system'`).
26
+ * Framework-neutral (DOM only) — lives here so both the neutral `@sheetxl/react` layer and the MUI studio
27
+ * resolve the SAME preference the same way (no drift). Re-resolves on class mutations (and media changes
28
+ * when following the system) when no explicit `mode` is given.
11
29
  */
12
30
  export declare function useResolvedThemeMode(options?: UseThemeOptions): {
13
31
  themeMode: ThemeMode;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The stacking bands floating UI sits in. Three tokens (`--sxl-z-*`), ordered:
3
+ *
4
+ * | token | default | what sits there |
5
+ * | --- | --- | --- |
6
+ * | `grid` | 1250 | floats anchored to the grid — labels, chips, hover tips, touch grips. Above app chrome (an app drawer is 1200), below the popup band so a menu covers them. |
7
+ * | `popup` | 1300 | popups, menus and panels (the float stack), modal windows. MUI's modal band. |
8
+ * | `tooltip` | 1500 | tooltips of the chrome and menus, and gesture readouts — out-stack menus, as MUI's do. |
9
+ *
10
+ * The values are tokens so a host can move a band (`'z-popup'` in its {@link TokenTheme}) without every
11
+ * consumer knowing; a consumer reads the band through {@link zIndexVar} and never writes a number.
12
+ */
13
+ export type ZIndexToken = 'grid' | 'popup' | 'tooltip';
14
+ /** The default value of each band — what {@link zIndexVar} falls back to when the token is unset. */
15
+ export declare const Z_INDEX: Readonly<Record<ZIndexToken, number>>;
16
+ /**
17
+ * A band as a CSS `z-index` value: `var(--sxl-z-<token>, <default>)`, optionally offset (`delta`) within
18
+ * the band — `zIndexVar('grid', 1)` lifts one float above its siblings. The result is a string for an
19
+ * inline `zIndex` style (or a stylesheet), not a number.
20
+ */
21
+ export declare const zIndexVar: (token: ZIndexToken, delta?: number) => string;
22
+ /** `z` moved by `delta` — arithmetic on a number, `calc()` on a var expression. */
23
+ export declare const offsetZIndex: (z: number | string, delta: number) => number | string;
24
+ //# sourceMappingURL=zIndex.d.ts.map
@@ -2,4 +2,5 @@ export * as ReactUtils from './ReactUtils';
2
2
  export * from './useFullScreen';
3
3
  export * from './FullScreenPortal';
4
4
  export * from './textSelectionDrag';
5
+ export * from './measureUIText';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The font a piece of UI text is set in, as CSS has it.
3
+ */
4
+ export interface UIFont {
5
+ /** Font size in px. */
6
+ size: number;
7
+ /** The CSS font-family list, as the theme names it. */
8
+ family: string;
9
+ /** CSS font-weight; `normal` when unset. */
10
+ weight?: string | number;
11
+ /** CSS font-style; `normal` when unset. */
12
+ style?: 'normal' | 'italic' | 'oblique';
13
+ }
14
+ /**
15
+ * The width in px the browser paints `text` at in a UI font: for sizing a control to a sample
16
+ * label (a toolbar button to its widest value). Nothing to do with cells: spreadsheet text is
17
+ * measured by the sdk's font collection, with Excel's numbers.
18
+ *
19
+ * @remarks
20
+ * A cached canvas measures with the browser's own advances. Where there is no canvas (jsdom, a
21
+ * server) the width is estimated from the character count, which is enough to size a control.
22
+ */
23
+ export declare function measureUIText(text: string, font: UIFont): number;
24
+ //# sourceMappingURL=measureUIText.d.ts.map
@@ -0,0 +1,73 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * The top edge of the {@link KeyboardAccessory} showing on the keyboard, in client px (the coordinates
4
+ * `getBoundingClientRect` reads), or `null` while none shows. Content under that line is covered: the
5
+ * keyboard and the accessory both sit below it.
6
+ */
7
+ export declare const getKeyboardAccessoryTop: () => number | null;
8
+ /**
9
+ * Listen for {@link getKeyboardAccessoryTop} changing: an accessory settling on the keyboard, moving
10
+ * with it, or going away.
11
+ *
12
+ * @returns Stops listening.
13
+ */
14
+ export declare const subscribeKeyboardAccessoryTop: (listener: () => void) => (() => void);
15
+ /**
16
+ * Props for {@link KeyboardAccessory}.
17
+ */
18
+ export interface KeyboardAccessoryProps {
19
+ /**
20
+ * Whether the content rides the top of the virtual keyboard. While `false` it stays mounted but
21
+ * hidden, so a field inside keeps its focus and its keyboard across the change.
22
+ */
23
+ floating: boolean;
24
+ /**
25
+ * The element the accessory stands in for, in the page: its theme mode and surface are carried onto
26
+ * the accessory when no float provider supplies a theme.
27
+ */
28
+ anchor?: Element | null;
29
+ /**
30
+ * Called as the accessory shows and hides, after it has settled: an in-page twin fades the other
31
+ * way, so the content looks to have moved.
32
+ */
33
+ onShownChange?: (shown: boolean) => void;
34
+ /**
35
+ * Called when the keyboard goes away while floating (the Android back gesture, the keyboard's own
36
+ * hide key, Safari's Done), so the owner can end what the keyboard was for.
37
+ */
38
+ onKeyboardClose?: () => void;
39
+ className?: string;
40
+ style?: React.CSSProperties;
41
+ children?: React.ReactNode;
42
+ }
43
+ /**
44
+ * Content that rides the top of the virtual keyboard: a bar of a page-level portal, placed from the
45
+ * visual viewport (the part of the page the keyboard leaves visible).
46
+ *
47
+ * @remarks
48
+ * CSS cannot pin anything to the visual viewport (`position: fixed` pins to the layout viewport, which
49
+ * the keyboard does not shrink on iOS, nor on Chrome by default), and script placement runs a frame
50
+ * behind the browser's own scroll, zoom and address-bar animation. So:
51
+ *
52
+ * - **Hidden while anything moves.** A visual viewport resize or scroll, or a page scroll, hides it at
53
+ * once; once nothing has moved for a moment it is placed on the keyboard and fades in.
54
+ * - **Parked at the top of the visible area while hidden.** A focused field the browser sees under the
55
+ * keyboard's edge makes it pan the page to reveal it, and mid-pan the visual viewport's readings do
56
+ * not match the screen. Parked at the top, the field is always in view.
57
+ * - **Undoes pinch zoom**, so it stays the size of the screen.
58
+ * - **Placed by the browser where it can.** Where the browser offers the VirtualKeyboard API (Chromium,
59
+ * in a secure context), the keyboard overlays the page while the accessory floats, and the accessory
60
+ * sits on `env(keyboard-inset-height)`. The visual viewport is wrong in one state there: Chrome
61
+ * bringing its address bar back as the keyboard rises on a scrolled page reports the visible area as
62
+ * if the bar were still hidden, which would put the accessory behind the keyboard. Elsewhere (iOS
63
+ * Safari, Firefox) it is placed from the visual viewport.
64
+ *
65
+ * Its top edge is published through {@link getKeyboardAccessoryTop} while it shows. It never scrolls
66
+ * the page.
67
+ *
68
+ * Inside an iframe the visual viewport is the iframe's, so the accessory rides the iframe's bottom.
69
+ * A floating or split keyboard, or a hardware one, does not shrink the visual viewport: the accessory
70
+ * sits at the bottom of the visible area, and no keyboard close is reported.
71
+ */
72
+ export declare const KeyboardAccessory: React.ForwardRefExoticComponent<KeyboardAccessoryProps & React.RefAttributes<HTMLDivElement>>;
73
+ //# sourceMappingURL=KeyboardAccessory.d.ts.map
@@ -0,0 +1,128 @@
1
+ import { default as React } from 'react';
2
+ /** The virtual keyboard a text field asks for (its `inputmode`). */
3
+ export type VirtualKeyboardInputMode = 'text' | 'decimal' | 'numeric' | 'tel' | 'email' | 'url' | 'search';
4
+ /**
5
+ * Configuration for a {@link VirtualKeyboardStore}.
6
+ */
7
+ export interface VirtualKeyboardOptions {
8
+ /**
9
+ * Never enter keyboard mode: the grid takes focus itself, and the keyboard comes and goes with
10
+ * each text field as the browser decides. `false` turns keyboard mode on where the device was not
11
+ * detected to have one.
12
+ *
13
+ * @defaultValue `true` on a device with no touch input (no virtual keyboard), else `false`
14
+ */
15
+ disabled?: boolean;
16
+ /** Leave the grid scrolled where it is when the keyboard rises over the active cell. */
17
+ disableScrollIntoView?: boolean;
18
+ /**
19
+ * A tap on the grid keeps keyboard mode, as Excel keeps its keyboard, rather than putting the
20
+ * keyboard away.
21
+ */
22
+ keepOnTap?: boolean;
23
+ }
24
+ /**
25
+ * The keyboard-mode state.
26
+ */
27
+ export interface VirtualKeyboardState {
28
+ /**
29
+ * Whether the sheet is in keyboard mode: a virtual keyboard is up for typing into the sheet, and
30
+ * focusing the sheet lands on its typing input so the keyboard stays.
31
+ */
32
+ readonly active: boolean;
33
+ /** The keyboard every sheet text field asks for. */
34
+ readonly inputMode: VirtualKeyboardInputMode;
35
+ }
36
+ /**
37
+ * The imperative handle {@link useVirtualKeyboard} returns.
38
+ */
39
+ export interface VirtualKeyboardHandler {
40
+ /** The current state. A new object on each change. */
41
+ getState(): VirtualKeyboardState;
42
+ /**
43
+ * Whether keyboard mode is available: the device has a virtual keyboard, and the store is not
44
+ * {@link VirtualKeyboardOptions.disabled}. The counterpart of `document.fullscreenEnabled`; a host
45
+ * leaves keyboard-mode parts (the sheet's keyboard layer) out when it is `false`.
46
+ */
47
+ isEnabled(): boolean;
48
+ /** Shorthand for `getState().active`. */
49
+ isActive(): boolean;
50
+ /** Shorthand for `getState().inputMode`. */
51
+ getInputMode(): VirtualKeyboardInputMode;
52
+ /** Ask for a different keyboard on the sheet's text fields. */
53
+ setInputMode(inputMode: VirtualKeyboardInputMode): void;
54
+ /**
55
+ * Enter keyboard mode. A sheet whose focus is not already in a text field focuses its typing
56
+ * input, which raises the keyboard; browsers raise one only inside a user gesture, so call this
57
+ * from a tap.
58
+ *
59
+ * @returns Whether keyboard mode is on: `false` when it is not {@link isEnabled | enabled}, as
60
+ * `requestFullscreen` refuses where fullscreen is not.
61
+ */
62
+ show(): boolean;
63
+ /**
64
+ * Leave keyboard mode, and go back to the letters keyboard: a field opened later (a double-click
65
+ * into a cell) asks for letters, so the next keyboard does too. A sheet whose typing input has focus
66
+ * hands it to the grid, which lowers the keyboard; an editor that has focus keeps it.
67
+ */
68
+ hide(): void;
69
+ /**
70
+ * Name the editor that typing opens in while in keyboard mode, by the id it parks on the edit
71
+ * session (`EditSession.setActiveEditorId`); a phone's formula bar names itself so a typed key
72
+ * opens the edit there rather than in the cell. The latest registration wins.
73
+ *
74
+ * @returns Removes this registration.
75
+ */
76
+ registerEditor(editorId: string): () => void;
77
+ /** The editor typing opens in while in keyboard mode, or `null` for the cell. */
78
+ getEditorId(): string | null;
79
+ /** The options the store was created with. */
80
+ getOptions(): Readonly<VirtualKeyboardOptions>;
81
+ }
82
+ /**
83
+ * A virtual keyboard **bus instance**: one keyboard mode shared by the sheet, its editors, and any
84
+ * control that shows or hides the keyboard.
85
+ */
86
+ export interface VirtualKeyboardStore extends VirtualKeyboardHandler {
87
+ /** Subscribe to any state change. Returns the remover. */
88
+ subscribe(listener: () => void): () => void;
89
+ }
90
+ /**
91
+ * Whether a virtual keyboard is up, read from the visual viewport (the part of the page the keyboard
92
+ * leaves visible). Pinch zoom shrinks the visual viewport too, so its scale is undone first. While a
93
+ * keyboard overlays the page (the browser's VirtualKeyboard API with `overlaysContent`, as a
94
+ * `KeyboardAccessory` sets it), the browser's own report of the keyboard is read instead.
95
+ *
96
+ * @param baseline The layout height to measure against, in px. Defaults to `window.innerHeight`; pass
97
+ * the height read before the keyboard rose where the page may shrink with it (a host whose viewport
98
+ * asks for `interactive-widget=resizes-content`).
99
+ */
100
+ export declare const isVirtualKeyboardUp: (baseline?: number) => boolean;
101
+ /**
102
+ * Create an isolated virtual keyboard store.
103
+ */
104
+ export declare const createVirtualKeyboardStore: (options?: VirtualKeyboardOptions) => VirtualKeyboardStore;
105
+ export interface VirtualKeyboardProviderProps extends VirtualKeyboardOptions {
106
+ /** The bus instance to share. Omit to create one for this subtree from the options. */
107
+ store?: VirtualKeyboardStore;
108
+ children?: React.ReactNode;
109
+ }
110
+ /**
111
+ * Share one virtual keyboard bus with a subtree: the sheet, its editors, and any keyboard control an
112
+ * app adds (a "show keyboard" button calls `useVirtualKeyboard().show()`). With no `store` a fresh one
113
+ * is created from the options, stable while they are unchanged.
114
+ */
115
+ export declare const VirtualKeyboardProvider: (props: VirtualKeyboardProviderProps) => React.ReactElement;
116
+ /**
117
+ * Resolve the enclosing bus **instance**: the nearest {@link VirtualKeyboardProvider}'s store, else
118
+ * the app-wide default, enabled on a device with touch input. Never `null`: where there is no
119
+ * virtual keyboard the store reports `isEnabled() === false` and `show()` refuses, as the
120
+ * fullscreen API does where fullscreen is unavailable. Non-reactive; use {@link useVirtualKeyboard}
121
+ * to also re-render.
122
+ */
123
+ export declare const useVirtualKeyboardStore: () => VirtualKeyboardStore;
124
+ /**
125
+ * Access the enclosing virtual keyboard bus. Reading re-renders on change.
126
+ */
127
+ export declare const useVirtualKeyboard: () => VirtualKeyboardHandler;
128
+ //# sourceMappingURL=VirtualKeyboard.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The browser's VirtualKeyboard API (`navigator.virtualKeyboard`): Chromium only, and only in a secure
3
+ * context (HTTPS, or localhost). With `overlaysContent` on, the keyboard covers the page instead of
4
+ * shrinking the visual viewport, and the browser reports its rectangle (and the CSS
5
+ * `env(keyboard-inset-*)` values) itself.
6
+ */
7
+ export interface VirtualKeyboardApi extends EventTarget {
8
+ overlaysContent: boolean;
9
+ readonly boundingRect: DOMRectReadOnly;
10
+ }
11
+ /** The browser's VirtualKeyboard API, or `null` where it is unavailable. */
12
+ export declare const getVirtualKeyboardApi: () => VirtualKeyboardApi | null;
13
+ //# sourceMappingURL=_keyboardApi.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from './VirtualKeyboard';
2
+ export * from './KeyboardAccessory';
3
+ export * from './useKeyboardResize';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,41 @@
1
+ /**
2
+ * How a host makes room for the virtual keyboard.
3
+ *
4
+ * - `'float'`: the host stays as it is and never scrolls the page; what is being typed into rides
5
+ * the top of the keyboard in a {@link KeyboardAccessory}. For a host that is part of a page.
6
+ * - `'resize'`: the host shrinks to the part of the screen the keyboard leaves
7
+ * ({@link useKeyboardResize}), so everything in it stays in view above the keyboard. For a host that
8
+ * is the page; in a page that scrolls it would fight the page.
9
+ * - `'none'`: nothing; the host or the browser manages the keyboard.
10
+ */
11
+ export type VirtualKeyboardMode = 'float' | 'resize' | 'none';
12
+ /** The room a host that is the page gives up to the virtual keyboard. See {@link useKeyboardResize}. */
13
+ export interface KeyboardResize {
14
+ /** The height the host gives up to the keyboard, in px; `0` while the keyboard is down. */
15
+ inset: number;
16
+ /** How far the host moves down to stay in the visible part of the page, in px. */
17
+ offsetTop: number;
18
+ }
19
+ /**
20
+ * The room a host that is the page makes for the virtual keyboard (the `'resize'`
21
+ * {@link VirtualKeyboardMode}): it shrinks to the part of the screen the keyboard leaves. Apply the
22
+ * result to the host's own box, e.g. `height: calc(100% - ${inset}px)` and
23
+ * `transform: translateY(${offsetTop}px)`.
24
+ *
25
+ * @param enabled Measure only while `true`; a host in another mode pays nothing.
26
+ *
27
+ * @remarks
28
+ * iOS Safari keeps the layout viewport at full height and scrolls the page instead; the visual
29
+ * viewport is the one signal that reflects the keyboard on every platform. While the keyboard is up
30
+ * the host gives up its height (layout minus visual), rides the visual viewport's offset so it stays
31
+ * put while Safari scrolls the layout under it, and the page is scrolled back to the top as the
32
+ * keyboard changes and once as it goes. Only the keyboard counts: the address bar showing or hiding
33
+ * and a pinch zoom leave the host alone.
34
+ *
35
+ * Meant for a host that fills a page that does not scroll. There, Chrome's address bar never hides,
36
+ * so the visual viewport's readings stay right; on a page that scrolls, use the `'float'` mode.
37
+ *
38
+ * Re-renders with the visual viewport while enabled.
39
+ */
40
+ export declare const useKeyboardResize: (enabled: boolean) => KeyboardResize;
41
+ //# sourceMappingURL=useKeyboardResize.d.ts.map