opentui-responsive 0.2.6 → 0.2.7

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.
@@ -7,6 +7,9 @@ export type BreakpointScales = {
7
7
  readonly width: BreakpointScale;
8
8
  readonly height: BreakpointScale;
9
9
  };
10
+ type BreakpointScalesIncludingZero<Scales extends BreakpointScales> = {
11
+ readonly [Axis in BreakpointAxis]: 0 extends Scales[Axis][keyof Scales[Axis]] ? Scales[Axis] : never;
12
+ };
10
13
  /** Terminal dimensions in cells. */
11
14
  export type BreakpointViewport = {
12
15
  readonly width: number;
@@ -32,4 +35,5 @@ export declare class ResponsiveTuiConfigurationError extends Error {
32
35
  constructor(message: string);
33
36
  }
34
37
  /** Creates a validated breakpoint matcher for the framework adapters. */
35
- export declare const createBreakpointDefinition: <const Scales extends BreakpointScales>(scales: Scales & Record<Exclude<keyof Scales, BreakpointAxis>, never>) => BreakpointDefinition<Scales>;
38
+ export declare const createBreakpointDefinition: <const Scales extends BreakpointScales>(scales: Scales & BreakpointScalesIncludingZero<Scales> & Record<Exclude<keyof Scales, BreakpointAxis>, never>) => BreakpointDefinition<Scales>;
39
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { type PropsWithChildren } from "react";
2
- import { type BreakpointMatch, type BreakpointPair, type BreakpointScales } from "../core/index.js";
2
+ import { createBreakpointDefinition, type BreakpointMatch, type BreakpointPair, type BreakpointScales } from "../core/index.js";
3
3
  export { ResponsiveTuiConfigurationError } from "../core/index.js";
4
4
  /** A React accessor that reads or tests the current breakpoint pair. */
5
5
  export type ResponsiveBreakpointAccessor<Scales extends BreakpointScales = BreakpointScales> = {
@@ -12,7 +12,7 @@ export declare class ResponsiveTuiProviderError extends Error {
12
12
  constructor();
13
13
  }
14
14
  /** Creates a React provider and hook bound to one breakpoint definition. */
15
- export declare const createResponsiveTui: <const Scales extends BreakpointScales>(scales: Scales & Record<Exclude<keyof Scales, "width" | "height">, never>) => {
15
+ export declare const createResponsiveTui: <const Scales extends BreakpointScales>(scales: Parameters<typeof createBreakpointDefinition<Scales>>[0]) => {
16
16
  ResponsiveTUI: (props: PropsWithChildren) => import("react").FunctionComponentElement<import("react").ProviderProps<ResponsiveBreakpointAccessor<Scales> | undefined>>;
17
17
  useResponsiveTui: () => ResponsiveBreakpointAccessor<Scales>;
18
18
  };
@@ -1,5 +1,5 @@
1
1
  import { type ParentProps } from "solid-js";
2
- import { type BreakpointMatch, type BreakpointPair, type BreakpointScales } from "../core/index.js";
2
+ import { createBreakpointDefinition, type BreakpointMatch, type BreakpointPair, type BreakpointScales } from "../core/index.js";
3
3
  export { ResponsiveTuiConfigurationError } from "../core/index.js";
4
4
  /** A reactive Solid accessor that reads or tests the current breakpoint pair. */
5
5
  export type ResponsiveBreakpointAccessor<Scales extends BreakpointScales = BreakpointScales> = {
@@ -12,7 +12,7 @@ export declare class ResponsiveTuiProviderError extends Error {
12
12
  constructor();
13
13
  }
14
14
  /** Creates a Solid provider and hook bound to one breakpoint definition. */
15
- export declare const createResponsiveTui: <const Scales extends BreakpointScales>(scales: Scales & Record<Exclude<keyof Scales, "width" | "height">, never>) => {
15
+ export declare const createResponsiveTui: <const Scales extends BreakpointScales>(scales: Parameters<typeof createBreakpointDefinition<Scales>>[0]) => {
16
16
  ResponsiveTUI: (props: ParentProps) => any;
17
17
  useResponsiveTui: () => ResponsiveBreakpointAccessor<Scales>;
18
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opentui-responsive",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Typed responsive breakpoints for OpenTUI.",
5
5
  "license": "MIT",
6
6
  "repository": {