@rezo-zero/intervention-request
TypeScript icon, indicating that this package has built-in type declarations

1.3.3 • Public • Published

Built With Stencil

Intervention Request JS

Web component for building HTML picture tags using Intervention Request images

Installation

From npm registry

yarn add @rezo-zero/intervention-request

or

npm install @rezo-zero/intervention-request

Framework integration

See details on StencilJS documentation

Usage

<intervention-request
    src="folder/filename.jpg"
    alt="My sample image"
    baseUrl="https://intervention-request.test"
    width="1280"
    height="768"
    formats='{
         "width": 1024,
         "height": 768,
         "media": [
             {"srcset":[{"format":{"fit":"1920x980","quality":80},"rule":"1x"}, {"format":{"fit":"3840x1960","quality":80},"rule":"2x"}], "rule":"(min-width: 1280px)"},
             {"srcset":[{"format":{"fit":"768x320","quality":80},"rule":"1x"}], "rule":"(min-width: 768px)"},
             {"srcset":[{"format":{"fit":"400x280","quality":80},"rule":"1x"}]}
         ]
     }'>
</intervention-request>

Attributes

See all available components attributes here

Styling

CSS variables applied to image

:root {
    --ir-object-fit: fill;
    --ir-object-position: inherit;
    --ir-width: 100%;
    --ir-height: auto;
    --ir-aspect-ratio: inherit;
}

Global configurations & overrides

A common configuration can be defined via the global variable interventionRequestJS as follows

/**
 * Override intervention request default configurations
 * @type InterventionRequestConfigurations
 */
window.interventionRequestJS = {
    /**
     * Enable debug mode
     */
    debug: true,

    /**
     * Default strategy
     * Applied on each element without strategy props provided
     */
    strategy: 'default',

    /**
     * Default loading typee
     */
    loading: 'lazy',

    /**
     * Strategies config overrides
     */
    strategies: {
        default: { baseUrl: 'http://intervention.local/assets' },
        cloudinary: { baseUrl: 'https://res.cloudinary.com/demo/image/upload' }

        /**
         * New strategy can be added here
         * @type InterventionRequestStrategy
         */
    },

    /**
     * Default media options
     * Applied on every media if no props override provided
     */
    mediaOptions: {
        quality: 100,
        progressive: 0
    }
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.3.357latest

Version History

VersionDownloads (Last 7 Days)Published
1.3.357
1.3.22
1.3.10
1.3.01
1.2.60
1.2.50
1.2.40
1.2.30
1.2.20
1.2.10
1.2.00
1.1.00
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00
0.0.60
0.0.50
0.0.40
0.0.30
0.0.20
0.0.11

Package Sidebar

Install

npm i @rezo-zero/intervention-request

Weekly Downloads

61

Version

1.3.3

License

MIT

Unpacked Size

1.3 MB

Total Files

131

Last publish

Collaborators

  • ambroisemaupate
  • ravorona
  • rz_hakim
  • manuelodelain