Current collected state Current
Observed since 20 Oct, 19:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
3h-resize
A front-end resizing lib.
A front-end resizing lib.
// Supports both UMD and ECMAScripts imports.
export as namespace HR;
// Using `debounce` helper from `3h-utils`.
import { DebounceWrapper } from "3h-utils";
/**
* Type of input data of sizing handlers.
*/
export interface SizingInput {
paddingTop: number;
paddingRight: number;
paddingBottom: number;
paddingLeft: number;
containerWidth: number;
containerHeight: number;
targetWidth: number;
targetHeight: number;
}
/**
* Type of output results of sizing handlers.
*/
export interface SizingOutput {
width: number;
height: number;
left: number;
top: number;
scale: number;
}
/**
* Type of sizing handlers.
*/
export declare type SizingHandler = (input: SizingInput) => SizingOutput;
/**
* Built-in sizing handlers.
*/
export declare namespace Sizing {
/**
* Scale target to fill available space.
* (scale: 1)
*/
const fill: SizingHandler;
/**
* Scale target to fill available space.
* (scale: `availableWidth / targetWidth`)
*/
const fixedWidth: SizingHandler;
/**
* Scale target to fill available space.
* (scale: `availableHeight / targetHeight`)
*/
const fixedHeight: SizingHandler;
/**
* Scale target to fill available space and align it in the center.
* (scale: `min(availableWidth / targetWidth, availableHeight / targetHeight)`)
*/
const semifixed: SizingHandler;
/**
* Scale target to fit available space and align it in the center.
* (scale: `min(availableWidth / targetWidth, availableHeight / targetHeight)`)
*/
const contain: SizingHandler;
/**
* Simply align the target in the center. (scale: 1)
*/
const center: SizingHandler;
}
export declare type ResizeCallback = (result: SizingOutput) => void;
export declare type ResizerOptions = Partial<{
/**
* Whether the resizer is active.
* (If this is `true`, `update` will be
* automatically invoked in constructor.)
* @default true
*/
active: boolean;
/**
* The target element.
* @default null
*/
target: HTMLElement | null;
/**
* The container element.
* @default target && target.parentElement
*/
container: HTMLElement | null;
/**
* The desired width of the target.
* @default 0
*/
width: number;
/**
* The desired height of the target.
* @default 0
*/
height: number;
/**
* The sizing handler.
* @default Sizing.center
*/
sizing: SizingHandler;
/**
* The top padding of the container.
* @default options.padding
*/
paddingTop: number;
/**
* The right padding of the container.
* @default options.padding
*/
paddingRight: number;
/**
* The bottom padding of the container.
* @default options.padding
*/
paddingBottom: number;
/**
* The left padding of the container.
* @default options.padding
*/
paddingLeft: number;
/**
* The default value of `padding*`.
* @default 0
*/
padding: number;
/**
* The callback that should be invoked on resize.
* @default null
*/
callback: ResizeCallback | null;
/**
* Whether to invoke `update` on resize events.
* (Refers to `resize` and `orientationchange` events on `window`.)
* @default true
*/
autoResize: boolean;
}>;
export declare class Resizer {
/**
* Constructor of {@link Resizer}.
*/
constructor(options?: ResizerOptions);
/**
* Whether the resizer is active.
* (If this is `true`, `update` will be
* automatically invoked in constructor.)
* @default true
*/
active: boolean;
/**
* The target element.
* @default null
*/
target: HTMLElement | null;
/**
* The container element.
* @default target && target.parentElement
*/
container: HTMLElement | null;
/**
* The desired width of the target.
* @default 0
*/
width: number;
/**
* The desired height of the target.
* @default 0
*/
height: number;
/**
* The sizing handler.
* @default Sizing.center
*/
sizing: SizingHandler;
/**
* The top padding of the container.
* @default options.padding
*/
paddingTop: number;
/**
* The right padding of the container.
* @default options.padding
*/
paddingRight: number;
/**
* The bottom padding of the container.
* @default options.padding
*/
paddingBottom: number;
/**
* The left padding of the container.
* @default options.padding
*/
paddingLeft: number;
/**
* The callback that should be invoked on resize.
* @default null
*/
callback: ResizeCallback | null;
/**
* Resize the target synchronously.
*/
updateSync(callback?: ResizeCallback): void;
/**
* Update the target asynchronously.
* (Debounced; Default timeout: 100ms.)
*/
update: DebounceWrapper<(callback?: ResizeCallback) => void>;
/**
* The event listener that invokes `update`.
* (bound to this)
*/
onResize(): void;
}
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
3h-utilsEnvironment{
"local_name": "3h-utils",
"alias": false,
"peer_metadata": null
} | ^0.2.0 | runtime |
@babel/coreEnvironment{
"local_name": "@babel/core",
"alias": false,
"peer_metadata": null
} | ^7.10.0 | development |
@babel/preset-envEnvironment{
"local_name": "@babel/preset-env",
"alias": false,
"peer_metadata": null
} | ^7.10.0 | development |
@rollup/plugin-babelEnvironment{
"local_name": "@rollup/plugin-babel",
"alias": false,
"peer_metadata": null
} | ^5.2.0 | development |
@rollup/plugin-node-resolveEnvironment{
"local_name": "@rollup/plugin-node-resolve",
"alias": false,
"peer_metadata": null
} | ^13.1.3 | development |
rollupEnvironment{
"local_name": "rollup",
"alias": false,
"peer_metadata": null
} | ^2.26.0 | development |
terserEnvironment{
"local_name": "terser",
"alias": false,
"peer_metadata": null
} | ^5.2.0 | development |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^4.0.0 | development |
Source distribution
{
"integrity": "sha512-BP6f8qxfgoC1sSv3VyDu27BqOUnHj/Dk3Snt8kwlvaSQzgz5NTIfEmuw42cyP4Djo1PAjBJ3XbV9qyk/KbbfLQ==",
"shasum": "66364588ef491e5182570a5eca673319844bb97a",
"tarball": "https://registry.npmjs.org/3h-resize/-/3h-resize-0.4.0.tgz",
"fileCount": 11,
"unpackedSize": 38663,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiDiqtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo4uA/+MuVBuycyPoG+5YjH9xRuS8XG//+ZDrDdzJilfLT85GznX3Ry\r\neAZkubcinLukkQEAyCnWRHs6OJT9x4GYuB5Z3dzbPzuY0ruWRbba7sy4l2tp\r\ns31rZtZxXwr1ejbJQTCrAXaWgnfArwmBIJcKXkACruyGtclB7D9mPl8d8LJz\r\nMnWuubvxxiHNIKg2MZBCM19iGEB+4N/p73m3ErER17rQtpXY0LhkMo0wkIYN\r\n/QDsIOK2dZeGUvFC/ONuQkdnHJID5MjjFCpDHfGlh2zQxSzMSYX3yoixGz7v\r\n/GypYAYhsrneBhl1DU7m2rc7fFJsczWudnM3dvg29IiGf6v6fEKPoqke/ZFr\r\nNueIKHtexLUGv1JYJbIQXo3eoO9o2EL4pw74j0hNhUDH4gBVst9FcOPVlajA\r\nzMpzqkwx96W48aTDkyMgdaxPs+gsSjSh4wZNcLHR5mZQisAdlIDoyKkAPHI4\r\nF6AWVNl7xY1oXm6C5n6oETRtiUsbIYMxm+ciRr71moPLYY+/Pw2M1+H3cSoQ\r\nZ3bp6ltKc6j+1tR9fjpLKd7VHPJa44+nsFHUgIsiYamQMWwppw7EYJJ0xlD1\r\nTo7i6qc2EF9dKLTuWggLaiDi0FHk0kvlcwH4Y7l/zzJmcPgZ2Qa13kIgouJz\r\nfObJ5+t0IbaRGcOVUGrrHQxBfwkMQbUZAKg=\r\n=3Qiw\r\n-----END PGP SIGNATURE-----\r\n",
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEYCIQCa6AQmHWzlKf5K0J9927sfXa6aTVzcG/pe+btGB5p5DAIhAJpln21iB3Yv7Qlc+NFKqrDoPAXvA9jvRMfvejdPF8Ft"
}
]
}Observed since 20 Oct, 19:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:ddade4b738a5483e1a4ff64b04865262af888b2e7927291b8f38287c7cab97d7