@docusaurus/plugin-ideal-image 3.7.0-canary-6263 → 3.7.0-canary-6264

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.
Files changed (64) hide show
  1. package/lib/theme/IdealImage/index.js +1 -2
  2. package/lib/theme/IdealImageLegacy/LICENSE +20 -0
  3. package/lib/theme/IdealImageLegacy/README.md +13 -0
  4. package/lib/theme/IdealImageLegacy/components/Icon/Download.d.ts +3 -0
  5. package/lib/theme/IdealImageLegacy/components/Icon/Download.js +15 -0
  6. package/lib/theme/IdealImageLegacy/components/Icon/Loading.d.ts +3 -0
  7. package/lib/theme/IdealImageLegacy/components/Icon/Loading.js +15 -0
  8. package/lib/theme/IdealImageLegacy/components/Icon/Offline.d.ts +3 -0
  9. package/lib/theme/IdealImageLegacy/components/Icon/Offline.js +15 -0
  10. package/lib/theme/IdealImageLegacy/components/Icon/Warning.d.ts +3 -0
  11. package/lib/theme/IdealImageLegacy/components/Icon/Warning.js +15 -0
  12. package/lib/theme/IdealImageLegacy/components/Icon/index.d.ts +8 -0
  13. package/lib/theme/IdealImageLegacy/components/Icon/index.js +25 -0
  14. package/lib/theme/IdealImageLegacy/components/IdealImage/index.d.ts +42 -0
  15. package/lib/theme/IdealImageLegacy/components/IdealImage/index.js +353 -0
  16. package/lib/theme/IdealImageLegacy/components/IdealImageWithDefaults/index.d.ts +33 -0
  17. package/lib/theme/IdealImageLegacy/components/IdealImageWithDefaults/index.js +12 -0
  18. package/lib/theme/IdealImageLegacy/components/Media/index.d.ts +20 -0
  19. package/lib/theme/IdealImageLegacy/components/Media/index.js +169 -0
  20. package/lib/theme/IdealImageLegacy/components/MediaWithDefaults/README.md +89 -0
  21. package/lib/theme/IdealImageLegacy/components/MediaWithDefaults/index.d.ts +33 -0
  22. package/lib/theme/IdealImageLegacy/components/MediaWithDefaults/index.js +12 -0
  23. package/lib/theme/IdealImageLegacy/components/composeStyle.d.ts +5 -0
  24. package/lib/theme/IdealImageLegacy/components/composeStyle.js +37 -0
  25. package/lib/theme/IdealImageLegacy/components/constants.d.ts +22 -0
  26. package/lib/theme/IdealImageLegacy/components/constants.js +24 -0
  27. package/lib/theme/IdealImageLegacy/components/helpers.d.ts +22 -0
  28. package/lib/theme/IdealImageLegacy/components/helpers.js +142 -0
  29. package/lib/theme/IdealImageLegacy/components/icons.d.ts +15 -0
  30. package/lib/theme/IdealImageLegacy/components/icons.js +16 -0
  31. package/lib/theme/IdealImageLegacy/components/loaders.d.ts +4 -0
  32. package/lib/theme/IdealImageLegacy/components/loaders.js +112 -0
  33. package/lib/theme/IdealImageLegacy/components/theme.d.ts +30 -0
  34. package/lib/theme/IdealImageLegacy/components/theme.js +26 -0
  35. package/lib/theme/IdealImageLegacy/components/theme.module.css +35 -0
  36. package/lib/theme/IdealImageLegacy/components/unfetch.d.ts +7 -0
  37. package/lib/theme/IdealImageLegacy/components/unfetch.js +74 -0
  38. package/lib/theme/IdealImageLegacy/index.d.ts +2 -0
  39. package/lib/theme/IdealImageLegacy/index.js +2 -0
  40. package/package.json +8 -9
  41. package/src/plugin-ideal-image.d.ts +121 -0
  42. package/src/theme/IdealImage/index.tsx +2 -3
  43. package/src/theme/IdealImageLegacy/LICENSE +20 -0
  44. package/src/theme/IdealImageLegacy/README.md +13 -0
  45. package/src/theme/IdealImageLegacy/components/Icon/Download.js +15 -0
  46. package/src/theme/IdealImageLegacy/components/Icon/Loading.js +15 -0
  47. package/src/theme/IdealImageLegacy/components/Icon/Offline.js +15 -0
  48. package/src/theme/IdealImageLegacy/components/Icon/Warning.js +15 -0
  49. package/src/theme/IdealImageLegacy/components/Icon/index.js +25 -0
  50. package/src/theme/IdealImageLegacy/components/IdealImage/index.js +353 -0
  51. package/src/theme/IdealImageLegacy/components/IdealImageWithDefaults/index.js +12 -0
  52. package/src/theme/IdealImageLegacy/components/Media/index.js +169 -0
  53. package/src/theme/IdealImageLegacy/components/MediaWithDefaults/README.md +89 -0
  54. package/src/theme/IdealImageLegacy/components/MediaWithDefaults/index.js +12 -0
  55. package/src/theme/IdealImageLegacy/components/composeStyle.js +37 -0
  56. package/src/theme/IdealImageLegacy/components/constants.js +24 -0
  57. package/src/theme/IdealImageLegacy/components/helpers.js +142 -0
  58. package/src/theme/IdealImageLegacy/components/icons.js +16 -0
  59. package/src/theme/IdealImageLegacy/components/loaders.js +112 -0
  60. package/src/theme/IdealImageLegacy/components/theme.js +26 -0
  61. package/src/theme/IdealImageLegacy/components/theme.module.css +35 -0
  62. package/src/theme/IdealImageLegacy/components/unfetch.js +74 -0
  63. package/src/theme/IdealImageLegacy/index.tsx +3 -0
  64. package/src/deps.d.ts +0 -124
