@data-client/img 0.14.15 → 0.14.20
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/dist/index.cjs.js +8 -42
- package/dist/index.umd.min.js +1 -1
- package/package.json +16 -6
- package/src/__tests__/Img.web.tsx +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1,41 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
4
|
var react = require('@data-client/react');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
var endpoint = require('@data-client/endpoint');
|
|
8
7
|
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
|
-
|
|
13
|
-
function unwrapExports (x) {
|
|
14
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function createCommonjsModule(fn, module) {
|
|
18
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
var objectWithoutPropertiesLoose = createCommonjsModule(function (module) {
|
|
22
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
23
|
-
if (source == null) return {};
|
|
24
|
-
var target = {};
|
|
25
|
-
var sourceKeys = Object.keys(source);
|
|
26
|
-
var key, i;
|
|
27
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
28
|
-
key = sourceKeys[i];
|
|
29
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
30
|
-
target[key] = source[key];
|
|
31
|
-
}
|
|
32
|
-
return target;
|
|
33
|
-
}
|
|
34
|
-
module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
var _objectWithoutPropertiesLoose = unwrapExports(objectWithoutPropertiesLoose);
|
|
38
|
-
|
|
39
8
|
const getImage = new endpoint.Endpoint(async function ({
|
|
40
9
|
src
|
|
41
10
|
}) {
|
|
@@ -60,19 +29,16 @@ const getImage = new endpoint.Endpoint(async function ({
|
|
|
60
29
|
return `GET ${src}`;
|
|
61
30
|
}
|
|
62
31
|
});
|
|
63
|
-
var getImage$1 = getImage;
|
|
64
32
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
71
|
-
react.useSuspense(getImage$1, rest.src ? {
|
|
33
|
+
function Img({
|
|
34
|
+
component = 'img',
|
|
35
|
+
...rest
|
|
36
|
+
}) {
|
|
37
|
+
react.useSuspense(getImage, rest.src ? {
|
|
72
38
|
src: rest.src
|
|
73
39
|
} : null);
|
|
74
|
-
return /*#__PURE__*/
|
|
40
|
+
return /*#__PURE__*/React.createElement(component, rest);
|
|
75
41
|
}
|
|
76
42
|
|
|
77
43
|
exports.Img = Img;
|
|
78
|
-
exports.getImage = getImage
|
|
44
|
+
exports.getImage = getImage;
|
package/dist/index.umd.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@data-client/react"),require("react")):"function"==typeof define&&define.amd?define(["exports","@data-client/react","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Img={},e.RDC,e.React)}(this,(function(e,t,n){"use strict";
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@data-client/react"),require("react")):"function"==typeof define&&define.amd?define(["exports","@data-client/react","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Img={},e.RDC,e.React)}(this,(function(e,t,n){"use strict";var r;const o="undefined"!=typeof document;let c=o&&!(null!=(r=document.querySelector("meta[http-equiv='Content-Security-Policy']"))&&r.getAttribute("content"));try{c||Function()}catch(e){c=!0,o&&console.error("Content Security Policy: The previous CSP log can be safely ignored - @data-client/endpoint will use setPrototypeOf instead")}var i;class s extends Function{constructor(e,t){let n,r;return c?(n=(...e)=>n.fetch(...e),Object.setPrototypeOf(n,new.target.prototype)):(super("return arguments.callee.fetch.apply(arguments.callee, arguments)"),n=this),e&&(n.fetch=e),t&&"name"in t||!e||!e.name||"anonymous"===e.name||(r=e.name),Object.defineProperty(n,"name",{get(){return r||this.__name},set(e){this.__name=e}}),Object.assign(n,t),n}key(...e){return`${this.name} ${JSON.stringify(e)}`}testKey(e){return e.startsWith(this.name)}bind(e,...t){const n=this.fetch,r=this.key;return this.extend({fetch(){return n.apply(null!=e?e:this,t)},key(){return r.apply(this,t)}})}extend(e){class t extends this.constructor{}return Object.assign(t.prototype,this),new t(e.fetch,e)}}i=s,(()=>{if("undefined"!=typeof document&&document.FUNC_MANGLE){const e=i.prototype.key;i.prototype.key=function(...t){return null==document.FUNC_MANGLE||document.FUNC_MANGLE(this),this.prototype.key=e,e.call(this,...t)}}})();const u=new s((async function({src:e}){return new Promise((t=>{"undefined"!=typeof window&&"function"==typeof Image||t(e);const n=new Image;n.onload=()=>{t(e)},n.onerror=n=>{t(e)},n.src=e}))}),{key:({src:e})=>`GET ${e}`}),a=["component"];e.Img=function(e){let{component:r="img"}=e,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,a);return t.useSuspense(u,o.src?{src:o.src}:null),n.createElement(r,o)},e.getImage=u}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@data-client/img",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.20",
|
|
4
4
|
"description": "Suspenseful images",
|
|
5
5
|
"homepage": "https://dataclient.io/docs/guides/img-media#just-images",
|
|
6
6
|
"repository": {
|
|
@@ -47,6 +47,9 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"type": "module",
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=16"
|
|
52
|
+
},
|
|
50
53
|
"files": [
|
|
51
54
|
"src",
|
|
52
55
|
"dist",
|
|
@@ -56,8 +59,10 @@
|
|
|
56
59
|
"README.md"
|
|
57
60
|
],
|
|
58
61
|
"scripts": {
|
|
59
|
-
"build:lib": "NODE_ENV=production BROWSERSLIST_ENV=2019 yarn g:babel --out-dir lib",
|
|
60
|
-
"build:
|
|
62
|
+
"build:lib": "NODE_ENV=production BROWSERSLIST_ENV='2019' POLYFILL_TARGETS='chrome>88,safari>14' yarn g:babel --out-dir lib",
|
|
63
|
+
"build:js:node": "BROWSERSLIST_ENV=node16 yarn g:rollup",
|
|
64
|
+
"build:js:browser": "BROWSERSLIST_ENV=legacy yarn g:rollup",
|
|
65
|
+
"build:bundle": "yarn g:runs build:js:\\* && echo '{\"type\":\"commonjs\"}' > dist/package.json",
|
|
61
66
|
"build:clean": "yarn g:clean",
|
|
62
67
|
"build:legacy-types": "yarn g:downtypes lib ts3.4",
|
|
63
68
|
"build": "run build:lib && run build:bundle",
|
|
@@ -69,8 +74,9 @@
|
|
|
69
74
|
"funding": "https://github.com/sponsors/ntucker",
|
|
70
75
|
"license": "Apache-2.0",
|
|
71
76
|
"dependencies": {
|
|
72
|
-
"@babel/runtime": "^7.
|
|
73
|
-
"@data-client/endpoint": "^0.14.
|
|
77
|
+
"@babel/runtime-corejs3": "^7.26.0",
|
|
78
|
+
"@data-client/endpoint": "^0.14.20",
|
|
79
|
+
"core-js-pure": "^3.40.0"
|
|
74
80
|
},
|
|
75
81
|
"peerDependencies": {
|
|
76
82
|
"@data-client/react": "^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0",
|
|
@@ -85,7 +91,11 @@
|
|
|
85
91
|
"devDependencies": {
|
|
86
92
|
"@anansi/browserslist-config": "^1.4.2",
|
|
87
93
|
"@data-client/react": "workspace:*",
|
|
94
|
+
"@testing-library/react": "^16.1.0",
|
|
95
|
+
"@types/jest": "^29.5.14",
|
|
88
96
|
"@types/node": "^22.0.0",
|
|
89
|
-
"@types/react": "
|
|
97
|
+
"@types/react": "19.0.10",
|
|
98
|
+
"react": "^19.0.0",
|
|
99
|
+
"rollup-plugins": "workspace:*"
|
|
90
100
|
}
|
|
91
101
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataProvider } from '@data-client/react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { render, waitFor } from '@testing-library/react';
|
|
3
|
+
import { Suspense } from 'react';
|
|
4
4
|
|
|
5
5
|
import { Img } from '..';
|
|
6
6
|
|