react-native-everything-responsive 0.0.0-stage → 1.0.1
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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +459 -2
- package/docs/API.md +311 -0
- package/lib/core/breakpoints.d.ts +28 -0
- package/lib/core/breakpoints.d.ts.map +1 -0
- package/lib/core/breakpoints.js +108 -0
- package/lib/core/breakpoints.js.map +1 -0
- package/lib/core/config.d.ts +24 -0
- package/lib/core/config.d.ts.map +1 -0
- package/lib/core/config.js +112 -0
- package/lib/core/config.js.map +1 -0
- package/lib/core/device.d.ts +31 -0
- package/lib/core/device.d.ts.map +1 -0
- package/lib/core/device.js +35 -0
- package/lib/core/device.js.map +1 -0
- package/lib/core/grid.d.ts +30 -0
- package/lib/core/grid.d.ts.map +1 -0
- package/lib/core/grid.js +37 -0
- package/lib/core/grid.js.map +1 -0
- package/lib/core/info.d.ts +26 -0
- package/lib/core/info.d.ts.map +1 -0
- package/lib/core/info.js +41 -0
- package/lib/core/info.js.map +1 -0
- package/lib/core/layout.d.ts +4 -0
- package/lib/core/layout.d.ts.map +1 -0
- package/lib/core/layout.js +31 -0
- package/lib/core/layout.js.map +1 -0
- package/lib/core/scaling.d.ts +28 -0
- package/lib/core/scaling.d.ts.map +1 -0
- package/lib/core/scaling.js +47 -0
- package/lib/core/scaling.js.map +1 -0
- package/lib/core/types.d.ts +153 -0
- package/lib/core/types.d.ts.map +1 -0
- package/lib/core/types.js +8 -0
- package/lib/core/types.js.map +1 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +54 -0
- package/lib/index.js.map +1 -0
- package/lib/native/ResponsiveGrid.d.ts +61 -0
- package/lib/native/ResponsiveGrid.d.ts.map +1 -0
- package/lib/native/ResponsiveGrid.js +110 -0
- package/lib/native/ResponsiveGrid.js.map +1 -0
- package/lib/native/ResponsiveProvider.d.ts +19 -0
- package/lib/native/ResponsiveProvider.d.ts.map +1 -0
- package/lib/native/ResponsiveProvider.js +26 -0
- package/lib/native/ResponsiveProvider.js.map +1 -0
- package/lib/native/ResponsiveView.d.ts +30 -0
- package/lib/native/ResponsiveView.d.ts.map +1 -0
- package/lib/native/ResponsiveView.js +51 -0
- package/lib/native/ResponsiveView.js.map +1 -0
- package/lib/native/Visibility.d.ts +45 -0
- package/lib/native/Visibility.d.ts.map +1 -0
- package/lib/native/Visibility.js +53 -0
- package/lib/native/Visibility.js.map +1 -0
- package/lib/native/context.d.ts +6 -0
- package/lib/native/context.d.ts.map +1 -0
- package/lib/native/context.js +12 -0
- package/lib/native/context.js.map +1 -0
- package/lib/native/createStyles.d.ts +46 -0
- package/lib/native/createStyles.d.ts.map +1 -0
- package/lib/native/createStyles.js +68 -0
- package/lib/native/createStyles.js.map +1 -0
- package/lib/native/hooks.d.ts +33 -0
- package/lib/native/hooks.d.ts.map +1 -0
- package/lib/native/hooks.js +68 -0
- package/lib/native/hooks.js.map +1 -0
- package/lib/native/platform.d.ts +10 -0
- package/lib/native/platform.d.ts.map +1 -0
- package/lib/native/platform.js +50 -0
- package/lib/native/platform.js.map +1 -0
- package/lib/native/snapshot.d.ts +8 -0
- package/lib/native/snapshot.d.ts.map +1 -0
- package/lib/native/snapshot.js +29 -0
- package/lib/native/snapshot.js.map +1 -0
- package/lib/native/store.d.ts +14 -0
- package/lib/native/store.d.ts.map +1 -0
- package/lib/native/store.js +51 -0
- package/lib/native/store.js.map +1 -0
- package/package.json +50 -4
- package/src/core/breakpoints.ts +101 -0
- package/src/core/config.ts +130 -0
- package/src/core/device.ts +46 -0
- package/src/core/grid.ts +54 -0
- package/src/core/info.ts +64 -0
- package/src/core/layout.ts +44 -0
- package/src/core/scaling.ts +62 -0
- package/src/core/types.ts +178 -0
- package/src/index.ts +59 -0
- package/src/native/ResponsiveGrid.tsx +159 -0
- package/src/native/ResponsiveProvider.tsx +30 -0
- package/src/native/ResponsiveView.tsx +98 -0
- package/src/native/Visibility.tsx +82 -0
- package/src/native/context.ts +11 -0
- package/src/native/createStyles.ts +94 -0
- package/src/native/hooks.ts +102 -0
- package/src/native/platform.ts +54 -0
- package/src/native/snapshot.ts +27 -0
- package/src/native/store.ts +58 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classifyDevice = classifyDevice;
|
|
4
|
+
/**
|
|
5
|
+
* Classifies the **hardware**, not the current window. An iPad in 1/3 split view is still
|
|
6
|
+
* a `tablet` (use breakpoints for layout), and a desktop browser resized to 400 dp is still
|
|
7
|
+
* a `desktop`.
|
|
8
|
+
*
|
|
9
|
+
* Rules:
|
|
10
|
+
* - TV flag → `tv`
|
|
11
|
+
* - Windows / macOS (react-native-windows / -macos) → `desktop`
|
|
12
|
+
* - iOS → `Platform.isPad` decides between `tablet` and `phone`
|
|
13
|
+
* - Web → fine pointer and long side ≥ `desktopMinWidth` → `desktop`;
|
|
14
|
+
* otherwise short side ≥ `tabletMinShortSide` → `tablet`; else `phone`
|
|
15
|
+
* - Android and others → short side ≥ `tabletMinShortSide` → `tablet` (the Android
|
|
16
|
+
* "sw600dp" convention, which also classifies unfolded foldables correctly)
|
|
17
|
+
*/
|
|
18
|
+
function classifyDevice(env, config) {
|
|
19
|
+
if (env.isTV)
|
|
20
|
+
return 'tv';
|
|
21
|
+
const os = env.os;
|
|
22
|
+
if (os === 'windows' || os === 'macos')
|
|
23
|
+
return 'desktop';
|
|
24
|
+
if (os === 'ios')
|
|
25
|
+
return env.isPad ? 'tablet' : 'phone';
|
|
26
|
+
const shortSide = Math.min(env.screenWidth, env.screenHeight);
|
|
27
|
+
const longSide = Math.max(env.screenWidth, env.screenHeight);
|
|
28
|
+
if (os === 'web') {
|
|
29
|
+
if (env.hasCoarsePointer !== true && longSide >= config.desktopMinWidth)
|
|
30
|
+
return 'desktop';
|
|
31
|
+
return shortSide >= config.tabletMinShortSide ? 'tablet' : 'phone';
|
|
32
|
+
}
|
|
33
|
+
return shortSide >= config.tabletMinShortSide ? 'tablet' : 'phone';
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/core/device.ts"],"names":[],"mappings":";;AA+BA,wCAcC;AA5BD;;;;;;;;;;;;;GAaG;AACH,SAAgB,cAAc,CAAC,GAAsB,EAAE,MAAwB;IAC7E,IAAI,GAAG,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAC1B,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC;IAClB,IAAI,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC;IACzD,IAAI,EAAE,KAAK,KAAK;QAAE,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IAExD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;IAE7D,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC;QACjB,IAAI,GAAG,CAAC,gBAAgB,KAAK,IAAI,IAAI,QAAQ,IAAI,MAAM,CAAC,eAAe;YAAE,OAAO,SAAS,CAAC;QAC1F,OAAO,SAAS,IAAI,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IACrE,CAAC;IACD,OAAO,SAAS,IAAI,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface GridInput {
|
|
2
|
+
/** Measured width of the grid container in dp. */
|
|
3
|
+
containerWidth: number;
|
|
4
|
+
/** Fixed column count. Ignored when `minItemWidth` is set. */
|
|
5
|
+
columns?: number;
|
|
6
|
+
/** Auto-fit mode: as many columns as fit with each item at least this wide. */
|
|
7
|
+
minItemWidth?: number;
|
|
8
|
+
/** Upper bound for the column count in auto-fit mode. */
|
|
9
|
+
maxColumns?: number;
|
|
10
|
+
/** Horizontal gap between columns in dp. */
|
|
11
|
+
columnGap: number;
|
|
12
|
+
/** Physical pixels per dp, used to floor widths onto the pixel grid. */
|
|
13
|
+
pixelRatio: number;
|
|
14
|
+
}
|
|
15
|
+
export interface GridLayout {
|
|
16
|
+
columns: number;
|
|
17
|
+
/** Width of each item, floored to a physical pixel so a row never overflows and wraps. */
|
|
18
|
+
itemWidth: number;
|
|
19
|
+
}
|
|
20
|
+
/** Floors a dp value to the physical pixel grid. */
|
|
21
|
+
export declare function floorToPixel(value: number, pixelRatio: number): number;
|
|
22
|
+
/**
|
|
23
|
+
* Computes column count and item width.
|
|
24
|
+
*
|
|
25
|
+
* Fixes the classic React Native grid bug: `width: '33.33%'` plus margins rounds up on some
|
|
26
|
+
* pixel densities, the row becomes 0.5px too wide, and the last item wraps onto a new line.
|
|
27
|
+
* Widths here are floored to the physical pixel grid, so rows always fit.
|
|
28
|
+
*/
|
|
29
|
+
export declare function computeGridLayout(input: GridInput): GridLayout;
|
|
30
|
+
//# sourceMappingURL=grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/core/grid.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,kDAAkD;IAClD,cAAc,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,oDAAoD;AACpD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAGtE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,CAmB9D"}
|
package/lib/core/grid.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.floorToPixel = floorToPixel;
|
|
4
|
+
exports.computeGridLayout = computeGridLayout;
|
|
5
|
+
/** Floors a dp value to the physical pixel grid. */
|
|
6
|
+
function floorToPixel(value, pixelRatio) {
|
|
7
|
+
const ratio = pixelRatio > 0 ? pixelRatio : 1;
|
|
8
|
+
return Math.floor(value * ratio + 1e-7) / ratio;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Computes column count and item width.
|
|
12
|
+
*
|
|
13
|
+
* Fixes the classic React Native grid bug: `width: '33.33%'` plus margins rounds up on some
|
|
14
|
+
* pixel densities, the row becomes 0.5px too wide, and the last item wraps onto a new line.
|
|
15
|
+
* Widths here are floored to the physical pixel grid, so rows always fit.
|
|
16
|
+
*/
|
|
17
|
+
function computeGridLayout(input) {
|
|
18
|
+
var _a;
|
|
19
|
+
const width = Math.max(0, input.containerWidth);
|
|
20
|
+
const gap = Math.max(0, input.columnGap);
|
|
21
|
+
let columns;
|
|
22
|
+
if (input.minItemWidth !== undefined && input.minItemWidth > 0) {
|
|
23
|
+
// CSS equivalent: repeat(auto-fill, minmax(minItemWidth, 1fr))
|
|
24
|
+
columns = Math.floor((width + gap) / (input.minItemWidth + gap));
|
|
25
|
+
if (input.maxColumns !== undefined && input.maxColumns > 0) {
|
|
26
|
+
columns = Math.min(columns, Math.floor(input.maxColumns));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
columns = Math.floor((_a = input.columns) !== null && _a !== void 0 ? _a : 1);
|
|
31
|
+
}
|
|
32
|
+
columns = Math.max(1, columns);
|
|
33
|
+
const available = width - gap * (columns - 1);
|
|
34
|
+
const itemWidth = Math.max(0, floorToPixel(available / columns, input.pixelRatio));
|
|
35
|
+
return { columns, itemWidth };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/core/grid.ts"],"names":[],"mappings":";;AAsBA,oCAGC;AASD,8CAmBC;AAhCD,oDAAoD;AACpD,SAAgB,YAAY,CAAC,KAAa,EAAE,UAAkB;IAC5D,MAAM,KAAK,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;AAClD,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,KAAgB;;IAChD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAChD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACzC,IAAI,OAAe,CAAC;IAEpB,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS,IAAI,KAAK,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;QAC/D,+DAA+D;QAC/D,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC,CAAC;QACjE,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;YAC3D,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAA,KAAK,CAAC,OAAO,mCAAI,CAAC,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAE/B,MAAM,SAAS,GAAG,KAAK,GAAG,GAAG,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,SAAS,GAAG,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IACnF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DeviceType, LayoutInfo, LayoutSource, ResponsiveConfig, ResponsiveInfo } from './types';
|
|
2
|
+
export interface ResponsiveInfoInput {
|
|
3
|
+
window: {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
screen: {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
fontScale: number;
|
|
12
|
+
pixelRatio: number;
|
|
13
|
+
deviceType: DeviceType;
|
|
14
|
+
config: ResponsiveConfig;
|
|
15
|
+
container: LayoutInfo | null;
|
|
16
|
+
source: LayoutSource;
|
|
17
|
+
round?: (value: number) => number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Combines window, container, device and scaling information into one object.
|
|
21
|
+
* The top-level layout fields (`width`, `breakpoint`, `select`, ...) describe the
|
|
22
|
+
* *active* area chosen by `source`; scaling and device fields always describe the
|
|
23
|
+
* real window and screen.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createResponsiveInfo(input: ResponsiveInfoInput): ResponsiveInfo;
|
|
26
|
+
//# sourceMappingURL=info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../src/core/info.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,UAAU,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,CAmC/E"}
|
package/lib/core/info.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createResponsiveInfo = createResponsiveInfo;
|
|
4
|
+
const layout_1 = require("./layout");
|
|
5
|
+
const scaling_1 = require("./scaling");
|
|
6
|
+
/**
|
|
7
|
+
* Combines window, container, device and scaling information into one object.
|
|
8
|
+
* The top-level layout fields (`width`, `breakpoint`, `select`, ...) describe the
|
|
9
|
+
* *active* area chosen by `source`; scaling and device fields always describe the
|
|
10
|
+
* real window and screen.
|
|
11
|
+
*/
|
|
12
|
+
function createResponsiveInfo(input) {
|
|
13
|
+
const { config, container, source, round } = input;
|
|
14
|
+
const windowLayout = (0, layout_1.createLayoutInfo)('window', input.window.width, input.window.height, config.breakpoints, round);
|
|
15
|
+
const active = source === 'window' ? windowLayout : container !== null && container !== void 0 ? container : windowLayout;
|
|
16
|
+
const scaler = (0, scaling_1.createScaler)({
|
|
17
|
+
width: input.window.width,
|
|
18
|
+
height: input.window.height,
|
|
19
|
+
fontScale: input.fontScale,
|
|
20
|
+
config,
|
|
21
|
+
round,
|
|
22
|
+
});
|
|
23
|
+
const deviceType = input.deviceType;
|
|
24
|
+
return Object.freeze({
|
|
25
|
+
...active,
|
|
26
|
+
...scaler,
|
|
27
|
+
deviceType,
|
|
28
|
+
isPhone: deviceType === 'phone',
|
|
29
|
+
isTablet: deviceType === 'tablet',
|
|
30
|
+
isDesktop: deviceType === 'desktop',
|
|
31
|
+
isTV: deviceType === 'tv',
|
|
32
|
+
screenWidth: input.screen.width,
|
|
33
|
+
screenHeight: input.screen.height,
|
|
34
|
+
fontScale: input.fontScale,
|
|
35
|
+
pixelRatio: input.pixelRatio,
|
|
36
|
+
window: windowLayout,
|
|
37
|
+
container,
|
|
38
|
+
config,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/core/info.ts"],"names":[],"mappings":";;AA4BA,oDAmCC;AA/DD,qCAA4C;AAC5C,uCAAyC;AAqBzC;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,KAA0B;IAC7D,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACnD,MAAM,YAAY,GAAG,IAAA,yBAAgB,EACnC,QAAQ,EACR,KAAK,CAAC,MAAM,CAAC,KAAK,EAClB,KAAK,CAAC,MAAM,CAAC,MAAM,EACnB,MAAM,CAAC,WAAW,EAClB,KAAK,CACN,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,YAAY,CAAC;IAC9E,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC;QAC1B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;QACzB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;QAC3B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,MAAM;QACN,KAAK;KACN,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IAEpC,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,GAAG,MAAM;QACT,GAAG,MAAM;QACT,UAAU;QACV,OAAO,EAAE,UAAU,KAAK,OAAO;QAC/B,QAAQ,EAAE,UAAU,KAAK,QAAQ;QACjC,SAAS,EAAE,UAAU,KAAK,SAAS;QACnC,IAAI,EAAE,UAAU,KAAK,IAAI;QACzB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;QAC/B,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;QACjC,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,MAAM,EAAE,YAAY;QACpB,SAAS;QACT,MAAM;KACkB,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Breakpoints, LayoutInfo } from './types';
|
|
2
|
+
/** Builds the immutable layout description for a window or container of a given size. */
|
|
3
|
+
export declare function createLayoutInfo(kind: 'window' | 'container', width: number, height: number, breakpoints: Breakpoints, round?: (value: number) => number): LayoutInfo;
|
|
4
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/core/layout.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAiB,WAAW,EAAE,UAAU,EAA+B,MAAM,SAAS,CAAC;AAInG,yFAAyF;AACzF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,QAAQ,GAAG,WAAW,EAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,KAAK,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAiB,GAC1C,UAAU,CAwBZ"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createLayoutInfo = createLayoutInfo;
|
|
4
|
+
const breakpoints_1 = require("./breakpoints");
|
|
5
|
+
const identity = (value) => value;
|
|
6
|
+
/** Builds the immutable layout description for a window or container of a given size. */
|
|
7
|
+
function createLayoutInfo(kind, width, height, breakpoints, round = identity) {
|
|
8
|
+
const breakpoint = (0, breakpoints_1.getBreakpoint)(width, breakpoints);
|
|
9
|
+
const isLandscape = width > height;
|
|
10
|
+
return Object.freeze({
|
|
11
|
+
kind,
|
|
12
|
+
width,
|
|
13
|
+
height,
|
|
14
|
+
breakpoint,
|
|
15
|
+
breakpoints,
|
|
16
|
+
orientation: isLandscape ? 'landscape' : 'portrait',
|
|
17
|
+
isPortrait: !isLandscape,
|
|
18
|
+
isLandscape,
|
|
19
|
+
from: (bp) => (0, breakpoints_1.isFrom)(breakpoint, bp),
|
|
20
|
+
below: (bp) => (0, breakpoints_1.isBelow)(breakpoint, bp),
|
|
21
|
+
between: (min, max) => (0, breakpoints_1.isBetween)(breakpoint, min, max),
|
|
22
|
+
only: (...bps) => {
|
|
23
|
+
const current = (0, breakpoints_1.breakpointIndex)(breakpoint);
|
|
24
|
+
return bps.some((bp) => (0, breakpoints_1.breakpointIndex)(bp) === current);
|
|
25
|
+
},
|
|
26
|
+
select: ((values) => (0, breakpoints_1.resolveResponsiveValue)(values, breakpoint)),
|
|
27
|
+
wp: (percent) => round((width * percent) / 100),
|
|
28
|
+
hp: (percent) => round((height * percent) / 100),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/core/layout.ts"],"names":[],"mappings":";;AAaA,4CA8BC;AA3CD,+CAOuB;AAGvB,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC;AAElD,yFAAyF;AACzF,SAAgB,gBAAgB,CAC9B,IAA4B,EAC5B,KAAa,EACb,MAAc,EACd,WAAwB,EACxB,QAAmC,QAAQ;IAE3C,MAAM,UAAU,GAAG,IAAA,2BAAa,EAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,CAAC;IACnC,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI;QACJ,KAAK;QACL,MAAM;QACN,UAAU;QACV,WAAW;QACX,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU;QACnD,UAAU,EAAE,CAAC,WAAW;QACxB,WAAW;QACX,IAAI,EAAE,CAAC,EAAiB,EAAE,EAAE,CAAC,IAAA,oBAAM,EAAC,UAAU,EAAE,EAAE,CAAC;QACnD,KAAK,EAAE,CAAC,EAAiB,EAAE,EAAE,CAAC,IAAA,qBAAO,EAAC,UAAU,EAAE,EAAE,CAAC;QACrD,OAAO,EAAE,CAAC,GAAkB,EAAE,GAAkB,EAAE,EAAE,CAAC,IAAA,uBAAS,EAAC,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC;QACpF,IAAI,EAAE,CAAC,GAAG,GAAoB,EAAE,EAAE;YAChC,MAAM,OAAO,GAAG,IAAA,6BAAe,EAAC,UAAU,CAAC,CAAC;YAC5C,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAA,6BAAe,EAAC,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC;QAC3D,CAAC;QACD,MAAM,EAAE,CAAC,CAAC,MAAmC,EAAE,EAAE,CAC/C,IAAA,oCAAsB,EAAC,MAAM,EAAE,UAAU,CAAC,CAAyB;QACrE,EAAE,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,GAAG,CAAC;QACvD,EAAE,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,CAAC;KACpC,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ResponsiveConfig, Scaler } from './types';
|
|
2
|
+
export interface ScalerInput {
|
|
3
|
+
/** Window width in dp. */
|
|
4
|
+
width: number;
|
|
5
|
+
/** Window height in dp. */
|
|
6
|
+
height: number;
|
|
7
|
+
/** System font scale (1 = default). */
|
|
8
|
+
fontScale: number;
|
|
9
|
+
config: ResponsiveConfig;
|
|
10
|
+
/** Pixel-rounding function. Defaults to identity (useful in tests and on the server). */
|
|
11
|
+
round?: (value: number) => number;
|
|
12
|
+
}
|
|
13
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
14
|
+
/**
|
|
15
|
+
* Creates orientation-stable, clamped scaling helpers.
|
|
16
|
+
*
|
|
17
|
+
* Why this is different from the usual `width / 375` approach:
|
|
18
|
+
* 1. **Orientation-stable**: it scales by the *short* side (and the *long* side for
|
|
19
|
+
* vertical sizes), so rotating a phone does not suddenly make everything 2x bigger.
|
|
20
|
+
* 2. **Clamped**: on a 1366 dp wide iPad Pro, naive scaling gives 3.6x. Here the factor
|
|
21
|
+
* is clamped to `[minScale, maxScale]`, and large screens should use breakpoints to
|
|
22
|
+
* show *more content*, not bigger content.
|
|
23
|
+
* 3. **Pixel-perfect**: results are rounded to physical pixels to avoid blurry borders
|
|
24
|
+
* and 1px gaps.
|
|
25
|
+
* 4. **Accessible fonts**: `fs()` honours the user's font size setting up to a cap.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createScaler({ width, height, fontScale, config, round }: ScalerInput): Scaler;
|
|
28
|
+
//# sourceMappingURL=scaling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaling.d.ts","sourceRoot":"","sources":["../../src/core/scaling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,gBAAgB,CAAC;IACzB,yFAAyF;IACzF,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACnC;AAID,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAgB,EAAE,EAAE,WAAW,GAAG,MAAM,CA4BxG"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clamp = clamp;
|
|
4
|
+
exports.createScaler = createScaler;
|
|
5
|
+
const identity = (value) => value;
|
|
6
|
+
function clamp(value, min, max) {
|
|
7
|
+
return Math.min(max, Math.max(min, value));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates orientation-stable, clamped scaling helpers.
|
|
11
|
+
*
|
|
12
|
+
* Why this is different from the usual `width / 375` approach:
|
|
13
|
+
* 1. **Orientation-stable**: it scales by the *short* side (and the *long* side for
|
|
14
|
+
* vertical sizes), so rotating a phone does not suddenly make everything 2x bigger.
|
|
15
|
+
* 2. **Clamped**: on a 1366 dp wide iPad Pro, naive scaling gives 3.6x. Here the factor
|
|
16
|
+
* is clamped to `[minScale, maxScale]`, and large screens should use breakpoints to
|
|
17
|
+
* show *more content*, not bigger content.
|
|
18
|
+
* 3. **Pixel-perfect**: results are rounded to physical pixels to avoid blurry borders
|
|
19
|
+
* and 1px gaps.
|
|
20
|
+
* 4. **Accessible fonts**: `fs()` honours the user's font size setting up to a cap.
|
|
21
|
+
*/
|
|
22
|
+
function createScaler({ width, height, fontScale, config, round = identity }) {
|
|
23
|
+
const shortSide = Math.max(0, Math.min(width, height));
|
|
24
|
+
const longSide = Math.max(0, Math.max(width, height));
|
|
25
|
+
const baseShort = Math.min(config.guidelineBaseWidth, config.guidelineBaseHeight);
|
|
26
|
+
const baseLong = Math.max(config.guidelineBaseWidth, config.guidelineBaseHeight);
|
|
27
|
+
// A 0x0 window happens during server rendering and in some headless tests.
|
|
28
|
+
const rawScale = shortSide > 0 ? shortSide / baseShort : 1;
|
|
29
|
+
const rawVerticalScale = longSide > 0 ? longSide / baseLong : 1;
|
|
30
|
+
const scaleFactor = clamp(rawScale, config.minScale, config.maxScale);
|
|
31
|
+
const verticalScaleFactor = clamp(rawVerticalScale, config.minScale, config.maxScale);
|
|
32
|
+
const safeFontScale = fontScale > 0 && Number.isFinite(fontScale) ? fontScale : 1;
|
|
33
|
+
// React Native multiplies every font size by fontScale. Dividing first and
|
|
34
|
+
// multiplying by the capped value means the *rendered* size honours the user's
|
|
35
|
+
// setting only up to maxFontScale.
|
|
36
|
+
const fontCompensation = Math.min(safeFontScale, config.maxFontScale) / safeFontScale;
|
|
37
|
+
const moderate = (size, factor) => size + (size * scaleFactor - size) * factor;
|
|
38
|
+
return Object.freeze({
|
|
39
|
+
scaleFactor,
|
|
40
|
+
verticalScaleFactor,
|
|
41
|
+
s: (size) => round(size * scaleFactor),
|
|
42
|
+
vs: (size) => round(size * verticalScaleFactor),
|
|
43
|
+
ms: (size, factor = 0.5) => round(moderate(size, factor)),
|
|
44
|
+
fs: (size, factor = 0.5) => round(moderate(size, factor) * fontCompensation),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=scaling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaling.js","sourceRoot":"","sources":["../../src/core/scaling.ts"],"names":[],"mappings":";;AAgBA,sBAEC;AAeD,oCA4BC;AA/CD,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC;AAElD,SAAgB,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IAC3D,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,GAAG,QAAQ,EAAe;IAC9F,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,MAAM,S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CAAC;QAC9C,EAAE,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,GAAG,mBAAmB,CAAC;QACvD,EAAE,EAAE,CAAC,IAAY,EAAE,MAAM,GAAG,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACjE,EAAE,EAAE,CAAC,IAAY,EAAE,MAAM,GAAG,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,gBAAgB,CAAC;KACrF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions for ReactNativeEverythingResponsive.
|
|
3
|
+
*
|
|
4
|
+
* This file is platform-free: it must never import from `react` or `react-native`.
|
|
5
|
+
*/
|
|
6
|
+
/** The six named breakpoints, ordered from smallest to largest. */
|
|
7
|
+
export type BreakpointKey = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
8
|
+
/** Minimum width (in density-independent pixels, "dp") at which each breakpoint starts. */
|
|
9
|
+
export type Breakpoints = Readonly<Record<BreakpointKey, number>>;
|
|
10
|
+
/**
|
|
11
|
+
* A value that changes with the breakpoint. Mobile-first: a key applies from that
|
|
12
|
+
* breakpoint upward until a larger key overrides it. `base` is an alias for "smallest".
|
|
13
|
+
*
|
|
14
|
+
* @example { xs: 1, md: 2, xl: 4 } // 1 column on phones, 2 on tablets, 4 on desktops
|
|
15
|
+
*/
|
|
16
|
+
export type ResponsiveObject<T> = {
|
|
17
|
+
readonly [K in BreakpointKey | 'base']?: T;
|
|
18
|
+
};
|
|
19
|
+
/** Either a plain value or a per-breakpoint object. */
|
|
20
|
+
export type ResponsiveValue<T> = T | ResponsiveObject<T>;
|
|
21
|
+
/** Hardware class of the device (based on the physical screen, not the app window). */
|
|
22
|
+
export type DeviceType = 'phone' | 'tablet' | 'desktop' | 'tv';
|
|
23
|
+
export type Orientation = 'portrait' | 'landscape';
|
|
24
|
+
/**
|
|
25
|
+
* Where layout measurements come from:
|
|
26
|
+
* - `window`: the app window (correct in split-screen / multi-window, unlike the screen).
|
|
27
|
+
* - `container`: the nearest `<ResponsiveView>` ancestor (container queries).
|
|
28
|
+
* - `auto` (default): the nearest container if there is one, otherwise the window.
|
|
29
|
+
*/
|
|
30
|
+
export type LayoutSource = 'auto' | 'window' | 'container';
|
|
31
|
+
/** Fully resolved configuration. */
|
|
32
|
+
export interface ResponsiveConfig {
|
|
33
|
+
/** Breakpoint start widths in dp. Must be strictly ascending. */
|
|
34
|
+
readonly breakpoints: Breakpoints;
|
|
35
|
+
/** Width of the device the design was drawn for (dp). Default 375 (iPhone 11 Pro/X class). */
|
|
36
|
+
readonly guidelineBaseWidth: number;
|
|
37
|
+
/** Height of the device the design was drawn for (dp). Default 812. */
|
|
38
|
+
readonly guidelineBaseHeight: number;
|
|
39
|
+
/** Lower bound for the scale factor, so tiny phones never shrink UI too much. */
|
|
40
|
+
readonly minScale: number;
|
|
41
|
+
/** Upper bound for the scale factor, so tablets/desktops never blow UI up 3x. */
|
|
42
|
+
readonly maxScale: number;
|
|
43
|
+
/**
|
|
44
|
+
* Upper bound for the user's system font scale that `fs()` will honour.
|
|
45
|
+
* Default 2 (meets WCAG 1.4.4 "resize text to 200%").
|
|
46
|
+
*/
|
|
47
|
+
readonly maxFontScale: number;
|
|
48
|
+
/** Shortest screen side (dp) from which an Android/web device counts as a tablet. Default 600. */
|
|
49
|
+
readonly tabletMinShortSide: number;
|
|
50
|
+
/** Longest screen side (dp) from which a fine-pointer web device counts as a desktop. Default 1024. */
|
|
51
|
+
readonly desktopMinWidth: number;
|
|
52
|
+
}
|
|
53
|
+
/** Partial configuration accepted by `<ResponsiveProvider config={...}>`. */
|
|
54
|
+
export interface ResponsiveConfigInput {
|
|
55
|
+
breakpoints?: Partial<Record<BreakpointKey, number>>;
|
|
56
|
+
guidelineBaseWidth?: number;
|
|
57
|
+
guidelineBaseHeight?: number;
|
|
58
|
+
minScale?: number;
|
|
59
|
+
maxScale?: number;
|
|
60
|
+
maxFontScale?: number;
|
|
61
|
+
tabletMinShortSide?: number;
|
|
62
|
+
desktopMinWidth?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Helper constraint that keeps literal types when inferring generics, so
|
|
66
|
+
* `select({ xs: 'column', md: 'row' })` is typed `'column' | 'row'`, not `string`.
|
|
67
|
+
*/
|
|
68
|
+
export type Narrowable = string | number | bigint | boolean | symbol | object | null | undefined;
|
|
69
|
+
/** Union of the values of a responsive object literal. */
|
|
70
|
+
export type SelectResult<V> = Exclude<V[keyof V], undefined>;
|
|
71
|
+
/** Measurements and breakpoint helpers for one layout area (window or container). */
|
|
72
|
+
export interface LayoutInfo {
|
|
73
|
+
/** Which area these measurements describe. */
|
|
74
|
+
readonly kind: 'window' | 'container';
|
|
75
|
+
readonly width: number;
|
|
76
|
+
readonly height: number;
|
|
77
|
+
/** The active breakpoint for `width`. */
|
|
78
|
+
readonly breakpoint: BreakpointKey;
|
|
79
|
+
/** The breakpoint table used for this area. */
|
|
80
|
+
readonly breakpoints: Breakpoints;
|
|
81
|
+
readonly orientation: Orientation;
|
|
82
|
+
readonly isPortrait: boolean;
|
|
83
|
+
readonly isLandscape: boolean;
|
|
84
|
+
/** True when the current breakpoint is `bp` or larger. */
|
|
85
|
+
from(bp: BreakpointKey): boolean;
|
|
86
|
+
/** True when the current breakpoint is strictly smaller than `bp`. */
|
|
87
|
+
below(bp: BreakpointKey): boolean;
|
|
88
|
+
/** True when `min <= current < max`. */
|
|
89
|
+
between(min: BreakpointKey, max: BreakpointKey): boolean;
|
|
90
|
+
/** True when the current breakpoint is one of `bps`. */
|
|
91
|
+
only(...bps: BreakpointKey[]): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Pick the value for the current breakpoint (mobile-first cascade).
|
|
94
|
+
* Literal and mixed types are inferred: `select({ xs: '100%', md: 320 })` → `'100%' | 320`.
|
|
95
|
+
*/
|
|
96
|
+
select<const V extends ResponsiveObject<unknown>>(values: V): SelectResult<V>;
|
|
97
|
+
select<T extends Narrowable>(values: ResponsiveValue<T>): T;
|
|
98
|
+
/** Percentage of the area's width, rounded to the nearest physical pixel. */
|
|
99
|
+
wp(percent: number): number;
|
|
100
|
+
/** Percentage of the area's height, rounded to the nearest physical pixel. */
|
|
101
|
+
hp(percent: number): number;
|
|
102
|
+
}
|
|
103
|
+
/** Size-scaling helpers. All results are rounded to the nearest physical pixel. */
|
|
104
|
+
export interface Scaler {
|
|
105
|
+
/** Clamped horizontal scale factor (short screen side / guideline width). */
|
|
106
|
+
readonly scaleFactor: number;
|
|
107
|
+
/** Clamped vertical scale factor (long screen side / guideline height). */
|
|
108
|
+
readonly verticalScaleFactor: number;
|
|
109
|
+
/** Scale linearly with the short side (widths, icon sizes, horizontal spacing). */
|
|
110
|
+
s(size: number): number;
|
|
111
|
+
/** Scale linearly with the long side (heights, vertical spacing). */
|
|
112
|
+
vs(size: number): number;
|
|
113
|
+
/** Scale partially: `factor` 0 = no scaling, 1 = full `s()`. Default 0.5. */
|
|
114
|
+
ms(size: number, factor?: number): number;
|
|
115
|
+
/**
|
|
116
|
+
* Font size: moderately scaled, and compensated so the user's system font scale
|
|
117
|
+
* is honoured only up to `config.maxFontScale`.
|
|
118
|
+
*/
|
|
119
|
+
fs(size: number, factor?: number): number;
|
|
120
|
+
}
|
|
121
|
+
/** Facts about the physical device and accessibility settings. */
|
|
122
|
+
export interface DeviceInfo {
|
|
123
|
+
readonly deviceType: DeviceType;
|
|
124
|
+
readonly isPhone: boolean;
|
|
125
|
+
readonly isTablet: boolean;
|
|
126
|
+
readonly isDesktop: boolean;
|
|
127
|
+
readonly isTV: boolean;
|
|
128
|
+
readonly screenWidth: number;
|
|
129
|
+
readonly screenHeight: number;
|
|
130
|
+
/** The user's system font scale (1 = default). */
|
|
131
|
+
readonly fontScale: number;
|
|
132
|
+
/** Physical pixels per dp. */
|
|
133
|
+
readonly pixelRatio: number;
|
|
134
|
+
}
|
|
135
|
+
/** Everything `useResponsive()` returns. */
|
|
136
|
+
export interface ResponsiveInfo extends LayoutInfo, Scaler, DeviceInfo {
|
|
137
|
+
/** Layout info for the app window, always available. */
|
|
138
|
+
readonly window: LayoutInfo;
|
|
139
|
+
/** Layout info for the nearest `<ResponsiveView>`, or `null` when there is none. */
|
|
140
|
+
readonly container: LayoutInfo | null;
|
|
141
|
+
readonly config: ResponsiveConfig;
|
|
142
|
+
}
|
|
143
|
+
/** Unwraps a responsive object type to the union of its values (type level only). */
|
|
144
|
+
export type UnwrapResponsive<V> = V extends readonly unknown[] ? V : V extends object ? [Exclude<keyof V, BreakpointKey | 'base'>] extends [never] ? Exclude<V[keyof V], undefined> : V : V;
|
|
145
|
+
/** A style object whose responsive values have been resolved. */
|
|
146
|
+
export type ResolvedStyle<S> = {
|
|
147
|
+
[K in keyof S]: UnwrapResponsive<S[K]>;
|
|
148
|
+
};
|
|
149
|
+
/** A named style sheet whose responsive values have been resolved. */
|
|
150
|
+
export type ResolvedStyles<T> = {
|
|
151
|
+
[P in keyof T]: ResolvedStyle<T[P]>;
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mEAAmE;AACnE,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAErE,2FAA2F;AAC3F,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAAE,QAAQ,EAAE,CAAC,IAAI,aAAa,GAAG,MAAM,CAAC,CAA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cAAe,SAAQ,UAAU,EAAE,MAAM,EAAE,UAAU;IACpE,wDAAwD;IACxD,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;CACnC;AAED,qFAAqF;AACrF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,OAAO,EAAE,GAC1D,CAAC,GACD,CAAC,SAAS,MAAM,GACd,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACxD,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,GAC9B,CAAC,GACH,CAAC,CAAC;AAER,iEAAiE;AACjE,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAE1E,sEAAsE;AACtE,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Core type definitions for ReactNativeEverythingResponsive.
|
|
4
|
+
*
|
|
5
|
+
* This file is platform-free: it must never import from `react` or `react-native`.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ReactNativeEverythingResponsive
|
|
3
|
+
* Zero-dependency responsive design toolkit for React Native.
|
|
4
|
+
*/
|
|
5
|
+
export { ResponsiveProvider } from './native/ResponsiveProvider';
|
|
6
|
+
export type { ResponsiveProviderProps } from './native/ResponsiveProvider';
|
|
7
|
+
export { ResponsiveView } from './native/ResponsiveView';
|
|
8
|
+
export type { ResponsiveViewProps } from './native/ResponsiveView';
|
|
9
|
+
export { ResponsiveGrid, useGridLayout } from './native/ResponsiveGrid';
|
|
10
|
+
export type { GridLayoutResult, GridOptions, ResponsiveGridProps } from './native/ResponsiveGrid';
|
|
11
|
+
export { Hide, Show, matchesConditions, useMatches } from './native/Visibility';
|
|
12
|
+
export type { VisibilityConditions, VisibilityProps } from './native/Visibility';
|
|
13
|
+
export { useBreakpoint, useResponsive, useResponsiveConfig, useResponsiveValue } from './native/hooks';
|
|
14
|
+
export type { SourceOptions } from './native/hooks';
|
|
15
|
+
export { createStyles, resolveStyles, useResponsiveStyles } from './native/createStyles';
|
|
16
|
+
export type { AnyResponsiveStyle, ResponsiveNamedStyles, ResponsiveStyle } from './native/createStyles';
|
|
17
|
+
export { getResponsive } from './native/snapshot';
|
|
18
|
+
export { BREAKPOINT_KEYS, DEFAULT_BREAKPOINTS, DEFAULT_CONFIG, createConfig } from './core/config';
|
|
19
|
+
export { getBreakpoint, isBelow, isBetween, isFrom, isResponsiveObject, resolveResponsiveValue, } from './core/breakpoints';
|
|
20
|
+
export { createScaler } from './core/scaling';
|
|
21
|
+
export { classifyDevice } from './core/device';
|
|
22
|
+
export type { DeviceEnvironment } from './core/device';
|
|
23
|
+
export { computeGridLayout, floorToPixel } from './core/grid';
|
|
24
|
+
export type { GridInput, GridLayout } from './core/grid';
|
|
25
|
+
export type { BreakpointKey, Breakpoints, DeviceInfo, DeviceType, LayoutInfo, LayoutSource, Orientation, ResolvedStyle, ResolvedStyles, ResponsiveConfig, ResponsiveConfigInput, ResponsiveInfo, ResponsiveObject, ResponsiveValue, Scaler, SelectResult, } from './core/types';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,YAAY,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChF,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGjF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACvG,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACzF,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxG,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACnG,OAAO,EACL,aAAa,EACb,OAAO,EACP,SAAS,EACT,MAAM,EACN,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzD,YAAY,EACV,aAAa,EACb,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,MAAM,EACN,YAAY,GACb,MAAM,cAAc,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ReactNativeEverythingResponsive
|
|
4
|
+
* Zero-dependency responsive design toolkit for React Native.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.floorToPixel = exports.computeGridLayout = exports.classifyDevice = exports.createScaler = exports.resolveResponsiveValue = exports.isResponsiveObject = exports.isFrom = exports.isBetween = exports.isBelow = exports.getBreakpoint = exports.createConfig = exports.DEFAULT_CONFIG = exports.DEFAULT_BREAKPOINTS = exports.BREAKPOINT_KEYS = exports.getResponsive = exports.useResponsiveStyles = exports.resolveStyles = exports.createStyles = exports.useResponsiveValue = exports.useResponsiveConfig = exports.useResponsive = exports.useBreakpoint = exports.useMatches = exports.matchesConditions = exports.Show = exports.Hide = exports.useGridLayout = exports.ResponsiveGrid = exports.ResponsiveView = exports.ResponsiveProvider = void 0;
|
|
8
|
+
// Components
|
|
9
|
+
var ResponsiveProvider_1 = require("./native/ResponsiveProvider");
|
|
10
|
+
Object.defineProperty(exports, "ResponsiveProvider", { enumerable: true, get: function () { return ResponsiveProvider_1.ResponsiveProvider; } });
|
|
11
|
+
var ResponsiveView_1 = require("./native/ResponsiveView");
|
|
12
|
+
Object.defineProperty(exports, "ResponsiveView", { enumerable: true, get: function () { return ResponsiveView_1.ResponsiveView; } });
|
|
13
|
+
var ResponsiveGrid_1 = require("./native/ResponsiveGrid");
|
|
14
|
+
Object.defineProperty(exports, "ResponsiveGrid", { enumerable: true, get: function () { return ResponsiveGrid_1.ResponsiveGrid; } });
|
|
15
|
+
Object.defineProperty(exports, "useGridLayout", { enumerable: true, get: function () { return ResponsiveGrid_1.useGridLayout; } });
|
|
16
|
+
var Visibility_1 = require("./native/Visibility");
|
|
17
|
+
Object.defineProperty(exports, "Hide", { enumerable: true, get: function () { return Visibility_1.Hide; } });
|
|
18
|
+
Object.defineProperty(exports, "Show", { enumerable: true, get: function () { return Visibility_1.Show; } });
|
|
19
|
+
Object.defineProperty(exports, "matchesConditions", { enumerable: true, get: function () { return Visibility_1.matchesConditions; } });
|
|
20
|
+
Object.defineProperty(exports, "useMatches", { enumerable: true, get: function () { return Visibility_1.useMatches; } });
|
|
21
|
+
// Hooks
|
|
22
|
+
var hooks_1 = require("./native/hooks");
|
|
23
|
+
Object.defineProperty(exports, "useBreakpoint", { enumerable: true, get: function () { return hooks_1.useBreakpoint; } });
|
|
24
|
+
Object.defineProperty(exports, "useResponsive", { enumerable: true, get: function () { return hooks_1.useResponsive; } });
|
|
25
|
+
Object.defineProperty(exports, "useResponsiveConfig", { enumerable: true, get: function () { return hooks_1.useResponsiveConfig; } });
|
|
26
|
+
Object.defineProperty(exports, "useResponsiveValue", { enumerable: true, get: function () { return hooks_1.useResponsiveValue; } });
|
|
27
|
+
var createStyles_1 = require("./native/createStyles");
|
|
28
|
+
Object.defineProperty(exports, "createStyles", { enumerable: true, get: function () { return createStyles_1.createStyles; } });
|
|
29
|
+
Object.defineProperty(exports, "resolveStyles", { enumerable: true, get: function () { return createStyles_1.resolveStyles; } });
|
|
30
|
+
Object.defineProperty(exports, "useResponsiveStyles", { enumerable: true, get: function () { return createStyles_1.useResponsiveStyles; } });
|
|
31
|
+
// Non-reactive access
|
|
32
|
+
var snapshot_1 = require("./native/snapshot");
|
|
33
|
+
Object.defineProperty(exports, "getResponsive", { enumerable: true, get: function () { return snapshot_1.getResponsive; } });
|
|
34
|
+
// Pure utilities (platform-free)
|
|
35
|
+
var config_1 = require("./core/config");
|
|
36
|
+
Object.defineProperty(exports, "BREAKPOINT_KEYS", { enumerable: true, get: function () { return config_1.BREAKPOINT_KEYS; } });
|
|
37
|
+
Object.defineProperty(exports, "DEFAULT_BREAKPOINTS", { enumerable: true, get: function () { return config_1.DEFAULT_BREAKPOINTS; } });
|
|
38
|
+
Object.defineProperty(exports, "DEFAULT_CONFIG", { enumerable: true, get: function () { return config_1.DEFAULT_CONFIG; } });
|
|
39
|
+
Object.defineProperty(exports, "createConfig", { enumerable: true, get: function () { return config_1.createConfig; } });
|
|
40
|
+
var breakpoints_1 = require("./core/breakpoints");
|
|
41
|
+
Object.defineProperty(exports, "getBreakpoint", { enumerable: true, get: function () { return breakpoints_1.getBreakpoint; } });
|
|
42
|
+
Object.defineProperty(exports, "isBelow", { enumerable: true, get: function () { return breakpoints_1.isBelow; } });
|
|
43
|
+
Object.defineProperty(exports, "isBetween", { enumerable: true, get: function () { return breakpoints_1.isBetween; } });
|
|
44
|
+
Object.defineProperty(exports, "isFrom", { enumerable: true, get: function () { return breakpoints_1.isFrom; } });
|
|
45
|
+
Object.defineProperty(exports, "isResponsiveObject", { enumerable: true, get: function () { return breakpoints_1.isResponsiveObject; } });
|
|
46
|
+
Object.defineProperty(exports, "resolveResponsiveValue", { enumerable: true, get: function () { return breakpoints_1.resolveResponsiveValue; } });
|
|
47
|
+
var scaling_1 = require("./core/scaling");
|
|
48
|
+
Object.defineProperty(exports, "createScaler", { enumerable: true, get: function () { return scaling_1.createScaler; } });
|
|
49
|
+
var device_1 = require("./core/device");
|
|
50
|
+
Object.defineProperty(exports, "classifyDevice", { enumerable: true, get: function () { return device_1.classifyDevice; } });
|
|
51
|
+
var grid_1 = require("./core/grid");
|
|
52
|
+
Object.defineProperty(exports, "computeGridLayout", { enumerable: true, get: function () { return grid_1.computeGridLayout; } });
|
|
53
|
+
Object.defineProperty(exports, "floorToPixel", { enumerable: true, get: function () { return grid_1.floorToPixel; } });
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,aAAa;AACb,kEAAiE;AAAxD,wHAAA,kBAAkB,OAAA;AAE3B,0DAAyD;AAAhD,gHAAA,cAAc,OAAA;AAEvB,0DAAwE;AAA/D,gHAAA,cAAc,OAAA;AAAE,+GAAA,aAAa,OAAA;AAEtC,kDAAgF;AAAvE,kGAAA,IAAI,OAAA;AAAE,kGAAA,IAAI,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAAE,wGAAA,UAAU,OAAA;AAGlD,QAAQ;AACR,wCAAuG;AAA9F,sGAAA,aAAa,OAAA;AAAE,sGAAA,aAAa,OAAA;AAAE,4GAAA,mBAAmB,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAE9E,sDAAyF;AAAhF,4GAAA,YAAY,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,mHAAA,mBAAmB,OAAA;AAGzD,sBAAsB;AACtB,8CAAkD;AAAzC,yGAAA,aAAa,OAAA;AAEtB,iCAAiC;AACjC,wCAAmG;AAA1F,yGAAA,eAAe,OAAA;AAAE,6GAAA,mBAAmB,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,sGAAA,YAAY,OAAA;AAC3E,kDAO4B;AAN1B,4GAAA,aAAa,OAAA;AACb,sGAAA,OAAO,OAAA;AACP,wGAAA,SAAS,OAAA;AACT,qGAAA,MAAM,OAAA;AACN,iHAAA,kBAAkB,OAAA;AAClB,qHAAA,sBAAsB,OAAA;AAExB,0CAA8C;AAArC,uGAAA,YAAY,OAAA;AACrB,wCAA+C;AAAtC,wGAAA,cAAc,OAAA;AAEvB,oCAA8D;AAArD,yGAAA,iBAAiB,OAAA;AAAE,oGAAA,YAAY,OAAA"}
|