@design-edito/tools 0.2.0 → 0.2.1

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 (187) hide show
  1. package/agnostic/arrays/index.js +11 -11
  2. package/agnostic/arrays/random-pick/index.js +6 -6
  3. package/agnostic/colors/index.js +11 -11
  4. package/agnostic/colors/lighten-color/index.js +2 -2
  5. package/agnostic/colors/saturate-color/index.js +2 -2
  6. package/agnostic/css/index.js +10 -10
  7. package/agnostic/css/styles-set/index.js +6 -6
  8. package/agnostic/errors/index.js +2 -2
  9. package/agnostic/html/hyper-json/cast/index.js +5 -5
  10. package/agnostic/html/hyper-json/index.js +6 -6
  11. package/agnostic/html/hyper-json/smart-tags/coalesced/add/index.js +5 -5
  12. package/agnostic/html/hyper-json/smart-tags/coalesced/addclass/index.js +5 -5
  13. package/agnostic/html/hyper-json/smart-tags/coalesced/and/index.js +5 -5
  14. package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.js +5 -5
  15. package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.js +5 -5
  16. package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.js +5 -5
  17. package/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.js +5 -5
  18. package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.js +5 -5
  19. package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.js +5 -5
  20. package/agnostic/html/hyper-json/smart-tags/coalesced/getattribute/index.js +5 -5
  21. package/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.js +5 -5
  22. package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.js +5 -5
  23. package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.js +5 -5
  24. package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.js +5 -5
  25. package/agnostic/html/hyper-json/smart-tags/coalesced/join/index.js +5 -5
  26. package/agnostic/html/hyper-json/smart-tags/coalesced/length/index.js +5 -5
  27. package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.js +5 -5
  28. package/agnostic/html/hyper-json/smart-tags/coalesced/negate/index.js +5 -5
  29. package/agnostic/html/hyper-json/smart-tags/coalesced/notrailing/index.js +5 -5
  30. package/agnostic/html/hyper-json/smart-tags/coalesced/or/index.js +5 -5
  31. package/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.js +5 -5
  32. package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.js +5 -5
  33. package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.js +5 -5
  34. package/agnostic/html/hyper-json/smart-tags/coalesced/push/index.js +5 -5
  35. package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.js +5 -5
  36. package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.js +5 -5
  37. package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +5 -5
  38. package/agnostic/html/hyper-json/smart-tags/coalesced/removeclass/index.js +5 -5
  39. package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.js +5 -5
  40. package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.js +5 -5
  41. package/agnostic/html/hyper-json/smart-tags/coalesced/select/index.js +5 -5
  42. package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.js +5 -5
  43. package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +5 -5
  44. package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.js +5 -5
  45. package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.js +5 -5
  46. package/agnostic/html/hyper-json/smart-tags/coalesced/split/index.js +5 -5
  47. package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.js +5 -5
  48. package/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.js +5 -5
  49. package/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.js +5 -5
  50. package/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.js +5 -5
  51. package/agnostic/html/hyper-json/smart-tags/coalesced/toggleclass/index.js +5 -5
  52. package/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.js +5 -5
  53. package/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.js +5 -5
  54. package/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.js +5 -5
  55. package/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.js +5 -5
  56. package/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.js +5 -5
  57. package/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.js +5 -5
  58. package/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.js +5 -5
  59. package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.js +5 -5
  60. package/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.js +5 -5
  61. package/agnostic/html/hyper-json/smart-tags/isolated/boolean/index.js +5 -5
  62. package/agnostic/html/hyper-json/smart-tags/isolated/element/index.js +5 -5
  63. package/agnostic/html/hyper-json/smart-tags/isolated/get/index.js +5 -5
  64. package/agnostic/html/hyper-json/smart-tags/isolated/global/index.js +5 -5
  65. package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.js +5 -5
  66. package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.js +5 -5
  67. package/agnostic/html/hyper-json/smart-tags/isolated/number/index.js +5 -5
  68. package/agnostic/html/hyper-json/smart-tags/isolated/record/index.js +5 -5
  69. package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.js +5 -5
  70. package/agnostic/html/hyper-json/smart-tags/isolated/string/index.js +5 -5
  71. package/agnostic/html/hyper-json/smart-tags/isolated/text/index.js +5 -5
  72. package/agnostic/html/hyper-json/tree/index.js +5 -5
  73. package/agnostic/html/hyper-json/utils/index.js +5 -5
  74. package/agnostic/html/index.js +17 -17
  75. package/agnostic/html/sanitize/index.js +6 -6
  76. package/agnostic/html/selector-to-element/index.js +6 -6
  77. package/agnostic/html/string-to-nodes/index.js +7 -7
  78. package/agnostic/misc/assert/index.js +3 -3
  79. package/agnostic/misc/crossenv/index.js +2 -2
  80. package/agnostic/misc/index.js +21 -21
  81. package/agnostic/misc/lorem-ipsum/index.js +13 -13
  82. package/agnostic/numbers/index.js +3 -3
  83. package/agnostic/objects/index.js +3 -3
  84. package/agnostic/strings/index.js +12 -12
  85. package/agnostic/time/index.js +5 -5
  86. package/chunks/chunk-2FC5KUMS.js +18 -0
  87. package/chunks/chunk-2HU2AWWJ.js +35 -0
  88. package/chunks/chunk-3SRJYILO.js +31 -0
  89. package/chunks/chunk-3YW3KBO5.js +18 -0
  90. package/chunks/chunk-4UV3XIGE.js +18 -0
  91. package/chunks/chunk-5JX7EWIW.js +21 -0
  92. package/chunks/chunk-6T7A6ZNA.js +40 -0
  93. package/chunks/chunk-6Z6GDMOR.js +28 -0
  94. package/chunks/chunk-7NOLNBF6.js +19 -0
  95. package/chunks/chunk-BTAPMJXX.js +37 -0
  96. package/chunks/chunk-CJL2V4VT.js +37 -0
  97. package/chunks/chunk-DEQWCMAL.js +40 -0
  98. package/chunks/chunk-E5VEMHHS.js +56 -0
  99. package/chunks/chunk-FORJXSIW.js +43 -0
  100. package/chunks/chunk-FOXX52QA.js +2456 -0
  101. package/chunks/chunk-GVGPJLS7.js +191 -0
  102. package/chunks/chunk-INGSSBWK.js +40 -0
  103. package/chunks/chunk-IWDIKDYR.js +60 -0
  104. package/chunks/chunk-IWZAUQGO.js +40 -0
  105. package/chunks/chunk-J4C3U3MK.js +24 -0
  106. package/chunks/chunk-J7JWEDGE.js +31 -0
  107. package/chunks/chunk-JSW6R3ZH.js +40 -0
  108. package/chunks/chunk-KBFSUJ57.js +40 -0
  109. package/chunks/chunk-KZKHIPWQ.js +24 -0
  110. package/chunks/chunk-MAOVZE34.js +20 -0
  111. package/chunks/chunk-MMGAJ7EW.js +26 -0
  112. package/chunks/chunk-MRIVEZFA.js +20 -0
  113. package/chunks/chunk-MROXW73J.js +168 -0
  114. package/chunks/chunk-MTT7TVR3.js +127 -0
  115. package/chunks/chunk-MW3KNVTG.js +29 -0
  116. package/chunks/chunk-NUGVP2MM.js +191 -0
  117. package/chunks/chunk-NYVARFI7.js +20 -0
  118. package/chunks/chunk-ODDE3NBH.js +24 -0
  119. package/chunks/chunk-PJFSPYPO.js +16 -0
  120. package/chunks/chunk-QPG45V6W.js +56 -0
  121. package/chunks/chunk-R765J7H2.js +114 -0
  122. package/chunks/chunk-S6S6O3VI.js +168 -0
  123. package/chunks/chunk-T3D55RRI.js +22 -0
  124. package/chunks/chunk-UFKH5WD2.js +21 -0
  125. package/chunks/chunk-UODICVLG.js +173 -0
  126. package/chunks/chunk-UPSIFUMS.js +18 -0
  127. package/chunks/chunk-VCAG4DZP.js +2456 -0
  128. package/chunks/chunk-VTDLFWOD.js +21 -0
  129. package/chunks/chunk-WC2LQPQP.js +26 -0
  130. package/chunks/chunk-WNDMYNDU.js +8 -0
  131. package/chunks/chunk-X7KWB2VQ.js +21 -0
  132. package/chunks/chunk-XYVNT74Y.js +60 -0
  133. package/chunks/chunk-YA2YCZUF.js +8 -0
  134. package/chunks/chunk-YTGB73UX.js +16 -0
  135. package/node/@aws-s3/index.js +6 -6
  136. package/node/@aws-s3/storage/file/index.js +4 -4
  137. package/node/@aws-s3/storage/index.js +6 -6
  138. package/node/@google-cloud/index.js +9 -9
  139. package/node/@google-cloud/storage/file/index.js +10 -10
  140. package/node/@google-cloud/storage/index.js +11 -11
  141. package/node/cloud-storage/index.js +24 -24
  142. package/node/cloud-storage/operations/index.js +31 -31
  143. package/node/encryption/index.js +3 -3
  144. package/node/files/index.js +3 -3
  145. package/node/ftps/file/index.js +4 -4
  146. package/node/ftps/index.js +5 -5
  147. package/node/images/format/index.d.ts +0 -7
  148. package/node/images/format/index.js +1 -3
  149. package/node/images/get-metadata/index.d.ts +4 -0
  150. package/node/images/get-metadata/index.js +7 -0
  151. package/node/images/index.d.ts +3 -3
  152. package/node/images/index.js +22 -48
  153. package/node/images/transform/index.d.ts +74 -23
  154. package/node/images/transform/index.js +20 -48
  155. package/node/images/transform/operations/blur/index.d.ts +6 -0
  156. package/node/images/transform/operations/blur/index.js +10 -0
  157. package/node/images/transform/operations/brighten/index.d.ts +6 -0
  158. package/node/images/transform/operations/brighten/index.js +10 -0
  159. package/node/images/transform/operations/extend/index.d.ts +11 -0
  160. package/node/images/transform/operations/extend/index.js +11 -0
  161. package/node/images/transform/operations/extract/index.d.ts +9 -0
  162. package/node/images/transform/operations/extract/index.js +10 -0
  163. package/node/images/transform/operations/flatten/index.d.ts +6 -0
  164. package/node/images/transform/operations/flatten/index.js +11 -0
  165. package/node/images/transform/operations/flip/index.d.ts +2 -0
  166. package/node/images/transform/operations/flip/index.js +7 -0
  167. package/node/images/transform/operations/flop/index.d.ts +2 -0
  168. package/node/images/transform/operations/flop/index.js +7 -0
  169. package/node/images/transform/operations/hue/index.d.ts +6 -0
  170. package/node/images/transform/operations/hue/index.js +10 -0
  171. package/node/images/transform/operations/level/index.d.ts +7 -0
  172. package/node/images/transform/operations/level/index.js +10 -0
  173. package/node/images/transform/operations/lighten/index.d.ts +6 -0
  174. package/node/images/transform/operations/lighten/index.js +10 -0
  175. package/node/images/transform/operations/normalize/index.d.ts +7 -0
  176. package/node/images/transform/operations/normalize/index.js +10 -0
  177. package/node/images/transform/operations/resize/index.d.ts +14 -0
  178. package/node/images/transform/operations/resize/index.js +11 -0
  179. package/node/images/transform/operations/rotate/index.d.ts +7 -0
  180. package/node/images/transform/operations/rotate/index.js +11 -0
  181. package/node/images/transform/operations/saturate/index.d.ts +6 -0
  182. package/node/images/transform/operations/saturate/index.js +10 -0
  183. package/node/images/transform/utils/index.d.ts +2 -0
  184. package/node/images/transform/utils/index.js +8 -0
  185. package/node/sftp/file/index.js +4 -4
  186. package/node/sftp/index.js +5 -5
  187. package/package.json +1 -1
