@mudlet/mudlet-web 0.4.2 → 0.4.3

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.
@@ -2,7 +2,6 @@ import { type OutputRendererControls, type MessageSource } from '../ui/output/Ou
2
2
  export declare const DEFAULT_STICKY_LINES = 50;
3
3
  export interface UseStickyOutputOptions {
4
4
  stickyLines?: number;
5
- maxElements?: number;
6
5
  splitViewThreshold?: number;
7
6
  showTimestamps?: boolean;
8
7
  /** See OutputHandlerOptions.followTail. Omit for a normal scrollback. */
@@ -16,4 +15,4 @@ export interface UseStickyOutputResult {
16
15
  scrollToBottom: () => void;
17
16
  controls: OutputRendererControls | null;
18
17
  }
19
- export declare function useStickyOutput(source: MessageSource | null, { stickyLines, maxElements, splitViewThreshold, showTimestamps, followTail, }?: UseStickyOutputOptions): UseStickyOutputResult;
18
+ export declare function useStickyOutput(source: MessageSource | null, { stickyLines, splitViewThreshold, showTimestamps, followTail, }?: UseStickyOutputOptions): UseStickyOutputResult;
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  /**
2
3
  * Responsive breakpoints (px). Kept in sync with the `--bp-*` tokens and the
3
4
  * `@media` blocks in App.css — change them in both places.
@@ -8,7 +9,31 @@
8
9
  export declare const MOBILE_MAX_WIDTH = 600;
9
10
  export declare const TABLET_MAX_WIDTH = 900;
10
11
  export type ViewportMode = 'mobile' | 'tablet' | 'desktop';
11
- /** Current responsive mode, re-rendering the caller when it changes. */
12
+ /** Current responsive mode, re-rendering the caller when it changes. Reads the
13
+ * nearest measured container, and the window when there is not one. */
12
14
  export declare function useViewportMode(): ViewportMode;
13
15
  /** Convenience: true on phone-sized viewports (the single-column layout branch). */
14
16
  export declare function useIsMobile(): boolean;
17
+ /**
18
+ * The same breakpoints, measured against an element instead of the window.
19
+ *
20
+ * The window is the wrong ruler when the client is not the whole page. Mudlet
21
+ * Web is embedded in a ~560px frame on mudlet.org, and `window.innerWidth`
22
+ * inside that frame is 560 — so the client concluded it was on a phone and
23
+ * switched to the single-column layout, putting its panels behind a tab strip
24
+ * on a 2560px screen. What decides the layout is how much room the client has,
25
+ * which is what its own root element knows.
26
+ *
27
+ * Thresholds are unchanged: a full-window client on a real phone still measures
28
+ * a phone-sized root and still gets the phone layout.
29
+ */
30
+ export declare function useElementViewportMode(element: HTMLElement | null): ViewportMode;
31
+ /**
32
+ * Publishes the mode measured from `element` to everything below it. Consumers
33
+ * that are not under a provider — the connection screen, tests — keep reading
34
+ * the window, so this is additive.
35
+ */
36
+ export declare function ViewportModeProvider({ element, children }: {
37
+ element: HTMLElement | null;
38
+ children: ReactNode;
39
+ }): import("react").FunctionComponentElement<import("react").ProviderProps<ViewportMode | null>>;