advanced-cropper
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -63,3 +63,3 @@ import 'tslib'; | ||
}; | ||
// Move the area to fit to coordinates limits: | ||
// Move the area to fit to the coordinates limits: | ||
result.visibleArea = moveToPositionRestrictions(result.visibleArea, { | ||
@@ -66,0 +66,0 @@ left: positionRestrictions.left !== undefined |
import { Boundary, Size } from "../types"; | ||
interface DefaultBoundaryParams { | ||
boundary: HTMLElement; | ||
size: Size; | ||
} | ||
declare function fitBoundary({ boundary, size }: DefaultBoundaryParams): Boundary; | ||
declare function fillBoundary({ boundary }: DefaultBoundaryParams): Boundary; | ||
export { DefaultBoundaryParams, fitBoundary, fillBoundary }; | ||
declare function fitBoundary(boundary: HTMLElement, size: Size): Boundary; | ||
declare function fillBoundary(boundary: HTMLElement): Boundary; | ||
export { fitBoundary, fillBoundary }; |
@@ -1,3 +0,2 @@ | ||
function fitBoundary(_a) { | ||
var boundary = _a.boundary, size = _a.size; | ||
function fitBoundary(boundary, size) { | ||
var areaHeight = boundary.clientHeight; | ||
@@ -16,4 +15,3 @@ var areaWidth = boundary.clientWidth; | ||
} | ||
function fillBoundary(_a) { | ||
var boundary = _a.boundary; | ||
function fillBoundary(boundary) { | ||
return { | ||
@@ -20,0 +18,0 @@ width: boundary.clientWidth, |
import { __assign } from 'tslib'; | ||
import { isBlob, isLocal } from './utils.js'; | ||
import { isCrossOriginURL, isBlob, isLocal } from './utils.js'; | ||
import { getTransformedImageSize, getCoefficient } from './service/helpers.js'; | ||
@@ -288,3 +288,3 @@ import './types.js'; | ||
if (settings === void 0) { settings = {}; } | ||
return parseImage(src, settings).then(function (options) { | ||
return parseImage(src, __assign(__assign({}, settings), { crossOrigin: isCrossOriginURL(src) && settings.crossOrigin })).then(function (options) { | ||
return new Promise(function (resolve, reject) { | ||
@@ -291,0 +291,0 @@ createImage(options.src, settings) |
@@ -1,2 +0,1 @@ | ||
export * from "./html/index"; | ||
export * from "./algorithms/index"; | ||
@@ -7,7 +6,7 @@ export * from "./service/index"; | ||
export * from "./instance/index"; | ||
export * from "./boundary"; | ||
export * from "./animation"; | ||
export * from "./canvas"; | ||
export * from "./transforms"; | ||
export * from "./image"; | ||
export * from "./types"; | ||
export * from "./utils"; |
@@ -1,2 +0,1 @@ | ||
export { updateStretcher } from './html/updateStretcher.js'; | ||
export { debounce, deepClone, deepCompare, distance, emptyCoordinates, getCloserAngle, getDirectionNames, getOptions, isArray, isArrayBufferLike, isBlob, isCardinalDirection, isCrossOriginURL, isDataUrl, isFunction, isGreater, isLocal, isLower, isMouseEvent, isNaN, isNumber, isNumeric, isObject, isOrdinalDirection, isRoughlyEqual, isString, isTouchEvent, isUndefined, isWheelEvent, parseNumber, promiseTimeout, sign } from './utils.js'; | ||
@@ -20,2 +19,3 @@ export { applyDirections, applyMove, applyScale, aspectRatioIntersection, coordinatesToPositionRestrictions, createAspectRatio, diff, fitToPositionRestrictions, fitToSizeRestrictions, getBrokenRatio, getCenter, getCloserSize, getIntersections, getTransitionStyle, inverseMove, isConsistentPosition, isConsistentSize, maxScale, mergePositionRestrictions, minScale, moveToPositionRestrictions, positionToSizeRestrictions, ratio, resizeToSizeRestrictions, rotatePoint, rotateSize, sizeDistance } from './service/utils.js'; | ||
export { fillMoveDirections, fillResizeDirections, normalizeCenter, normalizeImageTransform, normalizeMoveDirections, normalizeResizeDirections } from './service/normalize.js'; | ||
export { touchesToImageTransform, wheelEventToImageTransform } from './service/imageTransforms.js'; | ||
export { isEqualState } from './service/isEqualState.js'; | ||
@@ -41,3 +41,3 @@ export { moveCoordinatesAlgorithm } from './algorithms/moveCoordinatesAlgorithm.js'; | ||
export { drawCroppedArea, prepareSource, updateCanvas } from './canvas.js'; | ||
export { touchesToImageTransform, wheelEventToImageTransform } from './transforms.js'; | ||
export { stretchCropperBoundary, stretchPreviewBoundary } from './boundary.js'; | ||
export { createImage, getBackgroundStyle, getImageStyle, getPreviewStyle, getStyleTransforms, loadImage } from './image.js'; |
@@ -63,4 +63,4 @@ import { Boundary, CoordinatesTransform, CoreSettings, CropperImage, CropperState, CropperTransitionsSettings, DefaultTransforms, ImageTransform, ModifierSettings, MoveDirections, Nullable, PostprocessAction, PostprocessFunction, Priority, ResizeDirections, Rotate, Scale, VisibleArea } from "../types"; | ||
protected abstract setData(data: AbstractCropperData): void; | ||
abstract getData(): AbstractCropperData; | ||
abstract getProps(): AbstractCropperProps<Settings, Instance>; | ||
protected abstract getData(): AbstractCropperData; | ||
protected abstract getProps(): AbstractCropperProps<Settings, Instance>; | ||
getTransitions: () => any; | ||
@@ -67,0 +67,0 @@ hasInteractions: () => boolean; |
@@ -14,5 +14,5 @@ import { AbstractCropper, AbstractCropperData, AbstractCropperProps, AbstractCropperSettings } from "./AbstractCropper"; | ||
protected setData(data: AbstractCropperData): void; | ||
getProps(): AbstractCropperProps<Settings, Instance>; | ||
getData(): AbstractCropperData; | ||
protected getProps(): AbstractCropperProps<Settings, Instance>; | ||
protected getData(): AbstractCropperData; | ||
} | ||
export { CropperInstanceProps, CropperInstance }; |
@@ -9,4 +9,3 @@ import { __extends } from 'tslib'; | ||
_this.props = props; | ||
// If it's not controlled: | ||
if (!props.getData) { | ||
if (!_this.isControlled()) { | ||
_this.data = { | ||
@@ -13,0 +12,0 @@ state: null, |
{ | ||
"name": "advanced-cropper", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "The core of the advanced cropper libraries family", | ||
@@ -58,2 +58,3 @@ "author": "Norserium", | ||
"rollup": "^2.26.10", | ||
"rollup-plugin-copy": "^3.4.0", | ||
"ts-jest": "^27.0.7", | ||
@@ -60,0 +61,0 @@ "typescript": "^4.0.2" |
@@ -8,2 +8,3 @@ export * from "./fitCoordinates"; | ||
export * from "./approximateSize"; | ||
export * from "./imageTransforms"; | ||
export * from "./isEqualState"; |
@@ -8,2 +8,3 @@ export { applyDirections, applyMove, applyScale, aspectRatioIntersection, coordinatesToPositionRestrictions, createAspectRatio, diff, fitToPositionRestrictions, fitToSizeRestrictions, getBrokenRatio, getCenter, getCloserSize, getIntersections, getTransitionStyle, inverseMove, isConsistentPosition, isConsistentSize, maxScale, mergePositionRestrictions, minScale, moveToPositionRestrictions, positionToSizeRestrictions, ratio, resizeToSizeRestrictions, rotatePoint, rotateSize, sizeDistance } from './utils.js'; | ||
export { fillMoveDirections, fillResizeDirections, normalizeCenter, normalizeImageTransform, normalizeMoveDirections, normalizeResizeDirections } from './normalize.js'; | ||
export { touchesToImageTransform, wheelEventToImageTransform } from './imageTransforms.js'; | ||
export { isEqualState } from './isEqualState.js'; |
@@ -55,5 +55,2 @@ type TimingFunction = string; | ||
type RawAspectRatio = Partial<AspectRatio> | number; | ||
interface CropperEvent { | ||
type: string; | ||
} | ||
interface Diff { | ||
@@ -135,6 +132,3 @@ left: number; | ||
} | ||
type BoundarySizeAlgorithm = ({ boundary, size }: { | ||
boundary: HTMLElement; | ||
size: Size; | ||
}) => Boundary; | ||
type BoundarySizeAlgorithm = (boundary: HTMLElement, size: Size) => Boundary; | ||
type DefaultSize<Settings = CoreSettings> = Size | BivarianceConstraint<(state: CropperState, props: Settings) => Size>; | ||
@@ -180,5 +174,2 @@ type DefaultPosition<Settings = CoreSettings> = Position | BivarianceConstraint<(state: CropperState, props: Settings) => Position>; | ||
} | ||
interface Stencil { | ||
aspectRatio: () => AspectRatio; | ||
} | ||
interface SimpleTouch { | ||
@@ -195,4 +186,6 @@ clientX: number; | ||
type Nullable<T> = T | null | undefined; | ||
type ExtensionOf<A, B> = Omit<A, keyof B>; | ||
type DefaultTransforms = PartialTransforms | ((image: CropperImage) => PartialTransforms); | ||
export { TimingFunction, Coordinates, VisibleArea, Limits, SizeRestrictions, AreaSizeRestrictions, PositionRestrictions, AreaPositionRestrictions, ResizeDirections, MoveDirections, Point, Size, ImageSize, Boundary, Intersections, AspectRatio, RawAspectRatio, CropperEvent, Diff, Position, ImageRestriction, Priority, PositionDirection, HorizontalDirection, VerticalDirection, MainDirections, HorizontalCardinalDirection, VerticalCardinalDirection, CardinalDirection, OrdinalDirection, Scale, Rotate, Flip, Transforms, PartialTransforms, ImageTransform, CoordinatesTransform, CropperState, InitializedCropperState, BoundarySizeAlgorithm, DefaultSize, DefaultPosition, DefaultVisibleArea, DefaultCoordinates, CoreSettings, BivarianceConstraint, ModifierSettings, CropperImage, CropperTransitions, CropperTransitionsSettings, Stencil, SimpleTouch, PostprocessAction, PostprocessFunction, Nullable, ExtensionOf, DefaultTransforms }; | ||
type DebouncedFunction<T extends (...args: any[]) => any> = T & { | ||
clear: () => void; | ||
}; | ||
export { TimingFunction, Coordinates, VisibleArea, Limits, SizeRestrictions, AreaSizeRestrictions, PositionRestrictions, AreaPositionRestrictions, ResizeDirections, MoveDirections, Point, Size, ImageSize, Boundary, Intersections, AspectRatio, RawAspectRatio, Diff, Position, ImageRestriction, Priority, PositionDirection, HorizontalDirection, VerticalDirection, MainDirections, HorizontalCardinalDirection, VerticalCardinalDirection, CardinalDirection, OrdinalDirection, Scale, Rotate, Flip, Transforms, PartialTransforms, ImageTransform, CoordinatesTransform, CropperState, InitializedCropperState, BoundarySizeAlgorithm, DefaultSize, DefaultPosition, DefaultVisibleArea, DefaultCoordinates, CoreSettings, BivarianceConstraint, ModifierSettings, CropperImage, CropperTransitions, CropperTransitionsSettings, SimpleTouch, PostprocessAction, PostprocessFunction, Nullable, DefaultTransforms, DebouncedFunction }; |
@@ -17,3 +17,3 @@ import { CardinalDirection, HorizontalCardinalDirection, OrdinalDirection, Point, VerticalCardinalDirection } from "./types"; | ||
declare function isNumber(value: unknown): value is number; | ||
declare const isString: <T>(value: string | T) => value is string; | ||
declare function isString<T>(value: string | T): value is string; | ||
declare function isNaN(value: unknown): boolean; | ||
@@ -20,0 +20,0 @@ declare function isNumeric(value: unknown): value is number | string; |
@@ -112,5 +112,5 @@ function getDirectionNames(hDirection, vDirection) { | ||
} | ||
var isString = function (value) { | ||
function isString(value) { | ||
return typeof value === 'string'; | ||
}; | ||
} | ||
function isNaN(value) { | ||
@@ -164,3 +164,3 @@ return value !== value; | ||
} | ||
// Not performant, small function to reduce code amount | ||
// Not performant, small function to reduce the code amount | ||
function deepClone(obj) { | ||
@@ -167,0 +167,0 @@ if (!isObject(obj)) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
262855
169
5046
26