@@ -0,0 +1,114 @@
1
+ import {
2
+ zod_default
3
+ } from "./chunk-OT4SVHDX.js";
4
+ import {
5
+ Outcome
6
+ } from "./chunk-JMU5PDBD.js";
7
+ import {
8
+ clamp
9
+ } from "./chunk-OSAXBA7G.js";
10
+ import {
11
+ __export
12
+ } from "./chunk-WSFCRVEQ.js";
13
+
14
+ // src/node/images/format/index.ts
15
+ var format_exports = {};
16
+ __export(format_exports, {
17
+ format: () => format,
18
+ isFormatAvifOptions: () => isFormatAvifOptions,
19
+ isFormatCommonOptions: () => isFormatCommonOptions,
20
+ isFormatHeifOptions: () => isFormatHeifOptions,
21
+ isFormatJpgOptions: () => isFormatJpgOptions,
22
+ isFormatKeepOptions: () => isFormatKeepOptions,
23
+ isFormatOptions: () => isFormatOptions,
24
+ isFormatPngOptions: () => isFormatPngOptions,
25
+ isFormatTiffOptions: () => isFormatTiffOptions,
26
+ isFormatWebpOptions: () => isFormatWebpOptions,
27
+ toAvif: () => toAvif,
28
+ toHeif: () => toHeif,
29
+ toHeight: () => toHeight,
30
+ toJpg: () => toJpg,
31
+ toPng: () => toPng,
32
+ toTiff: () => toTiff,
33
+ toWebp: () => toWebp,
34
+ toWidth: () => toWidth
35
+ });
36
+ import sharp from "sharp";
37
+ var formatCommonOptionsSchema = zod_default.object({
38
+ width: zod_default.number().optional(),
39
+ height: zod_default.number().optional(),
40
+ fit: zod_default.enum(["contain", "cover", "fill", "inside", "outside"]).optional()
41
+ });
42
+ var formatJpgOptionsSchema = formatCommonOptionsSchema.extend({ quality: zod_default.number().optional() });
43
+ var formatPngOptionsSchema = formatCommonOptionsSchema.extend({
44
+ quality: zod_default.number().optional(),
45
+ compressionLevel: zod_default.number().optional()
46
+ });
47
+ var formatWebpOptionsSchema = formatCommonOptionsSchema.extend({ quality: zod_default.number().optional() });
48
+ var formatAvifOptionsSchema = formatCommonOptionsSchema.extend({ quality: zod_default.number().optional() });
49
+ var formatTiffOptionsSchema = formatCommonOptionsSchema.extend({
50
+ quality: zod_default.number().optional(),
51
+ compression: zod_default.enum(["none", "jpeg", "deflate", "packbits", "ccittfax4", "lzw", "webp", "zstd", "jp2k"]).optional()
52
+ });
53
+ var formatHeifOptionsSchema = formatCommonOptionsSchema.extend({ quality: zod_default.number().optional() });
54
+ var formatKeepOptionsSchema = formatCommonOptionsSchema;
55
+ var formatOptionsSchema = zod_default.union([
56
+ formatJpgOptionsSchema,
57
+ formatPngOptionsSchema,
58
+ formatWebpOptionsSchema,
59
+ formatAvifOptionsSchema,
60
+ formatTiffOptionsSchema,
61
+ formatHeifOptionsSchema,
62
+ formatKeepOptionsSchema
63
+ ]);
64
+ var isFormatCommonOptions = (options) => formatCommonOptionsSchema.safeParse(options).success;
65
+ var isFormatJpgOptions = (options) => formatJpgOptionsSchema.safeParse(options).success;
66
+ var isFormatPngOptions = (options) => formatPngOptionsSchema.safeParse(options).success;
67
+ var isFormatWebpOptions = (options) => formatWebpOptionsSchema.safeParse(options).success;
68
+ var isFormatAvifOptions = (options) => formatAvifOptionsSchema.safeParse(options).success;
69
+ var isFormatTiffOptions = (options) => formatTiffOptionsSchema.safeParse(options).success;
70
+ var isFormatHeifOptions = (options) => formatHeifOptionsSchema.safeParse(options).success;
71
+ var isFormatKeepOptions = (options) => formatKeepOptionsSchema.safeParse(options).success;
72
+ var isFormatOptions = (options) => formatOptionsSchema.safeParse(options).success;
73
+ async function format(input, typeOrOptions, options) {
74
+ const sharpInstance = sharp(input);
75
+ if (typeof typeOrOptions !== "string") return Outcome.makeSuccess(await sharpInstance.resize(typeOrOptions).toBuffer());
76
+ const type = typeOrOptions;
77
+ if (type === "jpg" || type === "jpeg") return Outcome.makeSuccess(await sharpInstance.jpeg(options).toBuffer());
78
+ if (type === "png") return Outcome.makeSuccess(await sharpInstance.png(options).toBuffer());
79
+ if (type === "webp") return Outcome.makeSuccess(await sharpInstance.webp(options).toBuffer());
80
+ if (type === "avif") return Outcome.makeSuccess(await sharpInstance.avif(options).toBuffer());
81
+ if (type === "tiff") return Outcome.makeSuccess(await sharpInstance.tiff(options).toBuffer());
82
+ if (type === "heif") return Outcome.makeSuccess(await sharpInstance.heif(options).toBuffer());
83
+ return Outcome.makeFailure(`Invalid image format: ${type}`);
84
+ }
85
+ var toWidth = async (input, width) => sharp(input).resize({ width }).toBuffer();
86
+ var toHeight = async (input, height) => sharp(input).resize({ height }).toBuffer();
87
+ var toJpg = async (input, quality) => sharp(input).jpeg({ quality: clamp(quality ?? 100, 1, 100) }).toBuffer();
88
+ var toPng = async (input, quality, compressionLevel) => sharp(input).png({ quality: clamp(quality ?? 100, 1, 100), compressionLevel }).toBuffer();
89
+ var toWebp = async (input, quality) => sharp(input).webp({ quality: clamp(quality ?? 100, 1, 100) }).toBuffer();
90
+ var toAvif = async (input, quality) => sharp(input).avif({ quality: clamp(quality ?? 100, 1, 100) }).toBuffer();
91
+ var toTiff = async (input, quality, compression) => sharp(input).tiff({ quality: clamp(quality ?? 100, 1, 100), compression }).toBuffer();
92
+ var toHeif = async (input, quality) => sharp(input).heif({ quality: clamp(quality ?? 100, 1, 100) }).toBuffer();
93
+
94
+ export {
95
+ isFormatCommonOptions,
96
+ isFormatJpgOptions,
97
+ isFormatPngOptions,
98
+ isFormatWebpOptions,
99
+ isFormatAvifOptions,
100
+ isFormatTiffOptions,
101
+ isFormatHeifOptions,
102
+ isFormatKeepOptions,
103
+ isFormatOptions,
104
+ format,
105
+ toWidth,
106
+ toHeight,
107
+ toJpg,
108
+ toPng,
109
+ toWebp,
110
+ toAvif,
111
+ toTiff,
112
+ toHeif,
113
+ format_exports
114
+ };
@@ -0,0 +1,168 @@
1
+ import {
2
+ flatten,
3
+ isFlattenOperationParams
4
+ } from "./chunk-VTDLFWOD.js";
5
+ import {
6
+ isLightenOperationParams,
7
+ lighten
8
+ } from "./chunk-2FC5KUMS.js";
9
+ import {
10
+ isLevelOperationParams,
11
+ level
12
+ } from "./chunk-T3D55RRI.js";
13
+ import {
14
+ isNormalizeOperationParams,
15
+ normalize
16
+ } from "./chunk-7NOLNBF6.js";
17
+ import {
18
+ isResizeOperationParams,
19
+ resize
20
+ } from "./chunk-FORJXSIW.js";
21
+ import {
22
+ isRotateOperationParams,
23
+ rotate
24
+ } from "./chunk-KZKHIPWQ.js";
25
+ import {
26
+ isSaturateOperationParams,
27
+ saturate
28
+ } from "./chunk-UPSIFUMS.js";
29
+ import {
30
+ brighten,
31
+ isBrightenOperationParams
32
+ } from "./chunk-YTGB73UX.js";
33
+ import {
34
+ blur,
35
+ isBlurOperationParams
36
+ } from "./chunk-PJFSPYPO.js";
37
+ import {
38
+ extend,
39
+ isExtendOperationParams
40
+ } from "./chunk-MMGAJ7EW.js";
41
+ import {
42
+ extract,
43
+ isExtractOperationParams
44
+ } from "./chunk-5JX7EWIW.js";
45
+ import {
46
+ flip
47
+ } from "./chunk-WNDMYNDU.js";
48
+ import {
49
+ hue,
50
+ isHueOperationParams
51
+ } from "./chunk-3YW3KBO5.js";
52
+ import {
53
+ flop
54
+ } from "./chunk-YA2YCZUF.js";
55
+ import {
56
+ __export
57
+ } from "./chunk-WSFCRVEQ.js";
58
+
59
+ // src/node/images/transform/index.ts
60
+ var transform_exports = {};
61
+ __export(transform_exports, {
62
+ OpName: () => OpName,
63
+ isOperationDescriptor: () => isOperationDescriptor,
64
+ transform: () => transform
65
+ });
66
+ import sharp from "sharp";
67
+ var OpName = /* @__PURE__ */ ((OpName2) => {
68
+ OpName2["BLUR"] = "blur";
69
+ OpName2["BRIGHTEN"] = "brighten";
70
+ OpName2["EXTEND"] = "extend";
71
+ OpName2["EXTRACT"] = "extract";
72
+ OpName2["FLATTEN"] = "flatten";
73
+ OpName2["FLIP"] = "flip";
74
+ OpName2["FLOP"] = "flop";
75
+ OpName2["HUE"] = "hue";
76
+ OpName2["LEVEL"] = "level";
77
+ OpName2["LIGHTEN"] = "lighten";
78
+ OpName2["NORMALIZE"] = "normalize";
79
+ OpName2["RESIZE"] = "resize";
80
+ OpName2["ROTATE"] = "rotate";
81
+ OpName2["SATURATE"] = "saturate";
82
+ return OpName2;
83
+ })(OpName || {});
84
+ function isOperationDescriptor(obj) {
85
+ if (typeof obj !== "object" || obj === null) return false;
86
+ if (!("name" in obj)) return false;
87
+ if (obj.name === "blur" /* BLUR */) return isBlurOperationParams(obj);
88
+ if (obj.name === "brighten" /* BRIGHTEN */) return isBrightenOperationParams(obj);
89
+ if (obj.name === "extend" /* EXTEND */) return isExtendOperationParams(obj);
90
+ if (obj.name === "extract" /* EXTRACT */) return isExtractOperationParams(obj);
91
+ if (obj.name === "flatten" /* FLATTEN */) return isFlattenOperationParams(obj);
92
+ if (obj.name === "flip" /* FLIP */) return true;
93
+ if (obj.name === "flop" /* FLOP */) return true;
94
+ if (obj.name === "hue" /* HUE */) return isHueOperationParams(obj);
95
+ if (obj.name === "level" /* LEVEL */) return isLevelOperationParams(obj);
96
+ if (obj.name === "lighten" /* LIGHTEN */) return isLightenOperationParams(obj);
97
+ if (obj.name === "normalize" /* NORMALIZE */) return isNormalizeOperationParams(obj);
98
+ if (obj.name === "resize" /* RESIZE */) return isResizeOperationParams(obj);
99
+ if (obj.name === "rotate" /* ROTATE */) return isRotateOperationParams(obj);
100
+ if (obj.name === "saturate" /* SATURATE */) return isSaturateOperationParams(obj);
101
+ return false;
102
+ }
103
+ async function transform(input, operationsSequence) {
104
+ if (Buffer.isBuffer(input)) return transformBuffer(input, operationsSequence);
105
+ return transformSharpInstance(input, operationsSequence);
106
+ }
107
+ async function transformSharpInstance(sharpInstance, operationsSequence) {
108
+ for (const operation of operationsSequence) {
109
+ switch (operation.name) {
110
+ case "blur" /* BLUR */:
111
+ sharpInstance = await blur(sharpInstance, operation);
112
+ break;
113
+ case "brighten" /* BRIGHTEN */:
114
+ sharpInstance = await brighten(sharpInstance, operation);
115
+ break;
116
+ case "extend" /* EXTEND */:
117
+ sharpInstance = await extend(sharpInstance, operation);
118
+ break;
119
+ case "extract" /* EXTRACT */:
120
+ sharpInstance = await extract(sharpInstance, operation);
121
+ break;
122
+ case "flatten" /* FLATTEN */:
123
+ sharpInstance = await flatten(sharpInstance, operation);
124
+ break;
125
+ case "flip" /* FLIP */:
126
+ sharpInstance = await flip(sharpInstance);
127
+ break;
128
+ case "flop" /* FLOP */:
129
+ sharpInstance = await flop(sharpInstance);
130
+ break;
131
+ case "hue" /* HUE */:
132
+ sharpInstance = await hue(sharpInstance, operation);
133
+ break;
134
+ case "level" /* LEVEL */:
135
+ sharpInstance = await level(sharpInstance, operation);
136
+ break;
137
+ case "lighten" /* LIGHTEN */:
138
+ sharpInstance = await lighten(sharpInstance, operation);
139
+ break;
140
+ case "normalize" /* NORMALIZE */:
141
+ sharpInstance = await normalize(sharpInstance, operation);
142
+ break;
143
+ case "resize" /* RESIZE */:
144
+ sharpInstance = await resize(sharpInstance, operation);
145
+ break;
146
+ case "rotate" /* ROTATE */:
147
+ sharpInstance = await rotate(sharpInstance, operation);
148
+ break;
149
+ case "saturate" /* SATURATE */:
150
+ sharpInstance = await saturate(sharpInstance, operation);
151
+ break;
152
+ default:
153
+ sharpInstance = sharpInstance;
154
+ }
155
+ }
156
+ return sharpInstance;
157
+ }
158
+ async function transformBuffer(fileBuffer, operationsSequence) {
159
+ const sharpInstance = sharp(fileBuffer);
160
+ return transformSharpInstance(sharpInstance, operationsSequence);
161
+ }
162
+
163
+ export {
164
+ OpName,
165
+ isOperationDescriptor,
166
+ transform,
167
+ transform_exports
168
+ };
@@ -0,0 +1,22 @@
1
+ import {
2
+ zod_default
3
+ } from "./chunk-OT4SVHDX.js";
4
+
5
+ // src/node/images/transform/operations/level/index.ts
6
+ function isLevelOperationParams(obj) {
7
+ return zod_default.object({
8
+ multiplier: zod_default.number().optional(),
9
+ offset: zod_default.number().optional()
10
+ }).safeParse(obj).success;
11
+ }
12
+ async function level(sharpInstance, params) {
13
+ return sharpInstance.linear(
14
+ params.multiplier,
15
+ params.offset
16
+ );
17
+ }
18
+
19
+ export {
20
+ isLevelOperationParams,
21
+ level
22
+ };
@@ -0,0 +1,21 @@
1
+ import {
2
+ Window
3
+ } from "./chunk-RLJOYG64.js";
4
+ import {
5
+ detectRuntime
6
+ } from "./chunk-S2NMAH7K.js";
7
+ import {
8
+ Types
9
+ } from "./chunk-LV2VMOWR.js";
10
+
11
+ // src/agnostic/misc/crossenv/index.ts
12
+ var Crossenv;
13
+ ((Crossenv2) => {
14
+ Crossenv2.detectRuntime = detectRuntime;
15
+ Crossenv2.Types = Types;
16
+ Crossenv2.Window = Window;
17
+ })(Crossenv || (Crossenv = {}));
18
+
19
+ export {
20
+ Crossenv
21
+ };
@@ -0,0 +1,173 @@
1
+ import {
2
+ Random
3
+ } from "./chunk-S32K7POB.js";
4
+ import {
5
+ register
6
+ } from "./chunk-WC2LQPQP.js";
7
+
8
+ // src/agnostic/css/styles-set/index.tsx
9
+ import { Component } from "react";
10
+ import { createRoot as reactCreateRoot } from "react-dom/client";
11
+ import { Fragment, jsx } from "react/jsx-runtime";
12
+ var StylesSet = class _StylesSet {
13
+ static defaultPrivateIDAttribute = "data-styleset-private-id";
14
+ static defaultPublicIDAttribute = "data-styleset-public-id";
15
+ tagsPrivateIDAttribute = _StylesSet.defaultPrivateIDAttribute;
16
+ tagsPublicIDAttribute = _StylesSet.defaultPublicIDAttribute;
17
+ _items = /* @__PURE__ */ new Map();
18
+ get items() {
19
+ const sortedItemsArray = Array.from(this._items).map(([privateId, item]) => {
20
+ const targetPosition = this.getTargetPosition(privateId) ?? 0;
21
+ return { targetPosition, privateId, item };
22
+ }).sort((a, b) => a.targetPosition - b.targetPosition).map(({ item, privateId }) => [privateId, item]);
23
+ const sortedItemsMap = new Map(sortedItemsArray);
24
+ return sortedItemsMap;
25
+ }
26
+ getTargetPosition(privateId) {
27
+ const orderedStyles = Array.from(this._items).map(([privateId2, data]) => ({ privateId: privateId2, data })).sort((a, b) => {
28
+ const aPos = a.data.position ?? 0;
29
+ const bPos = b.data.position ?? 0;
30
+ return aPos - bPos;
31
+ });
32
+ const foundIndex = orderedStyles.findIndex((item) => item.privateId === privateId);
33
+ return foundIndex === -1 ? null : foundIndex;
34
+ }
35
+ setTagsPrivateIDAttribute(str) {
36
+ this.tagsPrivateIDAttribute = str;
37
+ return this;
38
+ }
39
+ setTagsPublicIDAttribute(str) {
40
+ this.tagsPublicIDAttribute = str;
41
+ return this;
42
+ }
43
+ getById(id) {
44
+ const found = Array.from(this._items.values()).find((entry) => entry.id === id);
45
+ if (found === void 0) return void 0;
46
+ return found;
47
+ }
48
+ generateUniquePrivateId() {
49
+ const existingIds = Array.from(this._items.keys());
50
+ const generated = Random.randomHash(12);
51
+ if (existingIds.includes(generated)) return this.generateUniquePrivateId();
52
+ return generated;
53
+ }
54
+ _rendered = /* @__PURE__ */ new Map();
55
+ render(element) {
56
+ const root = reactCreateRoot(element);
57
+ const items = this.items;
58
+ root.render(/* @__PURE__ */ jsx(
59
+ StylesSetComp,
60
+ {
61
+ items,
62
+ privateIDAttribute: this.tagsPrivateIDAttribute,
63
+ publicIDAttribute: this.tagsPublicIDAttribute
64
+ }
65
+ ));
66
+ this._rendered.set(element, root);
67
+ return this;
68
+ }
69
+ unmount(element) {
70
+ if (!this._rendered.has(element)) return this;
71
+ const root = this._rendered.get(element);
72
+ if (root === void 0) return this;
73
+ root.unmount();
74
+ this._rendered.delete(element);
75
+ return this;
76
+ }
77
+ updateRendered() {
78
+ const { items } = this;
79
+ this._rendered.forEach((root) => root.render(/* @__PURE__ */ jsx(
80
+ StylesSetComp,
81
+ {
82
+ items,
83
+ privateIDAttribute: this.tagsPrivateIDAttribute,
84
+ publicIDAttribute: this.tagsPublicIDAttribute
85
+ }
86
+ )));
87
+ return this;
88
+ }
89
+ addItem(item, abortIfIdExists = true) {
90
+ const existing = Array.from(this._items.entries()).map(([privateId2, entry]) => ({ privateId: privateId2, entry })).find(({ entry }) => entry.id !== void 0 && entry.id === item.id);
91
+ if (existing !== void 0) {
92
+ if (abortIfIdExists) return this;
93
+ this._items.delete(existing.privateId);
94
+ }
95
+ const privateId = this.generateUniquePrivateId();
96
+ this._items.set(privateId, item);
97
+ this.updateRendered();
98
+ return this;
99
+ }
100
+ removeItem(idOrPosition) {
101
+ if (typeof idOrPosition === "string") {
102
+ const existing = Array.from(this._items.entries()).map(([privateId, entry]) => ({ privateId, entry })).find(({ entry }) => entry.id !== void 0 && entry.id === idOrPosition);
103
+ if (existing === void 0) return this;
104
+ this._items.delete(existing.privateId);
105
+ this.updateRendered();
106
+ return this;
107
+ }
108
+ const toRemove = Array.from(this._items).map(([privateId, entry]) => ({ privateId, entry })).at(idOrPosition);
109
+ if (toRemove === void 0) return this;
110
+ this._items.delete(toRemove.privateId);
111
+ this.updateRendered();
112
+ return this;
113
+ }
114
+ async getDomString(documentObj) {
115
+ const actualDocumentObj = documentObj ?? window.document;
116
+ if (actualDocumentObj === null) throw register.getError("no-window-document-on-runtime" /* NO_DOCUMENT */);
117
+ return new Promise((resolve) => {
118
+ const tempElt = actualDocumentObj.createElement("div");
119
+ const tempRoot = reactCreateRoot(tempElt);
120
+ const { items } = this;
121
+ const onRendered = () => {
122
+ resolve(tempElt.innerHTML);
123
+ tempRoot.unmount();
124
+ tempElt.remove();
125
+ };
126
+ tempRoot.render(/* @__PURE__ */ jsx(
127
+ StylesSetComp,
128
+ {
129
+ items,
130
+ privateIDAttribute: this.tagsPrivateIDAttribute,
131
+ publicIDAttribute: this.tagsPublicIDAttribute,
132
+ onRendered
133
+ }
134
+ ));
135
+ });
136
+ }
137
+ };
138
+ var StylesSetComp = class extends Component {
139
+ componentDidMount() {
140
+ const { props } = this;
141
+ const { onRendered } = props;
142
+ if (onRendered !== void 0) onRendered();
143
+ }
144
+ componentDidUpdate() {
145
+ const { props } = this;
146
+ const { onRendered } = props;
147
+ if (onRendered !== void 0) onRendered();
148
+ }
149
+ render() {
150
+ const { props } = this;
151
+ const items = props.items ?? /* @__PURE__ */ new Map();
152
+ const pidAttr = props.privateIDAttribute ?? StylesSet.defaultPrivateIDAttribute;
153
+ const idAttr = props.publicIDAttribute ?? StylesSet.defaultPublicIDAttribute;
154
+ return /* @__PURE__ */ jsx(Fragment, { children: Array.from(items).map(([privateId, itemData]) => {
155
+ const customAttributes = { [pidAttr]: privateId, [idAttr]: itemData.id };
156
+ if (itemData.type === "url") return /* @__PURE__ */ jsx(
157
+ "link",
158
+ {
159
+ onLoad: itemData.onLoad,
160
+ rel: "stylesheet",
161
+ href: itemData.content,
162
+ ...customAttributes
163
+ }
164
+ );
165
+ return /* @__PURE__ */ jsx("style", { ...customAttributes, children: itemData.content });
166
+ }) });
167
+ }
168
+ };
169
+
170
+ export {
171
+ StylesSet,
172
+ StylesSetComp
173
+ };
@@ -0,0 +1,18 @@
1
+ import {
2
+ zod_default
3
+ } from "./chunk-OT4SVHDX.js";
4
+
5
+ // src/node/images/transform/operations/saturate/index.ts
6
+ function isSaturateOperationParams(obj) {
7
+ return zod_default.object({
8
+ saturation: zod_default.number().optional()
9
+ }).safeParse(obj).success;
10
+ }
11
+ async function saturate(sharpInstance, params) {
12
+ return sharpInstance.modulate({ saturation: params.saturation });
13
+ }
14
+
15
+ export {
16
+ isSaturateOperationParams,
17
+ saturate
18
+ };