@opensea/seadn 1.0.4 → 1.0.6
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +10 -10
- package/src/index.test.ts +5 -0
- package/src/index.ts +6 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
exports.isSupportedFormat=function(t){"string"==typeof t&&(t=new URL(t));var e=t.pathname;return e.endsWith(".jpg")||e.endsWith(".jpeg")||e.endsWith(".png")||e.endsWith(".webp")||e.endsWith(".gif")||e.startsWith("/gae/")},exports.resizeImage=function(t,e){var r=e.width,i=e.height,n=e.dpr,s=void 0===n?1:n;"string"==typeof t&&(t=new URL(t));var
|
|
1
|
+
exports.isSupportedFormat=function(t){"string"==typeof t&&(t=new URL(t));var e=t.pathname;return e.endsWith(".jpg")||e.endsWith(".jpeg")||e.endsWith(".png")||e.endsWith(".webp")||e.endsWith(".gif")||e.startsWith("/gae/")},exports.resizeImage=function(t,e){var r=e.width,i=e.height,n=e.dpr,s=void 0===n?1:n,o=e.freezeAnimation,a=void 0!==o&&o;"string"==typeof t&&(t=new URL(t));var g=new URLSearchParams({auto:"format",dpr:String(s)});return void 0!==r&&g.set("w",String(r)),void 0!==i&&g.set("h",String(i)),a&&g.set("fr","1"),t.search=g.toString(),t.toString()};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1 }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n image.search = params.toString();\n return image.toString();\n};\n\nexport const isSupportedFormat = (image: string | URL) => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const { pathname } = image;\n return (\n pathname.endsWith('.jpg') ||\n pathname.endsWith('.jpeg') ||\n pathname.endsWith('.png') ||\n pathname.endsWith('.webp') ||\n pathname.endsWith('.gif') ||\n pathname.startsWith('/gae/') // GoogleAppEngine URLs do not contain extensions\n );\n};\n"],"names":["image","URL","pathname","endsWith","startsWith","_ref","width","height","_ref$dpr","dpr","params","URLSearchParams","auto","String","undefined","set","search","toString"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n freezeAnimation?: boolean;\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1, freezeAnimation = false }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n if (freezeAnimation) {\n params.set('fr', '1');\n }\n\n image.search = params.toString();\n return image.toString();\n};\n\nexport const isSupportedFormat = (image: string | URL) => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const { pathname } = image;\n return (\n pathname.endsWith('.jpg') ||\n pathname.endsWith('.jpeg') ||\n pathname.endsWith('.png') ||\n pathname.endsWith('.webp') ||\n pathname.endsWith('.gif') ||\n pathname.startsWith('/gae/') // GoogleAppEngine URLs do not contain extensions\n );\n};\n"],"names":["image","URL","pathname","endsWith","startsWith","_ref","width","height","_ref$dpr","dpr","_ref$freezeAnimation","freezeAnimation","params","URLSearchParams","auto","String","undefined","set","search","toString"],"mappings":"0BAmCiC,SAACA,GACX,iBAAVA,IACTA,EAAQ,IAAIC,IAAID,IAGlB,IAAQE,EAAaF,EAAbE,SACR,OACEA,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASE,WAAW,QAExB,sBA1C2B,SACzBJ,EAAmBK,GAET,IADRC,EAAKD,EAALC,MAAOC,EAAMF,EAANE,OAAMC,EAAAH,EAAEI,IAAAA,OAAM,IAAHD,EAAG,EAACA,EAAAE,EAAAL,EAAEM,gBAAAA,OAAkB,IAAHD,GAAQA,EAE5B,iBAAVV,IACTA,EAAQ,IAAIC,IAAID,IAGlB,IAAMY,EAAS,IAAIC,gBAAgB,CACjCC,KAAM,SACNL,IAAKM,OAAON,KAed,YAZcO,IAAVV,GACFM,EAAOK,IAAI,IAAKF,OAAOT,SAEVU,IAAXT,GACFK,EAAOK,IAAI,IAAKF,OAAOR,IAGrBI,GACFC,EAAOK,IAAI,KAAM,KAGnBjB,EAAMkB,OAASN,EAAOO,WACfnB,EAAMmB,UACf"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
export type ResizeParams = {
|
|
3
|
+
freezeAnimation?: boolean;
|
|
3
4
|
dpr?: number;
|
|
4
5
|
width?: number;
|
|
5
6
|
height?: number;
|
|
6
7
|
};
|
|
7
|
-
export declare const resizeImage: (image: string | URL, { width, height, dpr }: ResizeParams) => string;
|
|
8
|
+
export declare const resizeImage: (image: string | URL, { width, height, dpr, freezeAnimation }: ResizeParams) => string;
|
|
8
9
|
export declare const isSupportedFormat: (image: string | URL) => boolean;
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,WAAW,UACf,MAAM,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,WAAW,UACf,MAAM,GAAG,GAAG,2CACkC,YAAY,KAChE,MAuBF,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAW,MAAM,GAAG,GAAG,YAcpD,CAAC"}
|
package/dist/index.modern.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t=(t,{width:e,height:n,dpr:r=1})=>{"string"==typeof t&&(t=new URL(t));const
|
|
1
|
+
const t=(t,{width:e,height:n,dpr:r=1,freezeAnimation:i=!1})=>{"string"==typeof t&&(t=new URL(t));const s=new URLSearchParams({auto:"format",dpr:String(r)});return void 0!==e&&s.set("w",String(e)),void 0!==n&&s.set("h",String(n)),i&&s.set("fr","1"),t.search=s.toString(),t.toString()},e=t=>{"string"==typeof t&&(t=new URL(t));const{pathname:e}=t;return e.endsWith(".jpg")||e.endsWith(".jpeg")||e.endsWith(".png")||e.endsWith(".webp")||e.endsWith(".gif")||e.startsWith("/gae/")};export{e as isSupportedFormat,t as resizeImage};
|
|
2
2
|
//# sourceMappingURL=index.modern.js.map
|
package/dist/index.modern.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.modern.js","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1 }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n image.search = params.toString();\n return image.toString();\n};\n\nexport const isSupportedFormat = (image: string | URL) => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const { pathname } = image;\n return (\n pathname.endsWith('.jpg') ||\n pathname.endsWith('.jpeg') ||\n pathname.endsWith('.png') ||\n pathname.endsWith('.webp') ||\n pathname.endsWith('.gif') ||\n pathname.startsWith('/gae/') // GoogleAppEngine URLs do not contain extensions\n );\n};\n"],"names":["resizeImage","image","width","height","dpr","URL","params","URLSearchParams","auto","String","undefined","set","search","toString","isSupportedFormat","pathname","endsWith","startsWith"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.modern.js","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n freezeAnimation?: boolean;\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1, freezeAnimation = false }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n if (freezeAnimation) {\n params.set('fr', '1');\n }\n\n image.search = params.toString();\n return image.toString();\n};\n\nexport const isSupportedFormat = (image: string | URL) => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const { pathname } = image;\n return (\n pathname.endsWith('.jpg') ||\n pathname.endsWith('.jpeg') ||\n pathname.endsWith('.png') ||\n pathname.endsWith('.webp') ||\n pathname.endsWith('.gif') ||\n pathname.startsWith('/gae/') // GoogleAppEngine URLs do not contain extensions\n );\n};\n"],"names":["resizeImage","image","width","height","dpr","freezeAnimation","URL","params","URLSearchParams","auto","String","undefined","set","search","toString","isSupportedFormat","pathname","endsWith","startsWith"],"mappings":"AAOa,MAAAA,EAAcA,CACzBC,GACEC,QAAOC,SAAQC,IAAAA,EAAM,EAAGC,gBAAAA,GAAkB,MAEvB,iBAAVJ,IACTA,EAAQ,IAAIK,IAAIL,IAGlB,MAAMM,EAAS,IAAIC,gBAAgB,CACjCC,KAAM,SACNL,IAAKM,OAAON,KAed,YAZcO,IAAVT,GACFK,EAAOK,IAAI,IAAKF,OAAOR,SAEVS,IAAXR,GACFI,EAAOK,IAAI,IAAKF,OAAOP,IAGrBE,GACFE,EAAOK,IAAI,KAAM,KAGnBX,EAAMY,OAASN,EAAOO,WACfb,EAAMa,UACf,EAEaC,EAAqBd,IACX,iBAAVA,IACTA,EAAQ,IAAIK,IAAIL,IAGlB,MAAMe,SAAEA,GAAaf,EACrB,OACEe,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASE,WAAW,QAAO"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t=function(t,
|
|
1
|
+
var t=function(t,e){var n=e.width,r=e.height,i=e.dpr,a=void 0===i?1:i,o=e.freezeAnimation,s=void 0!==o&&o;"string"==typeof t&&(t=new URL(t));var g=new URLSearchParams({auto:"format",dpr:String(a)});return void 0!==n&&g.set("w",String(n)),void 0!==r&&g.set("h",String(r)),s&&g.set("fr","1"),t.search=g.toString(),t.toString()},e=function(t){"string"==typeof t&&(t=new URL(t));var e=t.pathname;return e.endsWith(".jpg")||e.endsWith(".jpeg")||e.endsWith(".png")||e.endsWith(".webp")||e.endsWith(".gif")||e.startsWith("/gae/")};export{e as isSupportedFormat,t as resizeImage};
|
|
2
2
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.js","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1 }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n image.search = params.toString();\n return image.toString();\n};\n\nexport const isSupportedFormat = (image: string | URL) => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const { pathname } = image;\n return (\n pathname.endsWith('.jpg') ||\n pathname.endsWith('.jpeg') ||\n pathname.endsWith('.png') ||\n pathname.endsWith('.webp') ||\n pathname.endsWith('.gif') ||\n pathname.startsWith('/gae/') // GoogleAppEngine URLs do not contain extensions\n );\n};\n"],"names":["resizeImage","image","_ref","width","height","_ref$dpr","dpr","URL","params","URLSearchParams","auto","String","undefined","set","search","toString","isSupportedFormat","pathname","endsWith","startsWith"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.module.js","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n freezeAnimation?: boolean;\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1, freezeAnimation = false }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n if (freezeAnimation) {\n params.set('fr', '1');\n }\n\n image.search = params.toString();\n return image.toString();\n};\n\nexport const isSupportedFormat = (image: string | URL) => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const { pathname } = image;\n return (\n pathname.endsWith('.jpg') ||\n pathname.endsWith('.jpeg') ||\n pathname.endsWith('.png') ||\n pathname.endsWith('.webp') ||\n pathname.endsWith('.gif') ||\n pathname.startsWith('/gae/') // GoogleAppEngine URLs do not contain extensions\n );\n};\n"],"names":["resizeImage","image","_ref","width","height","_ref$dpr","dpr","_ref$freezeAnimation","freezeAnimation","URL","params","URLSearchParams","auto","String","undefined","set","search","toString","isSupportedFormat","pathname","endsWith","startsWith"],"mappings":"AAOa,IAAAA,EAAc,SACzBC,EAAmBC,GAET,IADRC,EAAKD,EAALC,MAAOC,EAAMF,EAANE,OAAMC,EAAAH,EAAEI,IAAAA,OAAM,IAAHD,EAAG,EAACA,EAAAE,EAAAL,EAAEM,gBAAAA,OAAkB,IAAHD,GAAQA,EAE5B,iBAAVN,IACTA,EAAQ,IAAIQ,IAAIR,IAGlB,IAAMS,EAAS,IAAIC,gBAAgB,CACjCC,KAAM,SACNN,IAAKO,OAAOP,KAed,YAZcQ,IAAVX,GACFO,EAAOK,IAAI,IAAKF,OAAOV,SAEVW,IAAXV,GACFM,EAAOK,IAAI,IAAKF,OAAOT,IAGrBI,GACFE,EAAOK,IAAI,KAAM,KAGnBd,EAAMe,OAASN,EAAOO,WACfhB,EAAMgB,UACf,EAEaC,EAAoB,SAACjB,GACX,iBAAVA,IACTA,EAAQ,IAAIQ,IAAIR,IAGlB,IAAQkB,EAAalB,EAAbkB,SACR,OACEA,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASE,WAAW,QAExB"}
|
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).seadn={})}(this,function(e){e.isSupportedFormat=function(e){"string"==typeof e&&(e=new URL(e));var t=e.pathname;return t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".png")||t.endsWith(".webp")||t.endsWith(".gif")||t.startsWith("/gae/")},e.resizeImage=function(e,t){var n=t.width,i=t.height,o=t.dpr,r=void 0===o?1:o;"string"==typeof e&&(e=new URL(e));var
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).seadn={})}(this,function(e){e.isSupportedFormat=function(e){"string"==typeof e&&(e=new URL(e));var t=e.pathname;return t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".png")||t.endsWith(".webp")||t.endsWith(".gif")||t.startsWith("/gae/")},e.resizeImage=function(e,t){var n=t.width,i=t.height,o=t.dpr,r=void 0===o?1:o,s=t.freezeAnimation,d=void 0!==s&&s;"string"==typeof e&&(e=new URL(e));var f=new URLSearchParams({auto:"format",dpr:String(r)});return void 0!==n&&f.set("w",String(n)),void 0!==i&&f.set("h",String(i)),d&&f.set("fr","1"),e.search=f.toString(),e.toString()}});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1 }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n image.search = params.toString();\n return image.toString();\n};\n\nexport const isSupportedFormat = (image: string | URL) => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const { pathname } = image;\n return (\n pathname.endsWith('.jpg') ||\n pathname.endsWith('.jpeg') ||\n pathname.endsWith('.png') ||\n pathname.endsWith('.webp') ||\n pathname.endsWith('.gif') ||\n pathname.startsWith('/gae/') // GoogleAppEngine URLs do not contain extensions\n );\n};\n"],"names":["image","URL","pathname","endsWith","startsWith","_ref","width","height","_ref$dpr","dpr","params","URLSearchParams","auto","String","undefined","set","search","toString"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n freezeAnimation?: boolean;\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1, freezeAnimation = false }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n if (freezeAnimation) {\n params.set('fr', '1');\n }\n\n image.search = params.toString();\n return image.toString();\n};\n\nexport const isSupportedFormat = (image: string | URL) => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const { pathname } = image;\n return (\n pathname.endsWith('.jpg') ||\n pathname.endsWith('.jpeg') ||\n pathname.endsWith('.png') ||\n pathname.endsWith('.webp') ||\n pathname.endsWith('.gif') ||\n pathname.startsWith('/gae/') // GoogleAppEngine URLs do not contain extensions\n );\n};\n"],"names":["image","URL","pathname","endsWith","startsWith","_ref","width","height","_ref$dpr","dpr","_ref$freezeAnimation","freezeAnimation","params","URLSearchParams","auto","String","undefined","set","search","toString"],"mappings":"mPAmCiC,SAACA,GACX,iBAAVA,IACTA,EAAQ,IAAIC,IAAID,IAGlB,IAAQE,EAAaF,EAAbE,SACR,OACEA,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASE,WAAW,QAExB,gBA1C2B,SACzBJ,EAAmBK,GAET,IADRC,EAAKD,EAALC,MAAOC,EAAMF,EAANE,OAAMC,EAAAH,EAAEI,IAAAA,OAAM,IAAHD,EAAG,EAACA,EAAAE,EAAAL,EAAEM,gBAAAA,OAAkB,IAAHD,GAAQA,EAE5B,iBAAVV,IACTA,EAAQ,IAAIC,IAAID,IAGlB,IAAMY,EAAS,IAAIC,gBAAgB,CACjCC,KAAM,SACNL,IAAKM,OAAON,KAed,YAZcO,IAAVV,GACFM,EAAOK,IAAI,IAAKF,OAAOT,SAEVU,IAAXT,GACFK,EAAOK,IAAI,IAAKF,OAAOR,IAGrBI,GACFC,EAAOK,IAAI,KAAM,KAGnBjB,EAAMkB,OAASN,EAAOO,WACfnB,EAAMmB,UACf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensea/seadn",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Javascript SDK to work with SeaDN",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "OpenSea Developers",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@vitest/coverage-c8": "
|
|
32
|
-
"concurrently": "
|
|
33
|
-
"esbuild": "
|
|
34
|
-
"husky": "
|
|
35
|
-
"lint-staged": "
|
|
36
|
-
"microbundle": "
|
|
37
|
-
"prettier": "
|
|
38
|
-
"prettier-package-json": "
|
|
39
|
-
"vitest": "
|
|
31
|
+
"@vitest/coverage-c8": "0.29.1",
|
|
32
|
+
"concurrently": "7.6.0",
|
|
33
|
+
"esbuild": "0.17.10",
|
|
34
|
+
"husky": "8.0.3",
|
|
35
|
+
"lint-staged": "13.1.2",
|
|
36
|
+
"microbundle": "0.15.1",
|
|
37
|
+
"prettier": "2.8.4",
|
|
38
|
+
"prettier-package-json": "2.8.0",
|
|
39
|
+
"vitest": "0.29.1"
|
|
40
40
|
},
|
|
41
41
|
"lint-staged": {
|
|
42
42
|
"package.json": [
|
package/src/index.test.ts
CHANGED
|
@@ -21,6 +21,11 @@ test.each([
|
|
|
21
21
|
'https://i.seadn.io/gcs/files/057bb30c6d80d54b78439927b2f07676.png?auto=format&dpr=1&w=100&h=100',
|
|
22
22
|
{ height: 200, width: 200 },
|
|
23
23
|
'https://i.seadn.io/gcs/files/057bb30c6d80d54b78439927b2f07676.png?auto=format&dpr=1&w=200&h=200'
|
|
24
|
+
],
|
|
25
|
+
[
|
|
26
|
+
'https://i.seadn.io/gcs/files/057bb30c6d80d54b78439927b2f07676.png',
|
|
27
|
+
{ dpr: 5, freezeAnimation: true },
|
|
28
|
+
'https://i.seadn.io/gcs/files/057bb30c6d80d54b78439927b2f07676.png?auto=format&dpr=5&fr=1'
|
|
24
29
|
]
|
|
25
30
|
])('resizeSeadnImage(%i, %i) -> %i', (url, resizeParams, expected) => {
|
|
26
31
|
expect(resizeImage(url, resizeParams)).toBe(expected);
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type ResizeParams = {
|
|
2
|
+
freezeAnimation?: boolean;
|
|
2
3
|
dpr?: number;
|
|
3
4
|
width?: number;
|
|
4
5
|
height?: number;
|
|
@@ -6,7 +7,7 @@ export type ResizeParams = {
|
|
|
6
7
|
|
|
7
8
|
export const resizeImage = (
|
|
8
9
|
image: string | URL,
|
|
9
|
-
{ width, height, dpr = 1 }: ResizeParams
|
|
10
|
+
{ width, height, dpr = 1, freezeAnimation = false }: ResizeParams
|
|
10
11
|
): string => {
|
|
11
12
|
if (typeof image === 'string') {
|
|
12
13
|
image = new URL(image);
|
|
@@ -24,6 +25,10 @@ export const resizeImage = (
|
|
|
24
25
|
params.set('h', String(height));
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
if (freezeAnimation) {
|
|
29
|
+
params.set('fr', '1');
|
|
30
|
+
}
|
|
31
|
+
|
|
27
32
|
image.search = params.toString();
|
|
28
33
|
return image.toString();
|
|
29
34
|
};
|