@@ -0,0 +1,112 @@
1
+ // There is an issue with cancelable interface
2
+ // It is not obvious that
3
+ // `image(src)` has `cancel` function
4
+ // but `image(src).then()` doesn't
5
+
6
+ import {unfetch, UnfetchAbortController} from './unfetch';
7
+
8
+ /**
9
+ * returns new "promise" with cancel function combined
10
+ *
11
+ * @param {Promise} p1 - first "promise" with cancel
12
+ * @param {Promise} p2 - second "promise" with cancel
13
+ * @returns {Promise} - new "promise" with cancel
14
+ */
15
+ export const combineCancel = (p1, p2) => {
16
+ if (!p2) return p1;
17
+ const result = p1.then(
18
+ (x) => x,
19
+ (x) => x,
20
+ );
21
+ result.cancel = () => {
22
+ p1.cancel();
23
+ p2.cancel();
24
+ };
25
+ return result;
26
+ };
27
+
28
+ export const timeout = (threshold) => {
29
+ let timerId;
30
+ const result = new Promise((resolve) => {
31
+ timerId = setTimeout(resolve, threshold);
32
+ });
33
+ result.cancel = () => {
34
+ // there is a bug with cancel somewhere in the code
35
+ // if (!timerId) throw new Error('Already canceled')
36
+ clearTimeout(timerId);
37
+ timerId = undefined;
38
+ };
39
+ return result;
40
+ };
41
+
42
+ // Caveat: image loader can not cancel download in some browsers
43
+ export const imageLoader = (src) => {
44
+ let img = new Image();
45
+ const result = new Promise((resolve, reject) => {
46
+ img.onload = resolve;
47
+ // eslint-disable-next-line no-multi-assign
48
+ img.onabort = img.onerror = () => reject({});
49
+ img.src = src;
50
+ });
51
+ result.cancel = () => {
52
+ if (!img) throw new Error('Already canceled');
53
+ // eslint-disable-next-line no-multi-assign
54
+ img.onload = img.onabort = img.onerror = undefined;
55
+ img.src = '';
56
+ img = undefined;
57
+ };
58
+ return result;
59
+ };
60
+
61
+ // Caveat: XHR loader can cause errors because of 'Access-Control-Allow-Origin'
62
+ // Caveat: we still need imageLoader to do actual decoding,
63
+ // but if images are uncachable this will lead to two requests
64
+ export const xhrLoader = (url, options) => {
65
+ let controller = new UnfetchAbortController();
66
+ const signal = controller.signal;
67
+ const result = new Promise((resolve, reject) =>
68
+ unfetch(url, {...options, signal}).then((response) => {
69
+ if (response.ok) {
70
+ response
71
+ .blob()
72
+ .then(() => imageLoader(url))
73
+ .then(resolve);
74
+ } else {
75
+ reject({status: response.status});
76
+ }
77
+ }, reject),
78
+ );
79
+ result.cancel = () => {
80
+ if (!controller) throw new Error('Already canceled');
81
+ controller.abort();
82
+ controller = undefined;
83
+ };
84
+ return result;
85
+ };
86
+
87
+ // Caveat: AbortController only supported in Chrome 66+
88
+ // Caveat: we still need imageLoader to do actual decoding,
89
+ // but if images are uncachable this will lead to two requests
90
+ // export const fetchLoader = (url, options) => {
91
+ // let controller = new AbortController()
92
+ // const signal = controller.signal
93
+ // const result = new Promise((resolve, reject) =>
94
+ // fetch(url, {...options, signal}).then(response => {
95
+ // if (response.ok) {
96
+ // options && options.onMeta && options.onMeta(response.headers)
97
+ // response
98
+ // .blob()
99
+ // .then(() => imageLoader(url))
100
+ // .then(resolve)
101
+ // } else {
102
+ // reject({status: response.status})
103
+ // }
104
+ // }, reject),
105
+ // )
106
+ // result.cancel = () => {
107
+ // if (!controller) throw new Error('Already canceled')
108
+ // controller.abort()
109
+ // controller = undefined
110
+ // }
111
+ // return result
112
+ // }
@@ -0,0 +1,30 @@
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
+ }
30
+ export default _default;
@@ -0,0 +1,26 @@
1
+ export default {
2
+ placeholder: {
3
+ backgroundSize: 'cover',
4
+ backgroundRepeat: 'no-repeat',
5
+ position: 'relative',
6
+ },
7
+ img: {
8
+ width: '100%',
9
+ height: 'auto',
10
+ maxWidth: '100%',
11
+ /* TODO: fix bug in styles */
12
+ marginBottom: '-4px',
13
+ },
14
+ icon: {
15
+ position: 'absolute',
16
+ top: '50%',
17
+ left: '50%',
18
+ transform: 'translate(-50%, -50%)',
19
+ textAlign: 'center',
20
+ },
21
+ noscript: {
22
+ position: 'absolute',
23
+ top: 0,
24
+ left: 0,
25
+ },
26
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ .placeholder {
9
+ background-size: cover;
10
+ background-repeat: no-repeat;
11
+ position: relative;
12
+ }
13
+
14
+ .img {
15
+ width: 100%;
16
+ height: auto;
17
+ max-width: 100%;
18
+ /* TODO: fix bug in styles */
19
+ margin-bottom: -4px;
20
+ transform: translate3d(0, 0, 0);
21
+ }
22
+
23
+ .icon {
24
+ position: absolute;
25
+ top: 50%;
26
+ left: 50%;
27
+ transform: translate(-50%, -50%);
28
+ text-align: center;
29
+ }
30
+
31
+ .noscript {
32
+ position: absolute;
33
+ top: 0;
34
+ left: 0;
35
+ }
@@ -0,0 +1,7 @@
1
+ export class UnfetchAbortController {
2
+ signal: {
3
+ onabort: () => void;
4
+ };
5
+ abort: () => void;
6
+ }
7
+ export function unfetch(url: any, options: any): Promise<any>;
@@ -0,0 +1,74 @@
1
+ export class UnfetchAbortController {
2
+ constructor() {
3
+ this.signal = {onabort: () => {}};
4
+ this.abort = () => this.signal.onabort();
5
+ }
6
+ }
7
+
8
+ // modified version of https://github.com/developit/unfetch
9
+ // - ponyfill intead of polyfill
10
+ // - add support for AbortController
11
+ export const unfetch = (url, options) => {
12
+ options = options || {};
13
+ return new Promise((resolve, reject) => {
14
+ const request = new XMLHttpRequest();
15
+
16
+ request.open(options.method || 'get', url, true);
17
+
18
+ // eslint-disable-next-line guard-for-in
19
+ for (const i in options.headers) {
20
+ request.setRequestHeader(i, options.headers[i]);
21
+ }
22
+
23
+ request.withCredentials = options.credentials === 'include';
24
+
25
+ request.onload = () => {
26
+ resolve(response());
27
+ };
28
+
29
+ request.onerror = reject;
30
+
31
+ if (options.signal)
32
+ options.signal.onabort = () => {
33
+ // eslint-disable-next-line no-multi-assign
34
+ request.onerror = request.onload = undefined;
35
+ request.abort();
36
+ };
37
+
38
+ request.send(options.body);
39
+
40
+ function response() {
41
+ const keys = [];
42
+ const all = [];
43
+ const headers = {};
44
+ let header;
45
+
46
+ request
47
+ .getAllResponseHeaders()
48
+ .replace(/^(.*?):\s*?([\s\S]*?)$/gm, (m, key, value) => {
49
+ keys.push((key = key.toLowerCase()));
50
+ all.push([key, value]);
51
+ header = headers[key];
52
+ headers[key] = header ? `${header},${value}` : value;
53
+ });
54
+
55
+ return {
56
+ // eslint-disable-next-line no-bitwise
57
+ ok: ((request.status / 100) | 0) === 2, // 200-299
58
+ status: request.status,
59
+ statusText: request.statusText,
60
+ url: request.responseURL,
61
+ clone: response,
62
+ text: () => Promise.resolve(request.responseText),
63
+ json: () => Promise.resolve(request.responseText).then(JSON.parse),
64
+ blob: () => Promise.resolve(new Blob([request.response])),
65
+ headers: {
66
+ keys: () => keys,
67
+ entries: () => all,
68
+ get: (n) => headers[n.toLowerCase()],
69
+ has: (n) => n.toLowerCase() in headers,
70
+ },
71
+ };
72
+ }
73
+ });
74
+ };
@@ -0,0 +1,2 @@
1
+ import IdealImageWithDefaults from './components/IdealImageWithDefaults';
2
+ export default IdealImageWithDefaults;
@@ -0,0 +1,2 @@
1
+ import IdealImageWithDefaults from './components/IdealImageWithDefaults';
2
+ export default IdealImageWithDefaults;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-ideal-image",
3
- "version": "3.7.0-canary-6263",
3
+ "version": "3.7.0-canary-6264",
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",
@@ -20,20 +20,19 @@
20
20
  },
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@docusaurus/core": "3.7.0-canary-6263",
24
- "@docusaurus/lqip-loader": "3.7.0-canary-6263",
23
+ "@docusaurus/core": "3.7.0-canary-6264",
24
+ "@docusaurus/lqip-loader": "3.7.0-canary-6264",
25
25
  "@docusaurus/responsive-loader": "^1.7.0",
