@docusaurus/plugin-ideal-image 3.10.2 → 4.0.0-canary-6809

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/lib/index.js CHANGED
@@ -52,7 +52,7 @@ function pluginIdealImage(context, options) {
52
52
  options: {
53
53
  // Don't emit for server-side rendering
54
54
  emitFile: !isServer,
55
- // eslint-disable-next-line global-require
55
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
56
56
  adapter: require('@docusaurus/responsive-loader/sharp'),
57
57
  name: 'assets/ideal-img/[name].[hash:hex:7].[width].[ext]',
58
58
  ...loaderOptions,
@@ -1,3 +1,3 @@
1
- export default Download;
2
- declare function Download(props: any): React.JSX.Element;
3
1
  import React from 'react';
2
+ declare const Download: (props: any) => React.JSX.Element;
3
+ export default Download;
@@ -1,3 +1,3 @@
1
- export default Loading;
2
- declare function Loading(props: any): React.JSX.Element;
3
1
  import React from 'react';
2
+ declare const Loading: (props: any) => React.JSX.Element;
3
+ export default Loading;
@@ -1,3 +1,3 @@
1
- export default Offline;
2
- declare function Offline(props: any): React.JSX.Element;
3
1
  import React from 'react';
2
+ declare const Offline: (props: any) => React.JSX.Element;
3
+ export default Offline;
@@ -1,3 +1,3 @@
1
- export default Warning;
2
- declare function Warning(props: any): React.JSX.Element;
3
1
  import React from 'react';
2
+ declare const Warning: (props: any) => React.JSX.Element;
3
+ export default Warning;
@@ -1,8 +1,8 @@
1
- export default Icon;
2
- declare function Icon({ size, fill, className, path }: {
3
- size?: number | undefined;
4
- fill?: string | undefined;
1
+ import React from 'react';
2
+ declare const Icon: ({ size, fill, className, path }: {
5
3
  className: any;
4
+ fill?: string | undefined;
6
5
  path: any;
7
- }): React.JSX.Element;
8
- import React from 'react';
6
+ size?: number | undefined;
7
+ }) => React.JSX.Element;
8
+ export default Icon;
@@ -1,16 +1,13 @@
1
- export default class IdealImage extends React.Component<any, any, any> {
2
- static defaultProps: {
3
- shouldAutoDownload: ({ connection, size, threshold, possiblySlowNetwork, }: {
4
- connection: any;
5
- size: any;
6
- threshold: any;
7
- possiblySlowNetwork: any;
8
- }) => boolean;
9
- getMessage: (icon: any, state: any) => "Loading..." | "Your browser is offline. Image not loaded" | "404. Image not found" | "Error. Click to reload" | (string | React.JSX.Element)[] | "Click to load" | null;
10
- getIcon: (state: any) => string;
11
- loader: string;
12
- };
13
- constructor(props: any);
1
+ import React, { Component } from 'react';
2
+ declare const defaultShouldAutoDownload: ({ connection, size, threshold, possiblySlowNetwork, }: {
3
+ connection: any;
4
+ possiblySlowNetwork: any;
5
+ size: any;
6
+ threshold: any;
7
+ }) => boolean;
8
+ declare const defaultGetMessage: (icon: any, state: any) => "404. Image not found" | "Click to load" | "Error. Click to reload" | "Loading..." | "Your browser is offline. Image not loaded" | (string | React.JSX.Element)[] | null;
9
+ declare const defaultGetIcon: (state: any) => string;
10
+ export default class IdealImage extends Component {
14
11
  state: {
15
12
  loadState: string;
16
13
  connection: {
@@ -24,14 +21,21 @@ export default class IdealImage extends React.Component<any, any, any> {
24
21
  userTriggered: boolean;
25
22
  possiblySlowNetwork: boolean;
26
23
  };
27
- componentDidMount(): void;
28
24
  updateConnection: (() => void) | undefined;
29
25
  possiblySlowNetworkListener: ((e: any) => void) | undefined;
30
26
  updateOnlineStatus: (() => void) | undefined;
27
+ loader: Promise<any> | undefined;
28
+ constructor(props: any);
29
+ static defaultProps: {
30
+ shouldAutoDownload: typeof defaultShouldAutoDownload;
31
+ getMessage: typeof defaultGetMessage;
32
+ getIcon: typeof defaultGetIcon;
33
+ loader: string;
34
+ };
35
+ componentDidMount(): void;
31
36
  componentWillUnmount(): void;
32
37
  onClick: () => void;
33
38
  clear(): void;
34
- loader: Promise<any> | undefined;
35
39
  cancel(userTriggered: any): void;
36
40
  loadStateChange(loadState: any, userTriggered: any, loadInfo?: null): void;
37
41
  load: (userTriggered: any) => void;
@@ -39,4 +43,4 @@ export default class IdealImage extends React.Component<any, any, any> {
39
43
  onLeave: () => void;
40
44
  render(): React.JSX.Element;
41
45
  }
42
- import React from 'react';
46
+ export {};
@@ -6,5 +6,5 @@ type Props = {
6
6
  onLeave: () => void;
7
7
  children: ReactNode;
8
8
  };
9
- export declare function Waypoint(props: Props): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
9
+ export declare function Waypoint(props: Props): string | number | bigint | boolean | React.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | null | undefined;
10
10
  export {};
@@ -1,5 +1,5 @@
1
- export default IdealImageWithDefaults;
2
- declare function IdealImageWithDefaults({ icons: iconsProp, theme: themeProp, ...props }: {
1
+ import React from 'react';
2
+ declare const IdealImageWithDefaults: ({ icons: iconsProp, theme: themeProp, ...props }: {
3
3
  [x: string]: any;
4
4
  icons?: {
5
5
  [x: string]: ((props: any) => React.JSX.Element) | null;
@@ -29,5 +29,5 @@ declare function IdealImageWithDefaults({ icons: iconsProp, theme: themeProp, ..
29
29
  left: number;
30
30
  };
31
31
  } | undefined;
32
- }): React.JSX.Element;
33
- import React from 'react';
32
+ }) => React.JSX.Element;
33
+ export default IdealImageWithDefaults;
@@ -1,20 +1,20 @@
1
- export default class Media extends React.PureComponent<any, any, any> {
1
+ import React, { PureComponent } from 'react';
2
+ export default class Media extends PureComponent {
3
+ state: {
4
+ isMounted: boolean;
5
+ };
6
+ dimensionElement: SVGSVGElement | null | undefined;
2
7
  static defaultProps: {
3
8
  iconColor: string;
4
9
  iconSize: number;
5
10
  };
6
11
  constructor(props: any);
7
- state: {
8
- isMounted: boolean;
9
- };
10
12
  componentDidMount(): void;
11
13
  renderIcon(props: any): React.DetailedReactHTMLElement<{
12
14
  className: string;
13
15
  style: object;
14
16
  }, HTMLElement> | null;
15
17
  renderImage(props: any): React.JSX.Element;
16
- dimensionElement: SVGSVGElement | null | undefined;
17
18
  renderNoscript(props: any): React.JSX.Element | null;
18
19
  render(): React.JSX.Element;
19
20
  }
20
- import React from 'react';
@@ -1,5 +1,5 @@
1
- export default MediaWithDefaults;
2
- declare function MediaWithDefaults({ icons: iconsProp, theme: themeProp, ...props }: {
1
+ import React from 'react';
2
+ declare const MediaWithDefaults: ({ icons: iconsProp, theme: themeProp, ...props }: {
3
3
  [x: string]: any;
4
4
  icons?: {
5
5
  [x: string]: ((props: any) => React.JSX.Element) | null;
@@ -29,5 +29,5 @@ declare function MediaWithDefaults({ icons: iconsProp, theme: themeProp, ...prop
29
29
  left: number;
30
30
  };
31
31
  } | undefined;
32
- }): React.JSX.Element;
33
- import React from 'react';
32
+ }) => React.JSX.Element;
33
+ export default MediaWithDefaults;
@@ -1,5 +1,23 @@
1
+ export default _default;
2
+ /**
3
+ * Composes styles and/or classes
4
+ *
5
+ * For classes it will concat them in in one string
6
+ * and return as `className` property.
7
+ * Alternative is https://github.com/JedWatson/classnames
8
+ *
9
+ * For objects it will merge them in one object
10
+ * and return as `style` property.
11
+ *
12
+ * Usage:
13
+ * Assume you have `theme` object, which can be css-module
14
+ * or object or other css-in-js compatible with css-module
15
+ *
16
+ * <a {...compose(theme.link, theme.active, {color: "#000"})}>link</a>
17
+ *
18
+ * @returns {{className: string, style: object}} - params for React component
19
+ */
1
20
  declare function _default(...stylesOrClasses: any[]): {
2
21
  className: string;
3
22
  style: object;
4
23
  };
5
- export default _default;
@@ -1,22 +1,14 @@
1
- export namespace icons {
2
- export { load };
3
- export { loading };
4
- export { loaded };
5
- export { error };
6
- export { noicon };
7
- export { offline };
8
- }
9
- export namespace loadStates {
10
- export { initial };
11
- export { loading };
12
- export { loaded };
13
- export { error };
14
- }
15
- declare const load: "load";
16
- declare const loading: "loading";
17
- declare const loaded: "loaded";
18
- declare const error: "error";
19
- declare const noicon: "noicon";
20
- declare const offline: "offline";
21
- declare const initial: "initial";
22
- export {};
1
+ export declare const icons: {
2
+ load: string;
3
+ loading: string;
4
+ loaded: string;
5
+ error: string;
6
+ noicon: string;
7
+ offline: string;
8
+ };
9
+ export declare const loadStates: {
10
+ initial: string;
11
+ loading: string;
12
+ loaded: string;
13
+ error: string;
14
+ };
@@ -1,17 +1,17 @@
1
- export const ssr: boolean;
2
- export const nativeConnection: boolean;
3
- export function guessMaxImageWidth(dimensions: any, w: any): number;
4
- export function bytesToSize(bytes: any): string;
5
- export const supportsWebp: boolean;
6
- export function selectSrc({ srcSet, maxImageWidth, supportsWebp }: {
7
- srcSet: any;
1
+ export declare const ssr: boolean;
2
+ export declare const nativeConnection: boolean;
3
+ export declare const guessMaxImageWidth: (dimensions: any, w: any) => number;
4
+ export declare const bytesToSize: (bytes: any) => string;
5
+ export declare const supportsWebp: boolean;
6
+ export declare const selectSrc: ({ srcSet, maxImageWidth, supportsWebp }: {
8
7
  maxImageWidth: any;
9
- supportsWebp: any;
10
- }): any;
11
- export function fallbackParams({ srcSet, getUrl }: {
12
8
  srcSet: any;
9
+ supportsWebp: any;
10
+ }) => any;
11
+ export declare const fallbackParams: ({ srcSet, getUrl }: {
13
12
  getUrl: any;
14
- }): {
13
+ srcSet: any;
14
+ }) => {
15
15
  nsSrcSet?: undefined;
16
16
  nsSrc?: undefined;
17
17
  ssr?: undefined;
@@ -1,15 +1,14 @@
1
+ import DownloadIcon from './Icon/Download';
2
+ import OfflineIcon from './Icon/Offline';
3
+ import WarningIcon from './Icon/Warning';
4
+ import LoadingIcon from './Icon/Loading';
5
+ declare const load: string, loading: string, loaded: string, error: string, noicon: string, offline: string;
1
6
  declare const _default: {
2
- [load]: (props: any) => import("react").JSX.Element;
3
- [loading]: (props: any) => import("react").JSX.Element;
7
+ [load]: typeof DownloadIcon;
8
+ [loading]: typeof LoadingIcon;
4
9
  [loaded]: null;
5
- [error]: (props: any) => import("react").JSX.Element;
10
+ [error]: typeof WarningIcon;
6
11
  [noicon]: null;
7
- [offline]: (props: any) => import("react").JSX.Element;
12
+ [offline]: typeof OfflineIcon;
8
13
  };
9
14
  export default _default;
10
- declare const load: string;
11
- declare const loading: string;
12
- declare const loaded: string;
13
- declare const error: string;
14
- declare const noicon: string;
15
- declare const offline: string;
@@ -1,4 +1,11 @@
1
- export function combineCancel(p1: Promise<any>, p2: Promise<any>): Promise<any>;
2
- export function timeout(threshold: any): Promise<any>;
3
- export function imageLoader(src: any): Promise<any>;
4
- export function xhrLoader(url: any, options: any): Promise<any>;
1
+ /**
2
+ * returns new "promise" with cancel function combined
3
+ *
4
+ * @param {Promise} p1 - first "promise" with cancel
5
+ * @param {Promise} p2 - second "promise" with cancel
6
+ * @returns {Promise} - new "promise" with cancel
7
+ */
8
+ export declare const combineCancel: (p1: Promise<any>, p2: Promise<any>) => Promise<any>;
9
+ export declare const timeout: (threshold: any) => Promise<any>;
10
+ export declare const imageLoader: (src: any) => Promise<any>;
11
+ export declare const xhrLoader: (url: any, options: any) => Promise<any>;
@@ -1,30 +1,26 @@
1
- declare namespace _default {
2
- namespace placeholder {
3
- let backgroundSize: string;
4
- let backgroundRepeat: string;
5
- let position: string;
6
- }
7
- namespace img {
8
- let width: string;
9
- let height: string;
10
- let maxWidth: string;
11
- let marginBottom: string;
12
- }
13
- namespace icon {
14
- let position_1: string;
15
- export { position_1 as position };
16
- export let top: string;
17
- export let left: string;
18
- export let transform: string;
19
- export let textAlign: string;
20
- }
21
- namespace noscript {
22
- let position_2: string;
23
- export { position_2 as position };
24
- let top_1: number;
25
- export { top_1 as top };
26
- let left_1: number;
27
- export { left_1 as left };
28
- }
29
- }
1
+ declare const _default: {
2
+ placeholder: {
3
+ backgroundSize: string;
4
+ backgroundRepeat: string;
5
+ position: string;
6
+ };
7
+ img: {
8
+ width: string;
9
+ height: string;
10
+ maxWidth: string;
11
+ marginBottom: string;
12
+ };
13
+ icon: {
14
+ position: string;
15
+ top: string;
16
+ left: string;
17
+ transform: string;
18
+ textAlign: string;
19
+ };
20
+ noscript: {
21
+ position: string;
22
+ top: number;
23
+ left: number;
24
+ };
25
+ };
30
26
  export default _default;
@@ -1,7 +1,8 @@
1
- export class UnfetchAbortController {
1
+ export declare class UnfetchAbortController {
2
2
  signal: {
3
3
  onabort: () => void;
4
4
  };
5
5
  abort: () => void;
6
+ constructor();
6
7
  }
7
- export function unfetch(url: any, options: any): Promise<any>;
8
+ export declare const unfetch: (url: any, options: any) => Promise<any>;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-ideal-image",
3
- "version": "3.10.2",
3
+ "version": "4.0.0-canary-6809",
4
4
  "description": "Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder).",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-ideal-image.d.ts",
7
7
  "scripts": {
8
- "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"",
8
+ "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js && oxfmt \"lib/theme/**/*.js\"",
9
9
  "watch": "run-p -c copy:watch build:watch",
10
10
  "build:watch": "tsc --build --watch",
11
11
  "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
@@ -20,24 +20,24 @@
20
20
  },
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@docusaurus/core": "3.10.2",
24
- "@docusaurus/lqip-loader": "3.10.2",
25
- "@docusaurus/responsive-loader": "^1.7.0",
26
- "@docusaurus/theme-translations": "3.10.2",
27
- "@docusaurus/types": "3.10.2",
28
- "@docusaurus/utils-validation": "3.10.2",
29
- "sharp": "^0.32.3",
30
- "tslib": "^2.6.0",
31
- "webpack": "^5.88.1"
23
+ "@docusaurus/core": "4.0.0-canary-6809",
24
+ "@docusaurus/lqip-loader": "4.0.0-canary-6809",
25
+ "@docusaurus/responsive-loader": "^1.7.1",
26
+ "@docusaurus/theme-translations": "4.0.0-canary-6809",
27
+ "@docusaurus/types": "4.0.0-canary-6809",
28
+ "@docusaurus/utils-validation": "4.0.0-canary-6809",
29
+ "sharp": "^0.35.1",
30
+ "tslib": "^2.8.1",
31
+ "webpack": "^5.110.3"
32
32
  },
33
33
  "devDependencies": {
34
- "@docusaurus/module-type-aliases": "3.10.2",
35
- "fs-extra": "^11.1.0"
34
+ "@docusaurus/module-type-aliases": "4.0.0-canary-6809",
35
+ "fs-extra": "^11.4.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "jimp": "*",
39
- "react": "^18.0.0 || ^19.0.0",
40
- "react-dom": "^18.0.0 || ^19.0.0"
38
+ "jimp": "^1.6.1",
39
+ "react": "^19.3.0",
40
+ "react-dom": "^19.3.0"
41
41
  },
42
42
  "peerDependenciesMeta": {
43
43
  "jimp": {
@@ -45,7 +45,7 @@
45
45
  }
46
46
  },
47
47
  "engines": {
48
- "node": ">=20.0"
48
+ "node": ">=24.14"
49
49
  },
50
- "gitHead": "f37f9035584917a97a260b91fc2842cba4f8b94f"
50
+ "gitHead": "db942b07f3529b5359bcae27ab3796cb07dec10e"
51
51
  }
package/src/index.ts CHANGED
@@ -67,7 +67,7 @@ export default function pluginIdealImage(
67
67
  options: {
68
68
  // Don't emit for server-side rendering
69
69
  emitFile: !isServer,
70
- // eslint-disable-next-line global-require
70
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
71
71
  adapter: require('@docusaurus/responsive-loader/sharp'),
72
72
  name: 'assets/ideal-img/[name].[hash:hex:7].[width].[ext]',
73
73
  ...loaderOptions,
@@ -118,8 +118,10 @@ declare module '@theme/IdealImageLegacy' {
118
118
 
119
119
  type ThemeKey = 'placeholder' | 'img' | 'icon' | 'noscript';
120
120
 
121
- export interface ImageProps
122
- extends Omit<ComponentProps<'img'>, 'srcSet' | 'placeholder'> {
121
+ export interface ImageProps extends Omit<
122
+ ComponentProps<'img'>,
123
+ 'srcSet' | 'placeholder'
124
+ > {
123
125
  /**
124
126
  * This function decides what icon to show based on the current state of the
125
127
  * component.