@tachui/responsive 0.8.0-alpha
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/LICENSE +363 -0
- package/README.md +507 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2538 -0
- package/dist/index.js.map +1 -0
- package/dist/modifiers/index.d.ts +5 -0
- package/dist/modifiers/index.d.ts.map +1 -0
- package/dist/modifiers/responsive/advanced-utilities.d.ts +121 -0
- package/dist/modifiers/responsive/advanced-utilities.d.ts.map +1 -0
- package/dist/modifiers/responsive/breakpoints.d.ts +81 -0
- package/dist/modifiers/responsive/breakpoints.d.ts.map +1 -0
- package/dist/modifiers/responsive/css-generator.d.ts +100 -0
- package/dist/modifiers/responsive/css-generator.d.ts.map +1 -0
- package/dist/modifiers/responsive/dev-tools.d.ts +107 -0
- package/dist/modifiers/responsive/dev-tools.d.ts.map +1 -0
- package/dist/modifiers/responsive/index.d.ts +29 -0
- package/dist/modifiers/responsive/index.d.ts.map +1 -0
- package/dist/modifiers/responsive/layout-patterns.d.ts +230 -0
- package/dist/modifiers/responsive/layout-patterns.d.ts.map +1 -0
- package/dist/modifiers/responsive/performance.d.ts +130 -0
- package/dist/modifiers/responsive/performance.d.ts.map +1 -0
- package/dist/modifiers/responsive/responsive-builder.d.ts +133 -0
- package/dist/modifiers/responsive/responsive-builder.d.ts.map +1 -0
- package/dist/modifiers/responsive/responsive-modifier.d.ts +123 -0
- package/dist/modifiers/responsive/responsive-modifier.d.ts.map +1 -0
- package/dist/modifiers/responsive/types.d.ts +183 -0
- package/dist/modifiers/responsive/types.d.ts.map +1 -0
- package/dist/modifiers/responsive/utilities.d.ts +149 -0
- package/dist/modifiers/responsive/utilities.d.ts.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Responsive Design System Types
|
|
3
|
+
*
|
|
4
|
+
* CSS-Native media query and responsive design type definitions for tachUI.
|
|
5
|
+
* Provides comprehensive type safety for responsive modifiers while maintaining
|
|
6
|
+
* backward compatibility with existing modifier system.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Standard breakpoint identifiers following Tailwind conventions
|
|
10
|
+
*/
|
|
11
|
+
export type BreakpointKey = 'base' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
12
|
+
/**
|
|
13
|
+
* Breakpoint configuration mapping breakpoint keys to CSS values
|
|
14
|
+
*/
|
|
15
|
+
export interface BreakpointConfig {
|
|
16
|
+
base?: string;
|
|
17
|
+
sm?: string;
|
|
18
|
+
md?: string;
|
|
19
|
+
lg?: string;
|
|
20
|
+
xl?: string;
|
|
21
|
+
'2xl'?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Default breakpoint values (Tailwind-inspired)
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEFAULT_BREAKPOINTS: Required<BreakpointConfig>;
|
|
27
|
+
/**
|
|
28
|
+
* Responsive value type that accepts either a single value or breakpoint-specific values
|
|
29
|
+
*/
|
|
30
|
+
export type ResponsiveValue<T> = T | Partial<Record<BreakpointKey, T>>;
|
|
31
|
+
/**
|
|
32
|
+
* CSS property values that can be responsive
|
|
33
|
+
*/
|
|
34
|
+
export type ResponsiveCSSValue = ResponsiveValue<string | number>;
|
|
35
|
+
/**
|
|
36
|
+
* Advanced media query configuration for custom responsive behavior
|
|
37
|
+
*/
|
|
38
|
+
export interface MediaQueryConfig {
|
|
39
|
+
query: string;
|
|
40
|
+
styles: Record<string, string | number>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Responsive modifier configuration combining breakpoints and custom media queries
|
|
44
|
+
*/
|
|
45
|
+
export interface ResponsiveModifierConfig<T = any> {
|
|
46
|
+
breakpoints?: Partial<Record<BreakpointKey, T>>;
|
|
47
|
+
mediaQueries?: MediaQueryConfig[];
|
|
48
|
+
fallback?: T;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Responsive layout configuration for common responsive patterns
|
|
52
|
+
*/
|
|
53
|
+
export interface ResponsiveLayoutConfig {
|
|
54
|
+
direction?: ResponsiveValue<'row' | 'column' | 'row-reverse' | 'column-reverse'>;
|
|
55
|
+
wrap?: ResponsiveValue<'nowrap' | 'wrap' | 'wrap-reverse'>;
|
|
56
|
+
justify?: ResponsiveValue<'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly'>;
|
|
57
|
+
align?: ResponsiveValue<'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'>;
|
|
58
|
+
gap?: ResponsiveValue<number | string>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Responsive typography configuration
|
|
62
|
+
*/
|
|
63
|
+
export interface ResponsiveTypographyConfig {
|
|
64
|
+
fontSize?: ResponsiveValue<number | string>;
|
|
65
|
+
lineHeight?: ResponsiveValue<number | string>;
|
|
66
|
+
letterSpacing?: ResponsiveValue<number | string>;
|
|
67
|
+
fontWeight?: ResponsiveValue<number | string>;
|
|
68
|
+
textAlign?: ResponsiveValue<'left' | 'center' | 'right' | 'justify'>;
|
|
69
|
+
textTransform?: ResponsiveValue<'none' | 'uppercase' | 'lowercase' | 'capitalize'>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Responsive spacing configuration
|
|
73
|
+
*/
|
|
74
|
+
export interface ResponsiveSpacingConfig {
|
|
75
|
+
top?: ResponsiveValue<number | string>;
|
|
76
|
+
right?: ResponsiveValue<number | string>;
|
|
77
|
+
bottom?: ResponsiveValue<number | string>;
|
|
78
|
+
left?: ResponsiveValue<number | string>;
|
|
79
|
+
horizontal?: ResponsiveValue<number | string>;
|
|
80
|
+
vertical?: ResponsiveValue<number | string>;
|
|
81
|
+
all?: ResponsiveValue<number | string>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Responsive dimension configuration
|
|
85
|
+
*/
|
|
86
|
+
export interface ResponsiveDimensionConfig {
|
|
87
|
+
width?: ResponsiveValue<number | string>;
|
|
88
|
+
height?: ResponsiveValue<number | string>;
|
|
89
|
+
minWidth?: ResponsiveValue<number | string>;
|
|
90
|
+
maxWidth?: ResponsiveValue<number | string>;
|
|
91
|
+
minHeight?: ResponsiveValue<number | string>;
|
|
92
|
+
maxHeight?: ResponsiveValue<number | string>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Responsive visibility configuration
|
|
96
|
+
*/
|
|
97
|
+
export interface ResponsiveVisibilityConfig {
|
|
98
|
+
display?: ResponsiveValue<'none' | 'block' | 'inline' | 'inline-block' | 'flex' | 'inline-flex' | 'grid' | 'inline-grid'>;
|
|
99
|
+
visibility?: ResponsiveValue<'visible' | 'hidden' | 'collapse'>;
|
|
100
|
+
opacity?: ResponsiveValue<number>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Comprehensive responsive style configuration
|
|
104
|
+
*/
|
|
105
|
+
export interface ResponsiveStyleConfig extends ResponsiveLayoutConfig, ResponsiveTypographyConfig, ResponsiveDimensionConfig, ResponsiveVisibilityConfig {
|
|
106
|
+
backgroundColor?: ResponsiveValue<string>;
|
|
107
|
+
color?: ResponsiveValue<string>;
|
|
108
|
+
border?: ResponsiveValue<string>;
|
|
109
|
+
borderRadius?: ResponsiveValue<number | string>;
|
|
110
|
+
boxShadow?: ResponsiveValue<string>;
|
|
111
|
+
transform?: ResponsiveValue<string>;
|
|
112
|
+
transition?: ResponsiveValue<string>;
|
|
113
|
+
padding?: ResponsiveSpacingConfig | ResponsiveValue<number | string>;
|
|
114
|
+
margin?: ResponsiveSpacingConfig | ResponsiveValue<number | string>;
|
|
115
|
+
[key: string]: any;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Breakpoint context information for responsive utilities
|
|
119
|
+
*/
|
|
120
|
+
export interface BreakpointContext {
|
|
121
|
+
current: BreakpointKey;
|
|
122
|
+
width: number;
|
|
123
|
+
height: number;
|
|
124
|
+
isAbove: (breakpoint: BreakpointKey) => boolean;
|
|
125
|
+
isBelow: (breakpoint: BreakpointKey) => boolean;
|
|
126
|
+
isBetween: (min: BreakpointKey, max: BreakpointKey) => boolean;
|
|
127
|
+
matches: (query: string) => boolean;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Responsive modifier factory configuration
|
|
131
|
+
*/
|
|
132
|
+
export interface ResponsiveModifierFactoryConfig {
|
|
133
|
+
breakpoints?: BreakpointConfig;
|
|
134
|
+
generateCSS?: boolean;
|
|
135
|
+
fallbackToJS?: boolean;
|
|
136
|
+
optimizeOutput?: boolean;
|
|
137
|
+
debugMode?: boolean;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* CSS media query generation result
|
|
141
|
+
*/
|
|
142
|
+
export interface GeneratedMediaQuery {
|
|
143
|
+
breakpoint: BreakpointKey;
|
|
144
|
+
query: string;
|
|
145
|
+
styles: Record<string, string | number>;
|
|
146
|
+
selector: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Responsive modifier application result
|
|
150
|
+
*/
|
|
151
|
+
export interface ResponsiveModifierResult {
|
|
152
|
+
cssRules: string[];
|
|
153
|
+
mediaQueries: GeneratedMediaQuery[];
|
|
154
|
+
fallbackStyles: Record<string, string | number>;
|
|
155
|
+
hasResponsiveStyles: boolean;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Type guard to check if a value is responsive
|
|
159
|
+
*/
|
|
160
|
+
export declare function isResponsiveValue<T>(value: ResponsiveValue<T>): value is Partial<Record<BreakpointKey, T>>;
|
|
161
|
+
/**
|
|
162
|
+
* Type guard to check if a breakpoint key is valid
|
|
163
|
+
*/
|
|
164
|
+
export declare function isValidBreakpointKey(key: string): key is BreakpointKey;
|
|
165
|
+
/**
|
|
166
|
+
* Utility type to make any property responsive
|
|
167
|
+
*/
|
|
168
|
+
export type MakeResponsive<T> = {
|
|
169
|
+
[K in keyof T]: ResponsiveValue<T[K]>;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Extract responsive properties from a configuration object
|
|
173
|
+
*/
|
|
174
|
+
export type ResponsiveProperties<T> = {
|
|
175
|
+
[K in keyof T as T[K] extends ResponsiveValue<any> ? K : never]: T[K];
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Extract non-responsive properties from a configuration object
|
|
179
|
+
*/
|
|
180
|
+
export type NonResponsiveProperties<T> = {
|
|
181
|
+
[K in keyof T as T[K] extends ResponsiveValue<any> ? never : K]: T[K];
|
|
182
|
+
};
|
|
183
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modifiers/responsive/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAA;AAEtE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,gBAAgB,CAOjD,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAA;AAEtE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;AAEjE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,E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,CAAC,CAAC,CAAC,CAAC;CACtE,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI;KACtC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACtE,CAAA"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Responsive Design Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides utility functions and hooks for working with responsive design
|
|
5
|
+
* in tachUI applications. Includes breakpoint detection, media query helpers,
|
|
6
|
+
* and responsive value resolution.
|
|
7
|
+
*/
|
|
8
|
+
import { BreakpointKey, BreakpointContext, ResponsiveValue } from './types';
|
|
9
|
+
import { Signal } from '@tachui/core';
|
|
10
|
+
/**
|
|
11
|
+
* Hook to get current breakpoint information
|
|
12
|
+
*/
|
|
13
|
+
export declare function useBreakpoint(): {
|
|
14
|
+
current: Signal<BreakpointKey>;
|
|
15
|
+
context: Signal<BreakpointContext>;
|
|
16
|
+
isAbove: (breakpoint: BreakpointKey) => Signal<boolean>;
|
|
17
|
+
isBelow: (breakpoint: BreakpointKey) => Signal<boolean>;
|
|
18
|
+
isBetween: (min: BreakpointKey, max: BreakpointKey) => Signal<boolean>;
|
|
19
|
+
matches: (query: string) => Signal<boolean>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Hook to create a reactive media query
|
|
23
|
+
*/
|
|
24
|
+
export declare function useMediaQuery(query: string): Signal<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve a responsive value to its current value based on the current breakpoint
|
|
27
|
+
*/
|
|
28
|
+
export declare function useResponsiveValue<T>(value: ResponsiveValue<T>): Signal<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Create a responsive value resolver for static resolution
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveResponsiveValue<T>(value: ResponsiveValue<T>, targetBreakpoint?: BreakpointKey): T;
|
|
33
|
+
/**
|
|
34
|
+
* Create responsive CSS custom properties (CSS variables)
|
|
35
|
+
*/
|
|
36
|
+
export declare function createResponsiveCSSVariables(prefix: string, values: Record<string, ResponsiveValue<string | number>>): Record<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
* Generate CSS media query string for common patterns
|
|
39
|
+
*/
|
|
40
|
+
export declare const MediaQueries: {
|
|
41
|
+
readonly mobile: "(max-width: 767px)";
|
|
42
|
+
readonly tablet: "(min-width: 768px) and (max-width: 1023px)";
|
|
43
|
+
readonly desktop: "(min-width: 1024px)";
|
|
44
|
+
readonly landscape: "(orientation: landscape)";
|
|
45
|
+
readonly portrait: "(orientation: portrait)";
|
|
46
|
+
readonly highDPI: "(min-resolution: 2dppx)";
|
|
47
|
+
readonly lowDPI: "(max-resolution: 1dppx)";
|
|
48
|
+
readonly retinaDisplay: "(min-resolution: 2dppx)";
|
|
49
|
+
readonly standardDisplay: "(max-resolution: 1.9dppx)";
|
|
50
|
+
readonly darkMode: "(prefers-color-scheme: dark)";
|
|
51
|
+
readonly lightMode: "(prefers-color-scheme: light)";
|
|
52
|
+
readonly noColorSchemePreference: "(prefers-color-scheme: no-preference)";
|
|
53
|
+
readonly reducedMotion: "(prefers-reduced-motion: reduce)";
|
|
54
|
+
readonly allowMotion: "(prefers-reduced-motion: no-preference)";
|
|
55
|
+
readonly highContrast: "(prefers-contrast: high)";
|
|
56
|
+
readonly lowContrast: "(prefers-contrast: low)";
|
|
57
|
+
readonly normalContrast: "(prefers-contrast: no-preference)";
|
|
58
|
+
readonly reduceData: "(prefers-reduced-data: reduce)";
|
|
59
|
+
readonly allowData: "(prefers-reduced-data: no-preference)";
|
|
60
|
+
readonly reduceTransparency: "(prefers-reduced-transparency: reduce)";
|
|
61
|
+
readonly allowTransparency: "(prefers-reduced-transparency: no-preference)";
|
|
62
|
+
readonly canHover: "(hover: hover)";
|
|
63
|
+
readonly noHover: "(hover: none)";
|
|
64
|
+
readonly finePointer: "(pointer: fine)";
|
|
65
|
+
readonly coarsePointer: "(pointer: coarse)";
|
|
66
|
+
readonly anyCanHover: "(any-hover: hover)";
|
|
67
|
+
readonly anyNoHover: "(any-hover: none)";
|
|
68
|
+
readonly anyFinePointer: "(any-pointer: fine)";
|
|
69
|
+
readonly anyCoarsePointer: "(any-pointer: coarse)";
|
|
70
|
+
readonly slowUpdate: "(update: slow)";
|
|
71
|
+
readonly fastUpdate: "(update: fast)";
|
|
72
|
+
readonly blockScrolling: "(overflow-block: scroll)";
|
|
73
|
+
readonly blockPaged: "(overflow-block: paged)";
|
|
74
|
+
readonly inlineScrolling: "(overflow-inline: scroll)";
|
|
75
|
+
readonly forcedColors: "(forced-colors: active)";
|
|
76
|
+
readonly normalColors: "(forced-colors: none)";
|
|
77
|
+
readonly invertedColors: "(inverted-colors: inverted)";
|
|
78
|
+
readonly normalInvertedColors: "(inverted-colors: none)";
|
|
79
|
+
readonly scriptingEnabled: "(scripting: enabled)";
|
|
80
|
+
readonly scriptingDisabled: "(scripting: none)";
|
|
81
|
+
readonly scriptingInitialOnly: "(scripting: initial-only)";
|
|
82
|
+
readonly containerSmall: "(max-width: 400px)";
|
|
83
|
+
readonly containerMedium: "(min-width: 401px) and (max-width: 800px)";
|
|
84
|
+
readonly containerLarge: "(min-width: 801px)";
|
|
85
|
+
readonly minWidth: (width: number | string) => string;
|
|
86
|
+
readonly maxWidth: (width: number | string) => string;
|
|
87
|
+
readonly between: (min: number | string, max: number | string) => string;
|
|
88
|
+
readonly minHeight: (height: number | string) => string;
|
|
89
|
+
readonly maxHeight: (height: number | string) => string;
|
|
90
|
+
readonly heightBetween: (min: number | string, max: number | string) => string;
|
|
91
|
+
readonly square: "(aspect-ratio: 1/1)";
|
|
92
|
+
readonly landscape16_9: "(aspect-ratio: 16/9)";
|
|
93
|
+
readonly portrait9_16: "(aspect-ratio: 9/16)";
|
|
94
|
+
readonly widescreen: "(min-aspect-ratio: 16/9)";
|
|
95
|
+
readonly tallscreen: "(max-aspect-ratio: 9/16)";
|
|
96
|
+
readonly customAspectRatio: (ratio: string) => string;
|
|
97
|
+
readonly minAspectRatio: (ratio: string) => string;
|
|
98
|
+
readonly maxAspectRatio: (ratio: string) => string;
|
|
99
|
+
readonly lowRes: "(max-resolution: 120dpi)";
|
|
100
|
+
readonly standardRes: "(min-resolution: 120dpi) and (max-resolution: 192dpi)";
|
|
101
|
+
readonly highRes: "(min-resolution: 192dpi)";
|
|
102
|
+
readonly customResolution: (dpi: number) => string;
|
|
103
|
+
readonly print: "print";
|
|
104
|
+
readonly screen: "screen";
|
|
105
|
+
readonly speech: "speech";
|
|
106
|
+
readonly iPhone: "(max-width: 428px)";
|
|
107
|
+
readonly iPad: "(min-width: 768px) and (max-width: 1024px)";
|
|
108
|
+
readonly desktopSmall: "(min-width: 1024px) and (max-width: 1440px)";
|
|
109
|
+
readonly desktopLarge: "(min-width: 1440px)";
|
|
110
|
+
readonly touchDevice: "(pointer: coarse)";
|
|
111
|
+
readonly mouseDevice: "(pointer: fine)";
|
|
112
|
+
readonly keyboardNavigation: "(hover: none) and (pointer: coarse)";
|
|
113
|
+
readonly wideColorGamut: "(color-gamut: p3)";
|
|
114
|
+
readonly standardColorGamut: "(color-gamut: srgb)";
|
|
115
|
+
readonly hdr: "(dynamic-range: high)";
|
|
116
|
+
readonly sdr: "(dynamic-range: standard)";
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Utility to combine multiple media queries
|
|
120
|
+
*/
|
|
121
|
+
export declare function combineMediaQueries(...queries: string[]): string;
|
|
122
|
+
/**
|
|
123
|
+
* Utility to create OR media queries
|
|
124
|
+
*/
|
|
125
|
+
export declare function orMediaQueries(...queries: string[]): string;
|
|
126
|
+
/**
|
|
127
|
+
* Create a responsive show/hide utility
|
|
128
|
+
*/
|
|
129
|
+
export declare function createResponsiveVisibility(config: {
|
|
130
|
+
showOn?: BreakpointKey[];
|
|
131
|
+
hideOn?: BreakpointKey[];
|
|
132
|
+
}): Signal<boolean>;
|
|
133
|
+
/**
|
|
134
|
+
* Debug utility to log current responsive state
|
|
135
|
+
*/
|
|
136
|
+
export declare function logResponsiveState(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Utility function to wrap existing modifier builder with responsive capabilities
|
|
139
|
+
*/
|
|
140
|
+
export declare function withResponsive<T>(value: T): T;
|
|
141
|
+
/**
|
|
142
|
+
* Development-only responsive debugging overlay
|
|
143
|
+
*/
|
|
144
|
+
export declare function enableResponsiveDebugOverlay(options?: {
|
|
145
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
146
|
+
showDimensions?: boolean;
|
|
147
|
+
showBreakpoint?: boolean;
|
|
148
|
+
}): void;
|
|
149
|
+
//# sourceMappingURL=utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../src/modifiers/responsive/utilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EAEhB,MAAM,SAAS,CAAA;AAMhB,OAAO,EAAgC,MAAM,EAAE,MAAM,cAAc,CAAA;AAEnE;;GAEG;AACH,wBAAgB,aAAa,IAAI;IAC/B,OAAO,EAAE,MAAM,CAAC,aAAa,CAAC,CAAA;IAC9B,OAAO,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAA;IAClC,OAAO,EAAE,CAAC,UAAU,EAAE,aAAa,KAAK,MAAM,CAAC,OAAO,CAAC,CAAA;IACvD,OAAO,EAAE,CAAC,UAAU,EAAE,aAAa,KAAK,MAAM,CAAC,OAAO,CAAC,CAAA;IACvD,SAAS,EAAE,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,KAAK,MAAM,CAAC,OAAO,CAAC,CAAA;IACtE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,OAAO,CAAC,CAAA;CAC5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,EAAE,aAAa,EAAE,CAAA;CACzB,GAAG,MAAM,CAAC,OAAO,CAAC,CAgBlB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CA0BzC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAI7C;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAA;IACpE,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,cAAc,CAAC,EAAE,OAAO,CAAA;CACpB,GACL,IAAI,CAwDN"}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tachui/responsive",
|
|
3
|
+
"version": "0.8.0-alpha",
|
|
4
|
+
"description": "Advanced responsive design patterns and utilities for tachUI framework",
|
|
5
|
+
"homepage": "https://tachui.dev/",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./modifiers": {
|
|
16
|
+
"types": "./dist/modifiers/index.d.ts",
|
|
17
|
+
"import": "./dist/modifiers/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@tachui/core": "0.8.0-alpha",
|
|
25
|
+
"@tachui/modifiers": "0.8.0-alpha"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^20.0.0",
|
|
29
|
+
"@types/jsdom": "^21.1.6",
|
|
30
|
+
"@vitest/coverage-v8": "^1.0.0",
|
|
31
|
+
"jsdom": "^23.2.0",
|
|
32
|
+
"typescript": "^5.2.0",
|
|
33
|
+
"vite": "^7.1.1",
|
|
34
|
+
"vitest": "^3.2.4"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"typescript": ">=5.0.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependenciesMeta": {
|
|
40
|
+
"typescript": {
|
|
41
|
+
"optional": true
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"ui",
|
|
46
|
+
"responsive",
|
|
47
|
+
"breakpoints",
|
|
48
|
+
"media-queries",
|
|
49
|
+
"container-queries",
|
|
50
|
+
"responsive-design",
|
|
51
|
+
"tachui",
|
|
52
|
+
"typescript"
|
|
53
|
+
],
|
|
54
|
+
"author": "tachUI Team",
|
|
55
|
+
"license": "MPL-2.0",
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "https://github.com/tach-UI/tachUI",
|
|
59
|
+
"directory": "packages/responsive"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "rm -rf dist && vite build && tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
63
|
+
"dev": "vite build --watch",
|
|
64
|
+
"valid": "clear && vitest run && pnpm type-check && pnpm lint && pnpm build",
|
|
65
|
+
"test": "vitest run",
|
|
66
|
+
"test:coverage": "vitest run --coverage",
|
|
67
|
+
"test:watch": "vitest",
|
|
68
|
+
"test:ci": "npm run test:run",
|
|
69
|
+
"type-check": "tsc --project tsconfig.type-check.json",
|
|
70
|
+
"clean": "rm -rf dist",
|
|
71
|
+
"lint": "oxlint src"
|
|
72
|
+
}
|
|
73
|
+
}
|