26
- "@docusaurus/theme-translations": "3.7.0-canary-6263",
27
- "@docusaurus/types": "3.7.0-canary-6263",
28
- "@docusaurus/utils-validation": "3.7.0-canary-6263",
29
- "@slorber/react-ideal-image": "^0.0.14",
26
+ "@docusaurus/theme-translations": "3.7.0-canary-6264",
27
+ "@docusaurus/types": "3.7.0-canary-6264",
28
+ "@docusaurus/utils-validation": "3.7.0-canary-6264",
30
29
  "react-waypoint": "^10.3.0",
31
30
  "sharp": "^0.32.3",
32
31
  "tslib": "^2.6.0",
33
32
  "webpack": "^5.88.1"
34
33
  },
35
34
  "devDependencies": {
36
- "@docusaurus/module-type-aliases": "3.7.0-canary-6263",
35
+ "@docusaurus/module-type-aliases": "3.7.0-canary-6264",
37
36
  "fs-extra": "^11.1.0"
38
37
  },
39
38
  "peerDependencies": {
@@ -49,5 +48,5 @@
49
48
  "engines": {
50
49
  "node": ">=18.0"
51
50
  },
52
- "gitHead": "f87a715b107175497b8bb2d0ec7b8323c38e1853"
51
+ "gitHead": "8a3b8621983c8d84b95160db1fcfd223b4c4b979"
53
52
  }
