dune-react 0.0.43 → 0.0.44

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 (55) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +6 -0
  2. package/dist/_virtual/index.js +4 -0
  3. package/dist/components/puck-base/media.d.ts +1 -0
  4. package/dist/components/puck-base/media.js +272 -129
  5. package/dist/components/puck-block/gallery-sections/static-grid/static-grid.js +14 -10
  6. package/dist/components/puck-block/testimonial-sections/bento-testimonial/component.js +7 -6
  7. package/dist/components/puck-core/core/props/index.js +7 -0
  8. package/dist/components/shadcn/slider.js +1 -1
  9. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/flipImageAlgorithm.js +44 -0
  10. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/moveCoordinatesAlgorithm.js +8 -0
  11. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/resizeCoordinatesAlgorithm.js +291 -0
  12. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/rotateImageAlgorithm.js +38 -0
  13. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/transformImageAlgorithm.js +84 -0
  14. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/animation/index.js +78 -0
  15. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/boundary/index.js +31 -0
  16. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/canvas/index.js +94 -0
  17. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/constants/index.js +8 -0
  18. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultAreaPositionRestrictions.js +51 -0
  19. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultAreaSizeRestrictions.js +30 -0
  20. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultBoundary.js +10 -0
  21. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultPosition.js +12 -0
  22. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultPositionRestrictions.js +17 -0
  23. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultSize.js +31 -0
  24. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultSizeRestrictions.js +16 -0
  25. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultStencilConstraints.js +13 -0
  26. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultVisibleArea.js +49 -0
  27. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/index.js +84 -0
  28. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/extensions/stencil-size/index.js +107 -0
  29. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/image/index.js +350 -0
  30. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/instance/AbstractCropperInstance.js +494 -0
  31. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/approximateSize.js +30 -0
  32. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/fitCoordinates.js +30 -0
  33. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/fitVisibleArea.js +26 -0
  34. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/helpers.js +125 -0
  35. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/imageTransforms.js +83 -0
  36. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/interactions.js +19 -0
  37. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/normalize.js +83 -0
  38. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/sizeRestrictions.js +58 -0
  39. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/utils.js +313 -0
  40. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/copyState.js +7 -0
  41. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/createState.js +41 -0
  42. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/moveCoordinates.js +15 -0
  43. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/reconcileState.js +44 -0
  44. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/resizeCoordinates.js +22 -0
  45. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/setBoundary.js +31 -0
  46. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/setCoordinates.js +83 -0
  47. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/setVisibleArea.js +18 -0
  48. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/transformImage.js +18 -0
  49. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/types/index.js +16 -0
  50. package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/utils/index.js +268 -0
  51. package/dist/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js +63 -0
  52. package/dist/node_modules/.pnpm/react-advanced-cropper@0.20.1_react@19.2.4/node_modules/react-advanced-cropper/dist/index.esm-bundler.js +1715 -0
  53. package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.js +181 -0
  54. package/dist/style.css +406 -0
  55. package/package.json +21 -20
