@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 +1 -1
- package/lib/theme/IdealImageLegacy/components/Icon/Download.d.ts +2 -2
- package/lib/theme/IdealImageLegacy/components/Icon/Loading.d.ts +2 -2
- package/lib/theme/IdealImageLegacy/components/Icon/Offline.d.ts +2 -2
- package/lib/theme/IdealImageLegacy/components/Icon/Warning.d.ts +2 -2
- package/lib/theme/IdealImageLegacy/components/Icon/index.d.ts +6 -6
- package/lib/theme/IdealImageLegacy/components/IdealImage/index.d.ts +20 -16
- package/lib/theme/IdealImageLegacy/components/IdealImage/waypoint.d.ts +1 -1
- package/lib/theme/IdealImageLegacy/components/IdealImageWithDefaults/index.d.ts +4 -4
- package/lib/theme/IdealImageLegacy/components/Media/index.d.ts +6 -6
- package/lib/theme/IdealImageLegacy/components/MediaWithDefaults/index.d.ts +4 -4
- package/lib/theme/IdealImageLegacy/components/composeStyle.d.ts +19 -1
- package/lib/theme/IdealImageLegacy/components/constants.d.ts +14 -22
- package/lib/theme/IdealImageLegacy/components/helpers.d.ts +11 -11
- package/lib/theme/IdealImageLegacy/components/icons.d.ts +9 -10
- package/lib/theme/IdealImageLegacy/components/loaders.d.ts +11 -4
- package/lib/theme/IdealImageLegacy/components/theme.d.ts +25 -29
- package/lib/theme/IdealImageLegacy/components/unfetch.d.ts +3 -2
- package/package.json +18 -18
- package/src/index.ts +1 -1
- package/src/plugin-ideal-image.d.ts +4 -2
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
|
|
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,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
declare
|
|
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
|
-
|
|
8
|
-
|
|
6
|
+
size?: number | undefined;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
export default Icon;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
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<
|
|
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
|
-
|
|
2
|
-
declare
|
|
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
|
-
})
|
|
33
|
-
|
|
32
|
+
}) => React.JSX.Element;
|
|
33
|
+
export default IdealImageWithDefaults;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
2
|
-
declare
|
|
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
|
-
})
|
|
33
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
4
|
-
export
|
|
5
|
-
export const supportsWebp: boolean;
|
|
6
|
-
export
|
|
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]:
|
|
3
|
-
[loading]:
|
|
7
|
+
[load]: typeof DownloadIcon;
|
|
8
|
+
[loading]: typeof LoadingIcon;
|
|
4
9
|
[loaded]: null;
|
|
5
|
-
[error]:
|
|
10
|
+
[error]: typeof WarningIcon;
|
|
6
11
|
[noicon]: null;
|
|
7
|
-
[offline]:
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
|
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
|
+
"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 &&
|
|
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": "
|
|
24
|
-
"@docusaurus/lqip-loader": "
|
|
25
|
-
"@docusaurus/responsive-loader": "^1.7.
|
|
26
|
-
"@docusaurus/theme-translations": "
|
|
27
|
-
"@docusaurus/types": "
|
|
28
|
-
"@docusaurus/utils-validation": "
|
|
29
|
-
"sharp": "^0.
|
|
30
|
-
"tslib": "^2.
|
|
31
|
-
"webpack": "^5.
|
|
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": "
|
|
35
|
-
"fs-extra": "^11.
|
|
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": "^
|
|
40
|
-
"react-dom": "^
|
|
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": ">=
|
|
48
|
+
"node": ">=24.14"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
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
|
|
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
|
-
|
|
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.
|