@@ -5,6 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ /// <reference types="@docusaurus/module-type-aliases" />
9
+
8
10
  declare module '@docusaurus/plugin-ideal-image' {
9
11
  export type PluginOptions = {
10
12
  /**
@@ -74,3 +76,122 @@ declare module '@theme/IdealImage' {
74
76
  }
75
77
  export default function IdealImage(props: Props): ReactNode;
76
78
  }
79
+
80
+ declare module '@theme/IdealImageLegacy' {
81
+ /**
82
+ * @see https://github.com/endiliey/react-ideal-image/blob/master/index.d.ts
83
+ * Note: the original type definition is WRONG. getIcon & getMessage receive
84
+ * full state object.
85
+ */
86
+
87
+ import type {
88
+ ComponentProps,
89
+ ComponentType,
90
+ CSSProperties,
91
+ ReactNode,
92
+ } from 'react';
93
+
94
+ export type LoadingState = 'initial' | 'loading' | 'loaded' | 'error';
95
+
96
+ export type State = {
97
+ pickedSrc: {
98
+ size: number;
99
+ };
100
+ loadInfo: 404 | null;
101
+ loadState: LoadingState;
102
+ };
103
+
104
+ export type IconKey =
105
+ | 'load'
106
+ | 'loading'
107
+ | 'loaded'
108
+ | 'error'
109
+ | 'noicon'
110
+ | 'offline';
111
+
112
+ export type SrcType = {
113
+ width: number;
114
+ src?: string;
115
+ size?: number;
116
+ format?: 'webp' | 'jpeg' | 'png' | 'gif';
117
+ };
118
+
119
+ type ThemeKey = 'placeholder' | 'img' | 'icon' | 'noscript';
120
+
121
+ export interface ImageProps
122
+ extends Omit<ComponentProps<'img'>, 'srcSet' | 'placeholder'> {
123
+ /**
124
+ * This function decides what icon to show based on the current state of the
125
+ * component.
126
+ */
127
+ getIcon?: (state: State) => IconKey;
128
+ /**
129
+ * This function decides what message to show based on the icon (returned
130
+ * from `getIcon` prop) and the current state of the component.
131
+ */
132
+ getMessage?: (icon: IconKey, state: State) => string | null;
133
+ /**
134
+ * This function is called as soon as the component enters the viewport and
135
+ * is used to generate urls based on width and format if `props.srcSet`
136
+ * doesn't provide `src` field.
137
+ */
138
+ getUrl?: (srcType: SrcType) => string;
139
+ /**
140
+ * The Height of the image in px.
141
+ */
142
+ height: number;
143
+ /**
144
+ * This provides a map of the icons. By default, the component uses icons
145
+ * from material design, Implemented as React components with the SVG
146
+ * element. You can customize icons
147
+ */
148
+ icons?: Partial<{[icon in IconKey]: ComponentType}>;
149
+ /**
150
+ * This prop takes one of the 2 options, xhr and image.
151
+ * Read more about it:
152
+ * https://github.com/stereobooster/react-ideal-image/blob/master/introduction.md#cancel-download
153
+ */
154
+ loader?: 'xhr' | 'image';
155
+ /**
156
+ * https://github.com/stereobooster/react-ideal-image/blob/master/introduction.md#lqip
157
+ */
158
+ placeholder: {color: string} | {lqip: string};
159
+ /**
160
+ * This function decides if image should be downloaded automatically. The
161
+ * default function returns false for a 2g network, for a 3g network it
162
+ * decides based on `props.threshold` and for a 4g network it returns true
163
+ * by default.
164
+ */
165
+ shouldAutoDownload?: (options: {
166
+ connection?: 'slow-2g' | '2g' | '3g' | '4g';
167
+ size?: number;
168
+ threshold?: number;
169
+ possiblySlowNetwork?: boolean;
170
+ }) => boolean;
171
+ /**
172
+ * This provides an array of sources of different format and size of the
173
+ * image. Read more about it:
174
+ * https://github.com/stereobooster/react-ideal-image/blob/master/introduction.md#srcset
175
+ */
176
+ srcSet: SrcType[];
177
+ /**
178
+ * This provides a theme to the component. By default, the component uses
179
+ * inline styles, but it is also possible to use CSS modules and override
180
+ * all styles.
181
+ */
182
+ theme?: Partial<{[key in ThemeKey]: string | CSSProperties}>;
183
+ /**
184
+ * Tells how much to wait in milliseconds until consider the download to be
185
+ * slow.
186
+ */
187
+ threshold?: number;
188
+ /**
189
+ * Width of the image in px.
190
+ */
191
+ width: number;
192
+ }
193
+
194
+ export interface Props extends ImageProps {}
195
+
196
+ export default function IdealImageLegacy(props: ImageProps): ReactNode;
197
+ }
@@ -6,11 +6,11 @@
6
6
  */
7
7
 
8
8
  import React, {type ReactNode} from 'react';
9
+ import {translate} from '@docusaurus/Translate';
9
10
  import ReactIdealImage, {
10
11
  type IconKey,
11
12
  type State,
12
- } from '@slorber/react-ideal-image';
13
- import {translate} from '@docusaurus/Translate';
13
+ } from '@theme/IdealImageLegacy';
14
14
 