@@ -0,0 +1,350 @@
1
+ import { __assign } from "../../../../tslib@2.8.1/node_modules/tslib/tslib.es6.js";
2
+ import { isCrossOriginURL, isBlob, isLocal } from "../utils/index.js";
3
+ import { ratio } from "../service/utils.js";
4
+ import { getCoefficient, getTransformedImageSize } from "../service/helpers.js";
5
+ var XHR_DONE = 4;
6
+ function base64ToArrayBuffer(base64) {
7
+ base64 = base64.replace(/^data:([^;]+);base64,/gim, "");
8
+ var binary = atob(base64);
9
+ var len = binary.length;
10
+ var buffer = new ArrayBuffer(len);
11
+ var view = new Uint8Array(buffer);
12
+ for (var i = 0; i < len; i++) {
13
+ view[i] = binary.charCodeAt(i);
14
+ }
15
+ return buffer;
16
+ }
17
+ function objectURLToBlob(url, callback) {
18
+ var http = new XMLHttpRequest();
19
+ http.open("GET", url, true);
20
+ http.responseType = "blob";
21
+ http.onload = function() {
22
+ if (this.status == 200 || this.status === 0) {
23
+ callback(this.response);
24
+ }
25
+ };
26
+ http.send();
27
+ }
28
+ function getTransforms(orientation) {
29
+ var result = {
30
+ flip: {
31
+ horizontal: false,
32
+ vertical: false
33
+ },
34
+ rotate: 0
35
+ };
36
+ if (orientation) {
37
+ switch (orientation) {
38
+ case 2:
39
+ result.flip.horizontal = true;
40
+ break;
41
+ case 3:
42
+ result.rotate = -180;
43
+ break;
44
+ case 4:
45
+ result.flip.vertical = true;
46
+ break;
47
+ case 5:
48
+ result.rotate = 90;
49
+ result.flip.vertical = true;
50
+ break;
51
+ case 6:
52
+ result.rotate = 90;
53
+ break;
54
+ case 7:
55
+ result.rotate = 90;
56
+ result.flip.horizontal = true;
57
+ break;
58
+ case 8:
59
+ result.rotate = -90;
60
+ break;
61
+ }
62
+ }
63
+ return result;
64
+ }
65
+ function getImageData(img) {
66
+ return new Promise(function(resolve, reject) {
67
+ try {
68
+ if (img) {
69
+ if (/^data:/i.test(img)) {
70
+ resolve(base64ToArrayBuffer(img));
71
+ } else if (/^blob:/i.test(img)) {
72
+ var fileReader_1 = new FileReader();
73
+ fileReader_1.onload = function(e) {
74
+ var _a;
75
+ resolve((_a = e.target) === null || _a === void 0 ? void 0 : _a.result);
76
+ };
77
+ objectURLToBlob(img, function(blob) {
78
+ fileReader_1.readAsArrayBuffer(blob);
79
+ });
80
+ } else {
81
+ var http_1 = new XMLHttpRequest();
82
+ http_1.onreadystatechange = function() {
83
+ if (http_1.readyState !== XHR_DONE)
84
+ return;
85
+ if (http_1.status === 200 || http_1.status === 0) {
86
+ resolve(http_1.response);
87
+ } else {
88
+ reject("Warning: could not load an image to parse its orientation");
89
+ }
90
+ };
91
+ http_1.onprogress = function() {
92
+ if (http_1.getResponseHeader("content-type") !== "image/jpeg") {
93
+ http_1.abort();
94
+ }
95
+ };
96
+ http_1.withCredentials = false;
97
+ http_1.open("GET", img, true);
98
+ http_1.responseType = "arraybuffer";
99
+ http_1.send(null);
100
+ }
101
+ } else {
102
+ reject("Error: the image is empty");
103
+ }
104
+ } catch (e) {
105
+ reject(e);
106
+ }
107
+ });
108
+ }
109
+ function getStyleTransforms(transforms) {
110
+ var _a = transforms.rotate, rotate = _a === void 0 ? 0 : _a, _b = transforms.flip, flip = _b === void 0 ? { horizontal: false, vertical: false } : _b, _c = transforms.scale, scale = _c === void 0 ? 1 : _c;
111
+ return " rotate(" + rotate + "deg) scaleX(" + scale * (flip.horizontal ? -1 : 1) + ") scaleY(" + scale * (flip.vertical ? -1 : 1) + ")";
112
+ }
113
+ function getStringFromCharCode(dataView, start, length) {
114
+ var str = "";
115
+ var i;
116
+ for (i = start, length += start; i < length; i++) {
117
+ str += String.fromCharCode(dataView.getUint8(i));
118
+ }
119
+ return str;
120
+ }
121
+ function resetAndGetOrientation(arrayBuffer) {
122
+ try {
123
+ var dataView = new DataView(arrayBuffer);
124
+ var orientation_1;
125
+ var exifIDCode = void 0;
126
+ var tiffOffset = void 0;
127
+ var littleEndian = void 0;
128
+ var app1Start = void 0;
129
+ var ifdStart = void 0;
130
+ if (dataView.getUint8(0) === 255 && dataView.getUint8(1) === 216) {
131
+ var length_1 = dataView.byteLength;
132
+ var offset = 2;
133
+ while (offset + 1 < length_1) {
134
+ if (dataView.getUint8(offset) === 255 && dataView.getUint8(offset + 1) === 225) {
135
+ app1Start = offset;
136
+ break;
137
+ }
138
+ offset++;
139
+ }
140
+ }
141
+ if (app1Start) {
142
+ exifIDCode = app1Start + 4;
143
+ tiffOffset = app1Start + 10;
144
+ if (getStringFromCharCode(dataView, exifIDCode, 4) === "Exif") {
145
+ var endianness = dataView.getUint16(tiffOffset);
146
+ littleEndian = endianness === 18761;
147
+ if (littleEndian || endianness === 19789) {
148
+ if (dataView.getUint16(tiffOffset + 2, littleEndian) === 42) {
149
+ var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);
150
+ if (firstIFDOffset >= 8) {
151
+ ifdStart = tiffOffset + firstIFDOffset;
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
157
+ if (ifdStart) {
158
+ var length_2 = dataView.getUint16(ifdStart, littleEndian);
159
+ for (var i = 0; i < length_2; i++) {
160
+ var offset = ifdStart + i * 12 + 2;
161
+ if (dataView.getUint16(offset, littleEndian) === 274) {
162
+ offset += 8;
163
+ orientation_1 = dataView.getUint16(offset, littleEndian);
164
+ dataView.setUint16(offset, 1, littleEndian);
165
+ break;
166
+ }
167
+ }
168
+ }
169
+ return orientation_1;
170
+ } catch (error) {
171
+ return null;
172
+ }
173
+ }
174
+ function arrayBufferToDataURL(arrayBuffer) {
175
+ var chunks = [];
176
+ var chunkSize = 8192;
177
+ var uint8 = new Uint8Array(arrayBuffer);
178
+ while (uint8.length > 0) {
179
+ var value = uint8.subarray(0, chunkSize);
180
+ chunks.push(String.fromCharCode.apply(null, Array.from ? Array.from(value) : value.slice()));
181
+ uint8 = uint8.subarray(chunkSize);
182
+ }
183
+ return "data:image/jpeg;base64," + btoa(chunks.join(""));
184
+ }
185
+ function getImage(_a) {
186
+ var src = _a.src, _b = _a.arrayBuffer, arrayBuffer = _b === void 0 ? null : _b, _c = _a.orientation, orientation = _c === void 0 ? null : _c;
187
+ var options = {
188
+ src,
189
+ arrayBuffer,
190
+ revoke: false,
191
+ transforms: {
192
+ flip: {
193
+ horizontal: false,
194
+ vertical: false
195
+ },
196
+ rotate: 0
197
+ }
198
+ };
199
+ if (arrayBuffer && orientation && orientation > 1) {
200
+ if (isBlob(src) || !isLocal(src)) {
201
+ options.src = URL.createObjectURL(new Blob([arrayBuffer]));
202
+ options.revoke = true;
203
+ } else {
204
+ options.src = arrayBufferToDataURL(arrayBuffer);
205
+ }
206
+ } else {
207
+ options.src = src;
208
+ }
209
+ if (orientation) {
210
+ options.transforms = getTransforms(orientation);
211
+ }
212
+ return options;
213
+ }
214
+ function parseImage(src, settings) {
215
+ if (settings === void 0) {
216
+ settings = {};
217
+ }
218
+ var checkOrientation = settings.checkOrientation, parse = settings.parse;
219
+ return new Promise(function(resolve) {
220
+ if (checkOrientation || parse) {
221
+ getImageData(src).then(function(data) {
222
+ var orientation = resetAndGetOrientation(data);
223
+ resolve(getImage(data ? { src, arrayBuffer: data, orientation } : { src, arrayBuffer: null, orientation: null }));
224
+ }).catch(function(error) {
225
+ console.warn(error);
226
+ resolve(getImage({ src }));
227
+ });
228
+ } else {
229
+ resolve(getImage({ src }));
230
+ }
231
+ });
232
+ }
233
+ function createImage(src, settings) {
234
+ if (settings === void 0) {
235
+ settings = {};
236
+ }
237
+ return new Promise(function(resolve, reject) {
238
+ var image = document.createElement("img");
239
+ if (settings.crossOrigin) {
240
+ image.crossOrigin = settings.crossOrigin !== true ? settings.crossOrigin : "anonymous";
241
+ }
242
+ image.src = src;
243
+ image.style.visibility = "hidden";
244
+ image.style.position = "fixed";
245
+ document.body.appendChild(image);
246
+ if (image.complete) {
247
+ resolve(image);
248
+ document.body.removeChild(image);
249
+ } else {
250
+ image.addEventListener("load", function() {
251
+ resolve(image);
252
+ document.body.removeChild(image);
253
+ });
254
+ image.addEventListener("error", function() {
255
+ reject(null);
256
+ document.body.removeChild(image);
257
+ });
258
+ }
259
+ });
260
+ }
261
+ function loadImage(src, settings) {
262
+ if (settings === void 0) {
263
+ settings = {};
264
+ }
265
+ return parseImage(src, __assign(__assign({}, settings), { crossOrigin: isCrossOriginURL(src) && settings.crossOrigin })).then(function(options) {
266
+ return new Promise(function(resolve, reject) {
267
+ createImage(options.src, settings).then(function(image) {
268
+ resolve(__assign(__assign({}, options), { width: image.naturalWidth, height: image.naturalHeight }));
269
+ }).catch(function() {
270
+ reject(null);
271
+ });
272
+ });
273
+ });
274
+ }
275
+ function getImageStyle(image, state, area, coefficient, transitions) {
276
+ if (transitions === void 0) {
277
+ transitions = null;
278
+ }
279
+ var optimalImageSize = image.width > image.height ? {
280
+ width: Math.min(512, image.width),
281
+ height: Math.min(512, image.width) / (image.width / image.height)
282
+ } : {
283
+ height: Math.min(512, image.height),
284
+ width: Math.min(512, image.height) * (image.width / image.height)
285
+ };
286
+ var actualImageSize = getTransformedImageSize(state);
287
+ var imageTransforms = {
288
+ rotate: state.transforms.rotate,
289
+ flip: {
290
+ horizontal: state.transforms.flip.horizontal,
291
+ vertical: state.transforms.flip.vertical
292
+ },
293
+ translateX: area.left / coefficient,
294
+ translateY: area.top / coefficient,
295
+ scale: 1 / coefficient
296
+ };
297
+ var compensations = {
298
+ rotate: {
299
+ left: (optimalImageSize.width - actualImageSize.width) / (2 * coefficient),
300
+ top: (optimalImageSize.height - actualImageSize.height) / (2 * coefficient)
301
+ },
302
+ scale: {
303
+ left: (1 - 1 / coefficient) * optimalImageSize.width / 2,
304
+ top: (1 - 1 / coefficient) * optimalImageSize.height / 2
305
+ }
306
+ };
307
+ var transforms = __assign(__assign({}, imageTransforms), { scale: imageTransforms.scale * (image.width / optimalImageSize.width) });
308
+ var result = {
309
+ width: optimalImageSize.width + "px",
310
+ height: optimalImageSize.height + "px",
311
+ left: "0px",
312
+ top: "0px",
313
+ transition: "none",
314
+ transform: "translate3d(" + (-compensations.rotate.left - compensations.scale.left - imageTransforms.translateX) + "px, " + (-compensations.rotate.top - compensations.scale.top - imageTransforms.translateY) + "px, 0px)" + getStyleTransforms(transforms),
315
+ willChange: "none"
316
+ };
317
+ if (transitions && transitions.active) {
318
+ result.willChange = "transform";
319
+ result.transition = transitions.duration + "ms " + transitions.timingFunction;
320
+ }
321
+ return result;
322
+ }
323
+ function getBackgroundStyle(image, state, transitions) {
324
+ if (transitions === void 0) {
325
+ transitions = null;
326
+ }
327
+ if (image && state && state.visibleArea) {
328
+ return getImageStyle(image, state, state.visibleArea, getCoefficient(state), transitions);
329
+ } else {
330
+ return {};
331
+ }
332
+ }
333
+ function getPreviewStyle(image, state, size, transitions) {
334
+ if (transitions === void 0) {
335
+ transitions = null;
336
+ }
337
+ if (image && state && state.visibleArea && state.coordinates) {
338
+ return getImageStyle(image, state, state.coordinates, ratio(state.coordinates) > ratio(size) ? state.coordinates.width / size.width : state.coordinates.height / size.height, transitions);
339
+ } else {
340
+ return {};
341
+ }
342
+ }
343
+ export {
344
+ createImage,
345
+ getBackgroundStyle,
346
+ getImageStyle,
347
+ getPreviewStyle,
348
+ getStyleTransforms,
349
+ loadImage
350
+ };