@mts-pjsc/image-optimize 1.2.0 → 1.2.2

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 CHANGED
@@ -17,12 +17,20 @@ Features:
17
17
  ### Before use
18
18
  [The optimization microservice](https://github.com/MobileTeleSystems/image-optimize) must be deployed on the server along the path `/optimizer`. React component will use it.
19
19
 
20
+ ### Instalation
21
+ Run script:
22
+ ```
23
+ npm i @mts-pjsc/image-optimize
24
+ ```
25
+
20
26
  ### Using
21
27
 
22
28
  Just replace the \<img\> element with the Image component from the package. The component is fully compatible with the \<img\> element. Next, the component will do all the magic on its own.
23
29
 
24
30
  Sample:
25
31
  ```typescript
32
+ import {Image} from "@mts-pjsc/image-optimize";
33
+
26
34
  <Image
27
35
  alt="Sample of work Image Optimizer"
28
36
  src="/static/landing/images-getmeback/phone-fon.png"
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import { Component } from "react";
2
2
  export interface IImageOptions extends React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> {
3
3
  src: string;
4
4
  alt: string;
@@ -6,7 +6,7 @@ export interface IImageOptions extends React.DetailedHTMLProps<React.ImgHTMLAttr
6
6
  quality?: number;
7
7
  setRef?: (elem: HTMLImageElement | null) => void;
8
8
  }
9
- export declare class Image<P extends IImageOptions> extends React.Component<P> {
9
+ export declare class Image<P extends IImageOptions> extends Component<P> {
10
10
  static isShowDiagnostic: boolean;
11
11
  static controlPoints: number[];
12
12
  /**
@@ -1,3 +1,5 @@
1
+ // For Next.js 13 and react 18. Switch component for support server components later.
2
+ "use client";
1
3
  var __rest = (this && this.__rest) || function (s, e) {
2
4
  var t = {};
3
5
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -10,9 +12,9 @@ var __rest = (this && this.__rest) || function (s, e) {
10
12
  return t;
11
13
  };
12
14
  import { jsx as _jsx } from "react/jsx-runtime";
13
- import * as React from "react";
15
+ import { Component } from "react";
14
16
  import { getFormatFeatures } from "../helpers/get-format-features.js";
15
- export class Image extends React.Component {
17
+ export class Image extends Component {
16
18
  constructor(props) {
17
19
  super(props);
18
20
  this.resultUrl = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mts-pjsc/image-optimize",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "React component for image optimizer",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",