dune-react 0.0.43 → 0.0.45
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/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/components/puck-base/media.d.ts +1 -0
- package/dist/components/puck-base/media.js +272 -129
- package/dist/components/puck-block/gallery-sections/static-grid/static-grid.js +14 -10
- package/dist/components/puck-block/testimonial-sections/bento-testimonial/component.js +7 -6
- package/dist/components/puck-core/core/props/index.js +7 -0
- package/dist/components/puck-core/core/with-editable.js +4 -5
- package/dist/components/shadcn/slider.js +1 -1
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/flipImageAlgorithm.js +44 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/moveCoordinatesAlgorithm.js +8 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/resizeCoordinatesAlgorithm.js +291 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/rotateImageAlgorithm.js +38 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/transformImageAlgorithm.js +84 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/animation/index.js +78 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/boundary/index.js +31 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/canvas/index.js +94 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/constants/index.js +8 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultAreaPositionRestrictions.js +51 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultAreaSizeRestrictions.js +30 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultBoundary.js +10 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultPosition.js +12 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultPositionRestrictions.js +17 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultSize.js +31 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultSizeRestrictions.js +16 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultStencilConstraints.js +13 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultVisibleArea.js +49 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/index.js +84 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/extensions/stencil-size/index.js +107 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/image/index.js +350 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/instance/AbstractCropperInstance.js +494 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/approximateSize.js +30 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/fitCoordinates.js +30 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/fitVisibleArea.js +26 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/helpers.js +125 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/imageTransforms.js +83 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/interactions.js +19 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/normalize.js +83 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/sizeRestrictions.js +58 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/utils.js +313 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/copyState.js +7 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/createState.js +41 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/moveCoordinates.js +15 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/reconcileState.js +44 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/resizeCoordinates.js +22 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/setBoundary.js +31 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/setCoordinates.js +83 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/setVisibleArea.js +18 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/transformImage.js +18 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/types/index.js +16 -0
- package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/utils/index.js +268 -0
- package/dist/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js +63 -0
- 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
- package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.js +181 -0
- package/dist/style.css +406 -0
- package/package.json +21 -20
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getDefaultTransforms, getDefaultVisibleArea, getDefaultCoordinates } from "../service/helpers.js";
|
|
2
|
+
import { Priority } from "../types/index.js";
|
|
3
|
+
import { setCoordinates, SetCoordinatesMode } from "./setCoordinates.js";
|
|
4
|
+
import { setVisibleArea } from "./setVisibleArea.js";
|
|
5
|
+
function createState(options, settings) {
|
|
6
|
+
var _a, _b, _c, _d, _e;
|
|
7
|
+
var boundary = options.boundary, image = options.image;
|
|
8
|
+
var state = {
|
|
9
|
+
boundary: {
|
|
10
|
+
width: boundary.width,
|
|
11
|
+
height: boundary.height
|
|
12
|
+
},
|
|
13
|
+
imageSize: {
|
|
14
|
+
width: image.width,
|
|
15
|
+
height: image.height
|
|
16
|
+
},
|
|
17
|
+
transforms: {
|
|
18
|
+
rotate: ((_a = image.transforms) === null || _a === void 0 ? void 0 : _a.rotate) || 0,
|
|
19
|
+
flip: {
|
|
20
|
+
horizontal: ((_c = (_b = image.transforms) === null || _b === void 0 ? void 0 : _b.flip) === null || _c === void 0 ? void 0 : _c.horizontal) || false,
|
|
21
|
+
vertical: ((_e = (_d = image.transforms) === null || _d === void 0 ? void 0 : _d.flip) === null || _e === void 0 ? void 0 : _e.vertical) || false
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
visibleArea: null,
|
|
25
|
+
coordinates: null
|
|
26
|
+
};
|
|
27
|
+
if (settings.defaultTransforms) {
|
|
28
|
+
state.transforms = getDefaultTransforms(state, settings);
|
|
29
|
+
}
|
|
30
|
+
if (settings.priority === Priority.visibleArea) {
|
|
31
|
+
state = setVisibleArea(state, settings, getDefaultVisibleArea(state, settings), false);
|
|
32
|
+
state = setCoordinates(state, settings, getDefaultCoordinates(state, settings), SetCoordinatesMode.limit);
|
|
33
|
+
} else {
|
|
34
|
+
state = setCoordinates(state, settings, getDefaultCoordinates(state, settings), SetCoordinatesMode.unsafe);
|
|
35
|
+
state = setVisibleArea(state, settings, getDefaultVisibleArea(state, settings), true);
|
|
36
|
+
}
|
|
37
|
+
return state;
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
createState
|
|
41
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { applyMove, moveToPositionRestrictions, mergePositionRestrictions, coordinatesToPositionRestrictions } from "../service/utils.js";
|
|
2
|
+
import { isInitializedState, getPositionRestrictions } from "../service/helpers.js";
|
|
3
|
+
import { copyState } from "./copyState.js";
|
|
4
|
+
function moveCoordinates(state, settings, directions) {
|
|
5
|
+
if (isInitializedState(state)) {
|
|
6
|
+
var result = copyState(state);
|
|
7
|
+
result.coordinates = applyMove(result.coordinates, directions);
|
|
8
|
+
result.coordinates = moveToPositionRestrictions(result.coordinates, mergePositionRestrictions(coordinatesToPositionRestrictions(result.visibleArea), getPositionRestrictions(result, settings)));
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
return state;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
moveCoordinates
|
|
15
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { __assign } from "../../../../tslib@2.8.1/node_modules/tslib/tslib.es6.js";
|
|
2
|
+
import { getBrokenRatio, ratio, applyMove, diff, getCenter, moveToPositionRestrictions, mergePositionRestrictions, coordinatesToPositionRestrictions } from "../service/utils.js";
|
|
3
|
+
import { mergeSizeRestrictions } from "../service/sizeRestrictions.js";
|
|
4
|
+
import { isInitializedState, getAspectRatio, getSizeRestrictions, getAreaSizeRestrictions, getAreaPositionRestrictions, getPositionRestrictions } from "../service/helpers.js";
|
|
5
|
+
import { copyState } from "./copyState.js";
|
|
6
|
+
import { approximateSize } from "../service/approximateSize.js";
|
|
7
|
+
function reconcileState(state, settings) {
|
|
8
|
+
if (isInitializedState(state)) {
|
|
9
|
+
var result = copyState(state);
|
|
10
|
+
var aspectRatio = getAspectRatio(state, settings);
|
|
11
|
+
var sizeRestrictions = getSizeRestrictions(state, settings);
|
|
12
|
+
var areaSizeRestrictions = getAreaSizeRestrictions(state, settings);
|
|
13
|
+
var brokenRatio = getBrokenRatio(ratio(state.coordinates), aspectRatio);
|
|
14
|
+
var desiredSize = brokenRatio ? {
|
|
15
|
+
height: state.coordinates.height,
|
|
16
|
+
width: state.coordinates.height * brokenRatio
|
|
17
|
+
} : state.coordinates;
|
|
18
|
+
result.coordinates = __assign(__assign({}, result.coordinates), approximateSize({
|
|
19
|
+
width: desiredSize.width,
|
|
20
|
+
height: desiredSize.height,
|
|
21
|
+
aspectRatio,
|
|
22
|
+
sizeRestrictions: mergeSizeRestrictions(areaSizeRestrictions, sizeRestrictions)
|
|
23
|
+
}));
|
|
24
|
+
result.coordinates = applyMove(result.coordinates, diff(getCenter(state.coordinates), getCenter(result.coordinates)));
|
|
25
|
+
var scaleModifier = Math.max(result.coordinates.width / result.visibleArea.width, result.coordinates.height / result.visibleArea.height, 1);
|
|
26
|
+
result.visibleArea = __assign(__assign({}, state.visibleArea), approximateSize({
|
|
27
|
+
width: state.visibleArea.width * scaleModifier,
|
|
28
|
+
height: state.visibleArea.height * scaleModifier,
|
|
29
|
+
aspectRatio: {
|
|
30
|
+
minimum: ratio(result.boundary),
|
|
31
|
+
maximum: ratio(result.boundary)
|
|
32
|
+
},
|
|
33
|
+
sizeRestrictions: areaSizeRestrictions
|
|
34
|
+
}));
|
|
35
|
+
result.visibleArea = applyMove(result.visibleArea, diff(getCenter(state.visibleArea), getCenter(result.visibleArea)));
|
|
36
|
+
result.visibleArea = moveToPositionRestrictions(result.visibleArea, getAreaPositionRestrictions(result, settings));
|
|
37
|
+
result.coordinates = moveToPositionRestrictions(result.coordinates, mergePositionRestrictions(coordinatesToPositionRestrictions(result.visibleArea), getPositionRestrictions(result, settings)));
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
return state;
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
reconcileState
|
|
44
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __assign } from "../../../../tslib@2.8.1/node_modules/tslib/tslib.es6.js";
|
|
2
|
+
import { mergePositionRestrictions, coordinatesToPositionRestrictions } from "../service/utils.js";
|
|
3
|
+
import { getMinimumSize, getSizeRestrictions, isInitializedState, getAspectRatio, getPositionRestrictions } from "../service/helpers.js";
|
|
4
|
+
import { copyState } from "./copyState.js";
|
|
5
|
+
import { anchoredResizeCoordinatesAlgorithm } from "../algorithms/resizeCoordinatesAlgorithm.js";
|
|
6
|
+
function resizeCoordinates(state, settings, anchor, directions, options) {
|
|
7
|
+
var minimumSize = getMinimumSize(state);
|
|
8
|
+
var sizeRestrictions = getSizeRestrictions(state, settings);
|
|
9
|
+
return isInitializedState(state) ? __assign(__assign({}, copyState(state)), { coordinates: anchoredResizeCoordinatesAlgorithm(state.coordinates, anchor, directions, options, {
|
|
10
|
+
positionRestrictions: mergePositionRestrictions(getPositionRestrictions(state, settings), coordinatesToPositionRestrictions(state.visibleArea)),
|
|
11
|
+
sizeRestrictions: {
|
|
12
|
+
maxWidth: Math.min(sizeRestrictions.maxWidth, state.visibleArea.width),
|
|
13
|
+
maxHeight: Math.min(sizeRestrictions.maxHeight, state.visibleArea.height),
|
|
14
|
+
minWidth: Math.max(Math.min(sizeRestrictions.minWidth, state.visibleArea.width), minimumSize),
|
|
15
|
+
minHeight: Math.max(Math.min(sizeRestrictions.minHeight, state.visibleArea.height), minimumSize)
|
|
16
|
+
},
|
|
17
|
+
aspectRatio: getAspectRatio(state, settings)
|
|
18
|
+
}) }) : state;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
resizeCoordinates
|
|
22
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __assign } from "../../../../tslib@2.8.1/node_modules/tslib/tslib.es6.js";
|
|
2
|
+
import { ratio, applyScale, resizeToSizeRestrictions, inverseMove, fitToPositionRestrictions, coordinatesToPositionRestrictions, applyMove, moveToPositionRestrictions } from "../service/utils.js";
|
|
3
|
+
import { getSizeRestrictions, getAreaSizeRestrictions, getAreaPositionRestrictions } from "../service/helpers.js";
|
|
4
|
+
import { copyState } from "./copyState.js";
|
|
5
|
+
import { fitCoordinates } from "../service/fitCoordinates.js";
|
|
6
|
+
function setBoundary(state, settings, boundary) {
|
|
7
|
+
var result = __assign(__assign({}, copyState(state)), { boundary });
|
|
8
|
+
if (result.visibleArea && result.coordinates && state.visibleArea) {
|
|
9
|
+
result.visibleArea.height = result.visibleArea.width / ratio(boundary);
|
|
10
|
+
result.visibleArea.top += (state.visibleArea.height - result.visibleArea.height) / 2;
|
|
11
|
+
var sizeRestrictions = getSizeRestrictions(result, settings);
|
|
12
|
+
if (Math.max(sizeRestrictions.minHeight, result.coordinates.height) - result.visibleArea.height > 0 || Math.max(sizeRestrictions.minWidth, result.coordinates.width) - result.visibleArea.width > 0) {
|
|
13
|
+
result.visibleArea = applyScale(result.visibleArea, Math.max(Math.max(sizeRestrictions.minHeight, result.coordinates.height) / result.visibleArea.height, Math.max(sizeRestrictions.minWidth, result.coordinates.width) / result.visibleArea.width));
|
|
14
|
+
}
|
|
15
|
+
result.visibleArea = resizeToSizeRestrictions(result.visibleArea, getAreaSizeRestrictions(result, settings));
|
|
16
|
+
var move = inverseMove(fitToPositionRestrictions(result.coordinates, coordinatesToPositionRestrictions(result.visibleArea)));
|
|
17
|
+
if (result.visibleArea.width < result.coordinates.width) {
|
|
18
|
+
move.left = 0;
|
|
19
|
+
}
|
|
20
|
+
if (result.visibleArea.height < result.coordinates.height) {
|
|
21
|
+
move.top = 0;
|
|
22
|
+
}
|
|
23
|
+
result.visibleArea = applyMove(result.visibleArea, move);
|
|
24
|
+
result.visibleArea = moveToPositionRestrictions(result.visibleArea, getAreaPositionRestrictions(result, settings));
|
|
25
|
+
result = fitCoordinates(result, settings);
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
setBoundary
|
|
31
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { __assign } from "../../../../tslib@2.8.1/node_modules/tslib/tslib.es6.js";
|
|
2
|
+
import { emptyCoordinates, isUndefined } from "../utils/index.js";
|
|
3
|
+
import { mergePositionRestrictions, coordinatesToPositionRestrictions, applyScale, maxScale, applyMove, inverseMove, fitToPositionRestrictions } from "../service/utils.js";
|
|
4
|
+
import { getAspectRatio, getSizeRestrictions, getPositionRestrictions, getAreaSizeRestrictions } from "../service/helpers.js";
|
|
5
|
+
import { copyState } from "./copyState.js";
|
|
6
|
+
import { approximateSize } from "../service/approximateSize.js";
|
|
7
|
+
import { fitVisibleArea } from "../service/fitVisibleArea.js";
|
|
8
|
+
import { moveCoordinatesAlgorithm } from "../algorithms/moveCoordinatesAlgorithm.js";
|
|
9
|
+
var SetCoordinatesMode;
|
|
10
|
+
(function(SetCoordinatesMode2) {
|
|
11
|
+
SetCoordinatesMode2["limit"] = "limit";
|
|
12
|
+
SetCoordinatesMode2["zoom"] = "zoom";
|
|
13
|
+
SetCoordinatesMode2["unsafe"] = "unsafe";
|
|
14
|
+
})(SetCoordinatesMode || (SetCoordinatesMode = {}));
|
|
15
|
+
function setCoordinates(state, settings, transform, mode) {
|
|
16
|
+
if (mode === void 0) {
|
|
17
|
+
mode = true;
|
|
18
|
+
}
|
|
19
|
+
var currentMode = mode === false ? SetCoordinatesMode.unsafe : mode === true ? SetCoordinatesMode.zoom : mode;
|
|
20
|
+
var aspectRatio = getAspectRatio(state, settings);
|
|
21
|
+
var sizeRestrictions = getSizeRestrictions(state, settings);
|
|
22
|
+
if (state.visibleArea && currentMode === SetCoordinatesMode.limit) {
|
|
23
|
+
sizeRestrictions = __assign(__assign({}, sizeRestrictions), { minWidth: Math.min(state.visibleArea.width, sizeRestrictions.minWidth), minHeight: Math.min(state.visibleArea.height, sizeRestrictions.minHeight), maxWidth: Math.min(state.visibleArea.width, sizeRestrictions.maxWidth), maxHeight: Math.min(state.visibleArea.height, sizeRestrictions.maxHeight) });
|
|
24
|
+
}
|
|
25
|
+
var positionRestrictions = getPositionRestrictions(state, settings);
|
|
26
|
+
if (state.visibleArea && currentMode === SetCoordinatesMode.limit) {
|
|
27
|
+
positionRestrictions = mergePositionRestrictions(positionRestrictions, coordinatesToPositionRestrictions(state.visibleArea));
|
|
28
|
+
}
|
|
29
|
+
var move = function(prevCoordinates, newCoordinates) {
|
|
30
|
+
return moveCoordinatesAlgorithm(prevCoordinates, {
|
|
31
|
+
left: newCoordinates.left - (prevCoordinates.left || 0),
|
|
32
|
+
top: newCoordinates.top - (prevCoordinates.top || 0)
|
|
33
|
+
}, positionRestrictions);
|
|
34
|
+
};
|
|
35
|
+
var resize = function(prevCoordinates, newCoordinates) {
|
|
36
|
+
var coordinates2 = __assign(__assign(__assign({}, prevCoordinates), approximateSize({
|
|
37
|
+
width: newCoordinates.width,
|
|
38
|
+
height: newCoordinates.height,
|
|
39
|
+
sizeRestrictions,
|
|
40
|
+
aspectRatio
|
|
41
|
+
})), { left: 0, top: 0 });
|
|
42
|
+
return move(coordinates2, {
|
|
43
|
+
left: prevCoordinates.left || 0,
|
|
44
|
+
top: prevCoordinates.top || 0
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var coordinates = state.coordinates ? __assign({}, state.coordinates) : emptyCoordinates();
|
|
48
|
+
var transforms = Array.isArray(transform) ? transform : [transform];
|
|
49
|
+
transforms.forEach(function(transform2) {
|
|
50
|
+
var changes;
|
|
51
|
+
if (typeof transform2 === "function") {
|
|
52
|
+
changes = transform2(__assign(__assign({}, state), { coordinates }), settings);
|
|
53
|
+
} else {
|
|
54
|
+
changes = transform2;
|
|
55
|
+
}
|
|
56
|
+
if (changes) {
|
|
57
|
+
if (!isUndefined(changes.width) || !isUndefined(changes.height)) {
|
|
58
|
+
coordinates = resize(coordinates, __assign(__assign({}, coordinates), changes));
|
|
59
|
+
}
|
|
60
|
+
if (!isUndefined(changes.left) || !isUndefined(changes.top)) {
|
|
61
|
+
coordinates = move(coordinates, __assign(__assign({}, coordinates), changes));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
var result = __assign(__assign({}, copyState(state)), { coordinates });
|
|
66
|
+
if (result.visibleArea && currentMode === SetCoordinatesMode.zoom) {
|
|
67
|
+
var widthIntersections = Math.max(0, result.coordinates.width - result.visibleArea.width);
|
|
68
|
+
var heightIntersections = Math.max(0, result.coordinates.height - result.visibleArea.height);
|
|
69
|
+
var areaSizeRestrictions = getAreaSizeRestrictions(state, settings);
|
|
70
|
+
var scale = widthIntersections > heightIntersections ? result.coordinates.width / result.visibleArea.width : result.coordinates.height / result.visibleArea.height;
|
|
71
|
+
if (scale > 1) {
|
|
72
|
+
result.visibleArea = applyScale(result.visibleArea, Math.min(scale, maxScale(result.visibleArea, areaSizeRestrictions)));
|
|
73
|
+
}
|
|
74
|
+
result.visibleArea = applyMove(result.visibleArea, inverseMove(fitToPositionRestrictions(result.coordinates, coordinatesToPositionRestrictions(result.visibleArea))));
|
|
75
|
+
return fitVisibleArea(result, settings);
|
|
76
|
+
} else {
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
SetCoordinatesMode,
|
|
82
|
+
setCoordinates
|
|
83
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __assign } from "../../../../tslib@2.8.1/node_modules/tslib/tslib.es6.js";
|
|
2
|
+
import { copyState } from "./copyState.js";
|
|
3
|
+
import { fitCoordinates } from "../service/fitCoordinates.js";
|
|
4
|
+
import { fitVisibleArea } from "../service/fitVisibleArea.js";
|
|
5
|
+
function setVisibleArea(state, settings, visibleArea, safe) {
|
|
6
|
+
if (safe === void 0) {
|
|
7
|
+
safe = true;
|
|
8
|
+
}
|
|
9
|
+
var result = __assign(__assign({}, copyState(state)), { visibleArea });
|
|
10
|
+
result = fitVisibleArea(result, settings);
|
|
11
|
+
if (safe) {
|
|
12
|
+
result = fitCoordinates(result, settings);
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
setVisibleArea
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { rotateImageAlgorithm } from "../algorithms/rotateImageAlgorithm.js";
|
|
2
|
+
import { flipImageAlgorithm } from "../algorithms/flipImageAlgorithm.js";
|
|
3
|
+
import { transformImageAlgorithm } from "../algorithms/transformImageAlgorithm.js";
|
|
4
|
+
function transformImage(state, settings, transform) {
|
|
5
|
+
if (transform.rotate) {
|
|
6
|
+
state = rotateImageAlgorithm(state, settings, transform.rotate);
|
|
7
|
+
}
|
|
8
|
+
if (transform.flip) {
|
|
9
|
+
state = flipImageAlgorithm(state, settings, transform.flip.horizontal, transform.flip.vertical);
|
|
10
|
+
}
|
|
11
|
+
if (transform.move || transform.scale) {
|
|
12
|
+
state = transformImageAlgorithm(state, settings, transform);
|
|
13
|
+
}
|
|
14
|
+
return state;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
transformImage
|
|
18
|
+
};
|
package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/types/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var ImageRestriction;
|
|
2
|
+
(function(ImageRestriction2) {
|
|
3
|
+
ImageRestriction2["fillArea"] = "fillArea";
|
|
4
|
+
ImageRestriction2["fitArea"] = "fitArea";
|
|
5
|
+
ImageRestriction2["stencil"] = "stencil";
|
|
6
|
+
ImageRestriction2["none"] = "none";
|
|
7
|
+
})(ImageRestriction || (ImageRestriction = {}));
|
|
8
|
+
var Priority;
|
|
9
|
+
(function(Priority2) {
|
|
10
|
+
Priority2["coordinates"] = "coordinates";
|
|
11
|
+
Priority2["visibleArea"] = "visibleArea";
|
|
12
|
+
})(Priority || (Priority = {}));
|
|
13
|
+
export {
|
|
14
|
+
ImageRestriction,
|
|
15
|
+
Priority
|
|
16
|
+
};
|
package/dist/node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/utils/index.js
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
function getDirectionNames(hDirection, vDirection) {
|
|
2
|
+
var camelCase, snakeCase;
|
|
3
|
+
if (hDirection && vDirection) {
|
|
4
|
+
camelCase = "" + hDirection + vDirection[0].toUpperCase() + vDirection.slice(1);
|
|
5
|
+
snakeCase = hDirection + "-" + vDirection;
|
|
6
|
+
} else {
|
|
7
|
+
camelCase = hDirection || vDirection;
|
|
8
|
+
snakeCase = hDirection || vDirection;
|
|
9
|
+
}
|
|
10
|
+
return { camelCase, snakeCase };
|
|
11
|
+
}
|
|
12
|
+
function isBlob(url) {
|
|
13
|
+
return /^blob:/.test(url);
|
|
14
|
+
}
|
|
15
|
+
function isDataUrl(url) {
|
|
16
|
+
return /^data:/.test(url);
|
|
17
|
+
}
|
|
18
|
+
function isLocal(url) {
|
|
19
|
+
return isBlob(url) || isDataUrl(url);
|
|
20
|
+
}
|
|
21
|
+
function isCrossOriginURL(url) {
|
|
22
|
+
if (isLocal(url)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
var pageLocation = window.location;
|
|
26
|
+
var URL_HOST_PATTERN = /(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/;
|
|
27
|
+
var urlMatch = URL_HOST_PATTERN.exec(url) || [];
|
|
28
|
+
var urlparts = {
|
|
29
|
+
protocol: urlMatch[1] || "",
|
|
30
|
+
host: urlMatch[2] || "",
|
|
31
|
+
port: urlMatch[3] || ""
|
|
32
|
+
};
|
|
33
|
+
var defaultPort = function(protocol) {
|
|
34
|
+
if (protocol === "http") {
|
|
35
|
+
return 80;
|
|
36
|
+
} else {
|
|
37
|
+
return 433;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var portOf = function(location) {
|
|
41
|
+
return location.port || defaultPort(location.protocol || pageLocation.protocol);
|
|
42
|
+
};
|
|
43
|
+
return !(!urlparts.protocol && !urlparts.host && !urlparts.port || Boolean(urlparts.protocol && urlparts.protocol == pageLocation.protocol && urlparts.host && urlparts.host == pageLocation.host && urlparts.host && portOf(urlparts) == portOf(pageLocation)));
|
|
44
|
+
}
|
|
45
|
+
function isArray(value) {
|
|
46
|
+
return Array.isArray(value);
|
|
47
|
+
}
|
|
48
|
+
function isFunction(value) {
|
|
49
|
+
return typeof value === "function";
|
|
50
|
+
}
|
|
51
|
+
function isUndefined(obj) {
|
|
52
|
+
return obj === void 0;
|
|
53
|
+
}
|
|
54
|
+
var isObject = function(term) {
|
|
55
|
+
return term !== null && typeof term === "object";
|
|
56
|
+
};
|
|
57
|
+
function getOptions(options, defaultScheme, falseScheme) {
|
|
58
|
+
if (falseScheme === void 0) {
|
|
59
|
+
falseScheme = {};
|
|
60
|
+
}
|
|
61
|
+
var result = {};
|
|
62
|
+
if (isObject(options)) {
|
|
63
|
+
Object.keys(defaultScheme).forEach(function(key) {
|
|
64
|
+
if (isUndefined(options[key])) {
|
|
65
|
+
result[key] = defaultScheme[key];
|
|
66
|
+
} else if (isObject(defaultScheme[key])) {
|
|
67
|
+
if (isObject(options[key])) {
|
|
68
|
+
result[key] = getOptions(options[key], defaultScheme[key], falseScheme[key]);
|
|
69
|
+
} else {
|
|
70
|
+
result[key] = options[key] ? defaultScheme[key] : falseScheme[key];
|
|
71
|
+
}
|
|
72
|
+
} else if (defaultScheme[key] === true || defaultScheme[key] === false) {
|
|
73
|
+
result[key] = Boolean(options[key]);
|
|
74
|
+
} else {
|
|
75
|
+
result[key] = options[key];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return result;
|
|
79
|
+
} else {
|
|
80
|
+
if (options) {
|
|
81
|
+
return defaultScheme;
|
|
82
|
+
} else {
|
|
83
|
+
return falseScheme;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function parseNumber(number) {
|
|
88
|
+
var parsedNumber = Number(number);
|
|
89
|
+
if (Number.isNaN(parsedNumber)) {
|
|
90
|
+
return number;
|
|
91
|
+
} else {
|
|
92
|
+
return parsedNumber;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function isBoolean(value) {
|
|
96
|
+
return value === true || value === false;
|
|
97
|
+
}
|
|
98
|
+
function isNumber(value) {
|
|
99
|
+
return typeof value === "number";
|
|
100
|
+
}
|
|
101
|
+
function isString(value) {
|
|
102
|
+
return typeof value === "string";
|
|
103
|
+
}
|
|
104
|
+
function isNaN(value) {
|
|
105
|
+
return value !== value;
|
|
106
|
+
}
|
|
107
|
+
function isNumeric(value) {
|
|
108
|
+
return isNumber(value) && !isNaN(value) || isString(value) && !Number.isNaN(parseFloat(value)) && isFinite(parseFloat(value));
|
|
109
|
+
}
|
|
110
|
+
function distance(firstPoint, secondPoint) {
|
|
111
|
+
return Math.sqrt(Math.pow(firstPoint.left - secondPoint.left, 2) + Math.pow(firstPoint.top - secondPoint.top, 2));
|
|
112
|
+
}
|
|
113
|
+
function isRoughlyEqual(a, b, tolerance) {
|
|
114
|
+
if (tolerance === void 0) {
|
|
115
|
+
tolerance = 1e-3;
|
|
116
|
+
}
|
|
117
|
+
return Math.abs(b - a) < tolerance;
|
|
118
|
+
}
|
|
119
|
+
function isGreater(a, b, tolerance) {
|
|
120
|
+
return isRoughlyEqual(a, b, tolerance) ? false : a > b;
|
|
121
|
+
}
|
|
122
|
+
function isLower(a, b, tolerance) {
|
|
123
|
+
return isRoughlyEqual(a, b, tolerance) ? false : a < b;
|
|
124
|
+
}
|
|
125
|
+
function sign(value) {
|
|
126
|
+
var number = +value;
|
|
127
|
+
if (number === 0 || isNaN(number)) {
|
|
128
|
+
return number;
|
|
129
|
+
}
|
|
130
|
+
return number > 0 ? 1 : -1;
|
|
131
|
+
}
|
|
132
|
+
function promiseTimeout(timeout) {
|
|
133
|
+
return new Promise(function(resolve) {
|
|
134
|
+
setTimeout(function() {
|
|
135
|
+
resolve();
|
|
136
|
+
}, timeout);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function deepClone(obj) {
|
|
140
|
+
if (!isObject(obj)) {
|
|
141
|
+
return obj;
|
|
142
|
+
}
|
|
143
|
+
var result = {};
|
|
144
|
+
if (Array.isArray(obj)) {
|
|
145
|
+
result = obj.map(function(item) {
|
|
146
|
+
return deepClone(item);
|
|
147
|
+
});
|
|
148
|
+
} else {
|
|
149
|
+
Object.keys(obj).forEach(function(key) {
|
|
150
|
+
return result[key] = deepClone(obj[key]);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
function deepCompare(a, b, tolerance) {
|
|
156
|
+
if (tolerance === void 0) {
|
|
157
|
+
tolerance = 1e-3;
|
|
158
|
+
}
|
|
159
|
+
if (isNumber(a) && isNumber(b) && isRoughlyEqual(a, b, tolerance))
|
|
160
|
+
return true;
|
|
161
|
+
if (a === b)
|
|
162
|
+
return true;
|
|
163
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
164
|
+
if (a.constructor !== b.constructor)
|
|
165
|
+
return false;
|
|
166
|
+
var length_1, i = void 0;
|
|
167
|
+
if (Array.isArray(a)) {
|
|
168
|
+
length_1 = a.length;
|
|
169
|
+
if (length_1 != b.length)
|
|
170
|
+
return false;
|
|
171
|
+
for (i = length_1; i-- !== 0; )
|
|
172
|
+
if (!deepCompare(a[i], b[i], tolerance))
|
|
173
|
+
return false;
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
if (a.valueOf !== Object.prototype.valueOf)
|
|
177
|
+
return a.valueOf() === b.valueOf();
|
|
178
|
+
if (a.toString !== Object.prototype.toString)
|
|
179
|
+
return a.toString() === b.toString();
|
|
180
|
+
var keys = Object.keys(a);
|
|
181
|
+
length_1 = keys.length;
|
|
182
|
+
if (length_1 !== Object.keys(b).length)
|
|
183
|
+
return false;
|
|
184
|
+
for (i = length_1; i-- !== 0; )
|
|
185
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
186
|
+
return false;
|
|
187
|
+
for (i = length_1; i-- !== 0; ) {
|
|
188
|
+
var key = keys[i];
|
|
189
|
+
if (!deepCompare(a[key], b[key], tolerance))
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
return a !== a && b !== b;
|
|
195
|
+
}
|
|
196
|
+
function emptyCoordinates() {
|
|
197
|
+
return {
|
|
198
|
+
left: 0,
|
|
199
|
+
top: 0,
|
|
200
|
+
width: 0,
|
|
201
|
+
height: 0
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function isCardinalDirection(value) {
|
|
205
|
+
return value === "west" || value === "south" || value === "north" || value === "east";
|
|
206
|
+
}
|
|
207
|
+
function debounce(callback, delay) {
|
|
208
|
+
var timestamp;
|
|
209
|
+
var timeout;
|
|
210
|
+
function later() {
|
|
211
|
+
var args = [];
|
|
212
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
213
|
+
args[_i] = arguments[_i];
|
|
214
|
+
}
|
|
215
|
+
var last = Date.now() - timestamp;
|
|
216
|
+
var delayValue = isFunction(delay) ? delay() : delay || 0;
|
|
217
|
+
if (last < delayValue && last >= 0) {
|
|
218
|
+
timeout = setTimeout(function() {
|
|
219
|
+
return later.apply(void 0, args);
|
|
220
|
+
}, delayValue - last);
|
|
221
|
+
} else {
|
|
222
|
+
callback.apply(void 0, args);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function result() {
|
|
226
|
+
var args = [];
|
|
227
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
228
|
+
args[_i] = arguments[_i];
|
|
229
|
+
}
|
|
230
|
+
timestamp = Date.now();
|
|
231
|
+
timeout = setTimeout(function() {
|
|
232
|
+
return later.apply(void 0, args);
|
|
233
|
+
}, isFunction(delay) ? delay() : delay || 0);
|
|
234
|
+
}
|
|
235
|
+
result.clear = function() {
|
|
236
|
+
clearTimeout(timeout);
|
|
237
|
+
};
|
|
238
|
+
return result;
|
|
239
|
+
}
|
|
240
|
+
export {
|
|
241
|
+
debounce,
|
|
242
|
+
deepClone,
|
|
243
|
+
deepCompare,
|
|
244
|
+
distance,
|
|
245
|
+
emptyCoordinates,
|
|
246
|
+
getDirectionNames,
|
|
247
|
+
getOptions,
|
|
248
|
+
isArray,
|
|
249
|
+
isBlob,
|
|
250
|
+
isBoolean,
|
|
251
|
+
isCardinalDirection,
|
|
252
|
+
isCrossOriginURL,
|
|
253
|
+
isDataUrl,
|
|
254
|
+
isFunction,
|
|
255
|
+
isGreater,
|
|
256
|
+
isLocal,
|
|
257
|
+
isLower,
|
|
258
|
+
isNaN,
|
|
259
|
+
isNumber,
|
|
260
|
+
isNumeric,
|
|
261
|
+
isObject,
|
|
262
|
+
isRoughlyEqual,
|
|
263
|
+
isString,
|
|
264
|
+
isUndefined,
|
|
265
|
+
parseNumber,
|
|
266
|
+
promiseTimeout,
|
|
267
|
+
sign
|
|
268
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { getDefaultExportFromCjs } from "../../../../../_virtual/_commonjsHelpers.js";
|
|
2
|
+
import { __module as classnames } from "../../../../../_virtual/index.js";
|
|
3
|
+
/*!
|
|
4
|
+
Copyright (c) 2018 Jed Watson.
|
|
5
|
+
Licensed under the MIT License (MIT), see
|
|
6
|
+
http://jedwatson.github.io/classnames
|
|
7
|
+
*/
|
|
8
|
+
(function(module) {
|
|
9
|
+
(function() {
|
|
10
|
+
var hasOwn = {}.hasOwnProperty;
|
|
11
|
+
function classNames() {
|
|
12
|
+
var classes = "";
|
|
13
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
14
|
+
var arg = arguments[i];
|
|
15
|
+
if (arg) {
|
|
16
|
+
classes = appendClass(classes, parseValue(arg));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return classes;
|
|
20
|
+
}
|
|
21
|
+
function parseValue(arg) {
|
|
22
|
+
if (typeof arg === "string" || typeof arg === "number") {
|
|
23
|
+
return arg;
|
|
24
|
+
}
|
|
25
|
+
if (typeof arg !== "object") {
|
|
26
|
+
return "";
|
|
27
|
+
}
|
|
28
|
+
if (Array.isArray(arg)) {
|
|
29
|
+
return classNames.apply(null, arg);
|
|
30
|
+
}
|
|
31
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
32
|
+
return arg.toString();
|
|
33
|
+
}
|
|
34
|
+
var classes = "";
|
|
35
|
+
for (var key in arg) {
|
|
36
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
37
|
+
classes = appendClass(classes, key);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return classes;
|
|
41
|
+
}
|
|
42
|
+
function appendClass(value, newClass) {
|
|
43
|
+
if (!newClass) {
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
if (value) {
|
|
47
|
+
return value + " " + newClass;
|
|
48
|
+
}
|
|
49
|
+
return value + newClass;
|
|
50
|
+
}
|
|
51
|
+
if (module.exports) {
|
|
52
|
+
classNames.default = classNames;
|
|
53
|
+
module.exports = classNames;
|
|
54
|
+
} else {
|
|
55
|
+
window.classNames = classNames;
|
|
56
|
+
}
|
|
57
|
+
})();
|
|
58
|
+
})(classnames);
|
|
59
|
+
var classnamesExports = classnames.exports;
|
|
60
|
+
const cn = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
|
|
61
|
+
export {
|
|
62
|
+
cn as default
|
|
63
|
+
};
|