strata-react 1.0.3 → 1.0.4
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/README.md +1 -0
- package/dist/components/compare.d.ts +42 -0
- package/dist/components/fullscreen-frame.d.ts +16 -0
- package/dist/components/viewport.d.ts +41 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +563 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/viewport.d.ts +29 -0
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Zoom and pan of a picture inside its frame. `scale` 1 is the picture fitted; `x` and `y` are pixels from the centre. */
|
|
2
|
+
export type Viewport = {
|
|
3
|
+
scale: number;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
/** The picture fitted in its frame, not panned. */
|
|
8
|
+
export declare const FIT: Viewport;
|
|
9
|
+
/** The least zoom: the whole picture fitted. */
|
|
10
|
+
export declare const MIN_SCALE = 1;
|
|
11
|
+
/** The most zoom, 32 times the fit. */
|
|
12
|
+
export declare const MAX_SCALE = 32;
|
|
13
|
+
/** Keeps the picture from being dragged out of its frame: at most half the extra width or height past each edge. */
|
|
14
|
+
export declare function clampViewport(v: Viewport, frame: {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}): Viewport;
|
|
18
|
+
/** A new scale with the point under `at` (pixels from the frame's centre) staying under it. */
|
|
19
|
+
export declare function zoomAt(v: Viewport, nextScale: number, at: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}, frame: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
}): Viewport;
|
|
26
|
+
/** The scale at which the picture's own pixels are drawn one to one: its natural width over the width it is fitted at. */
|
|
27
|
+
export declare function actualPixelsScale(naturalWidth: number, fittedWidth: number): number;
|
|
28
|
+
/** The CSS transform for a viewport. */
|
|
29
|
+
export declare function viewportTransform(v: Viewport): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strata-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "React + Tailwind v4 components that ship structure, behaviour, states and a token contract, and no look: each product brings a theme generated from its own subject.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|