15
15
  import type {Props} from '@theme/IdealImage';
16
16
 
@@ -93,7 +93,6 @@ export default function IdealImage(props: Props): ReactNode {
93
93
 
94
94
  return (
95
95
  <ReactIdealImage
96
- {...propsRest}
97
96
  height={img.src.height ?? 100}
98
97
  width={img.src.width ?? 100}
99
98
  placeholder={{lqip: img.preSrc}}
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2017 stereobooster
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
@@ -0,0 +1,13 @@
1
+ # Legacy React IdealImage lib
2
+
3
+ This is legacy code from an npm package we forked, then internalized
4
+
5
+ See also:
6
+
7
+ - https://github.com/slorber/docusaurus-react-ideal-image
8
+ - https://github.com/endiliey/react-ideal-image
9
+ - https://github.com/stereobooster/react-ideal-image
10
+
11
+ ---
12
+
13
+ TODO: we need to clean it up, remove what we don't need, and maintain it up to date
@@ -0,0 +1,15 @@
1
+ // This icon is from "material design icons"
2
+ // It is licensed under Apache License 2.0
3
+ // Full text is available here
4
+ // https://github.com/google/material-design-icons/blob/master/LICENSE
5
+ import React from 'react';
6
+ import Icon from './index';
7
+
8
+ const Download = (props) => (
9
+ <Icon
10
+ {...props}
11
+ path="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z"
12
+ />
13
+ );
14
+
15
+ export default Download;
@@ -0,0 +1,15 @@
1
+ // This icon is from "material design icons"
2
+ // It is licensed under Apache License 2.0
3
+ // Full text is available here
4
+ // https://github.com/google/material-design-icons/blob/master/LICENSE
5
+ import React from 'react';
6
+ import Icon from './index';
7
+
8
+ const Loading = (props) => (
9
+ <Icon
10
+ {...props}
11
+ path="M6,2V8H6V8L10,12L6,16V16H6V22H18V16H18V16L14,12L18,8V8H18V2H6M16,16.5V20H8V16.5L12,12.5L16,16.5M12,11.5L8,7.5V4H16V7.5L12,11.5Z"
12
+ />
13
+ );
14
+
15
+ export default Loading;
@@ -0,0 +1,15 @@
1
+ // This icon is from "material design icons"
2
+ // It is licensed under Apache License 2.0
3
+ // Full text is available here
4
+ // https://github.com/google/material-design-icons/blob/master/LICENSE
5
+ import React from 'react';
6
+ import Icon from './index';
7
+
8
+ const Offline = (props) => (
9
+ <Icon
10
+ {...props}
11
+ path="M19.35 10.04C18.67 6.59 15.64 4 12 4c-1.48 0-2.85.43-4.01 1.17l1.46 1.46C10.21 6.23 11.08 6 12 6c3.04 0 5.5 2.46 5.5 5.5v.5H19c1.66 0 3 1.34 3 3 0 1.13-.64 2.11-1.56 2.62l1.45 1.45C23.16 18.16 24 16.68 24 15c0-2.64-2.05-4.78-4.65-4.96zM3 5.27l2.75 2.74C2.56 8.15 0 10.77 0 14c0 3.31 2.69 6 6 6h11.73l2 2L21 20.73 4.27 4 3 5.27zM7.73 10l8 8H6c-2.21 0-4-1.79-4-4s1.79-4 4-4h1.73z"
12
+ />
13
+ );
14
+
15
+ export default Offline;
@@ -0,0 +1,15 @@
1
+ // This icon is from "material design icons"
2
+ // It is licensed under Apache License 2.0
3
+ // Full text is available here
4
+ // https://github.com/google/material-design-icons/blob/master/LICENSE
5
+ import React from 'react';
6
+ import Icon from './index';
7
+
8
+ const Warning = (props) => (
9
+ <Icon
10
+ {...props}
11
+ path="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
12
+ />
13
+ );
14
+
15
+ export default Warning;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ // import PropTypes from 'prop-types'
3
+
4
+ const Icon = ({size = 24, fill = '#000', className, path}) => (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ width={size}
8
+ height={size}
9
+ viewBox="0 0 24 24"
10
+ className={className}>
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <path fill={fill} d={path} />
13
+ </svg>
14
+ );
15
+
16
+ /*
17
+ Icon.propTypes = {
18
+ size: PropTypes.number,
19
+ fill: PropTypes.string,
20
+ className: PropTypes.string,
21
+ path: PropTypes.string.isRequired,
22
+ }
23
+ */
24
+
25
+ export default Icon;