@mjhls/mjh-framework 1.0.21 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -16,7 +16,6 @@ import FormControl from 'react-bootstrap/FormControl';
16
16
  import Button from 'react-bootstrap/Button';
17
17
  import PropTypes from 'prop-types';
18
18
  import { Figure, Carousel } from 'react-bootstrap';
19
- import imageUrlBuilder from '@sanity/image-url';
20
19
 
21
20
  /*! *****************************************************************************
22
21
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3362,8 +3361,7 @@ var AD = function AD(_ref) {
3362
3361
  adUnit = _ref.adUnit,
3363
3362
  sizeMapping = _ref.sizeMapping,
3364
3363
  className = _ref.className,
3365
- _ref$slotId = _ref.slotId,
3366
- slotId = _ref$slotId === undefined ? 'test' : _ref$slotId,
3364
+ slotId = _ref.slotId,
3367
3365
  sizes = _ref.sizes,
3368
3366
  minInViewPercent = _ref.minInViewPercent;
3369
3367
 
@@ -3383,18 +3381,16 @@ var AD = function AD(_ref) {
3383
3381
  lib_3.refresh(slotId);
3384
3382
  }
3385
3383
  },
3386
- onSlotIsViewable: function onSlotIsViewable(dfpEventData) {
3387
- return console.log(slotId + ' viewable!.', dfpEventData);
3388
- }
3384
+ onSlotIsViewable: function onSlotIsViewable() {}
3389
3385
  })
3390
3386
  )
3391
3387
  );
3392
3388
  };
3393
3389
 
3394
3390
  AD.propTypes = {
3395
- networkID: PropTypes.number.isRequired,
3391
+ networkID: PropTypes.string.isRequired,
3396
3392
  adUnit: PropTypes.string.isRequired,
3397
- slotId: PropTypes.string.isRequired,
3393
+ slotId: PropTypes.string,
3398
3394
  className: PropTypes.string,
3399
3395
  sizeMapping: PropTypes.array,
3400
3396
  sizes: PropTypes.array,
@@ -3421,7 +3417,8 @@ var TemplateNormal = function TemplateNormal(props) {
3421
3417
  title = props.title,
3422
3418
  keywords = props.keywords,
3423
3419
  description = props.description,
3424
- website = props.website;
3420
+ website = props.website,
3421
+ horizontalAD = props.config.horizontalAD;
3425
3422
 
3426
3423
 
3427
3424
  function navigation() {
@@ -3472,7 +3469,7 @@ var TemplateNormal = function TemplateNormal(props) {
3472
3469
  React__default.createElement(
3473
3470
  Container,
3474
3471
  null,
3475
- React__default.createElement(AD728x90, { networkID: '20642765', adUnit: 'aesthetic_authority' })
3472
+ React__default.createElement(AD728x90, { networkID: horizontalAD.networkID, adUnit: horizontalAD.adUnit })
3476
3473
  ),
3477
3474
  React__default.createElement(
3478
3475
  Container,
@@ -6213,6 +6210,543 @@ var YouTubePlayer$1 = function YouTubePlayer(_ref) {
6213
6210
  return React__default.createElement(YouTube, { videoId: id, opts: { width: '100%' } });
6214
6211
  };
6215
6212
 
6213
+ var parseAssetId_1 = createCommonjsModule(function (module, exports) {
6214
+ Object.defineProperty(exports, "__esModule", { value: true });
6215
+ var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
6216
+ function parseAssetId(ref) {
6217
+ var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
6218
+ if (!id || !dimensionString || !format) {
6219
+ throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
6220
+ }
6221
+ var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
6222
+ var width = +imgWidthStr;
6223
+ var height = +imgHeightStr;
6224
+ var isValidAssetId = isFinite(width) && isFinite(height);
6225
+ if (!isValidAssetId) {
6226
+ throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
6227
+ }
6228
+ return { id: id, width: width, height: height, format: format };
6229
+ }
6230
+ exports.default = parseAssetId;
6231
+
6232
+ });
6233
+
6234
+ unwrapExports(parseAssetId_1);
6235
+
6236
+ var parseSource_1 = createCommonjsModule(function (module, exports) {
6237
+ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
6238
+ __assign = Object.assign || function(t) {
6239
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6240
+ s = arguments[i];
6241
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6242
+ t[p] = s[p];
6243
+ }
6244
+ return t;
6245
+ };
6246
+ return __assign.apply(this, arguments);
6247
+ };
6248
+ Object.defineProperty(exports, "__esModule", { value: true });
6249
+ var isRef = function (src) {
6250
+ var source = src;
6251
+ return source ? typeof source._ref === 'string' : false;
6252
+ };
6253
+ var isAsset = function (src) {
6254
+ var source = src;
6255
+ return source ? typeof source._id === 'string' : false;
6256
+ };
6257
+ var isAssetStub = function (src) {
6258
+ var source = src;
6259
+ return source && source.asset ? typeof source.asset.url === 'string' : false;
6260
+ };
6261
+ // Convert an asset-id, asset or image to an image record suitable for processing
6262
+ // eslint-disable-next-line complexity
6263
+ function parseSource(source) {
6264
+ if (!source) {
6265
+ return null;
6266
+ }
6267
+ var image;
6268
+ if (typeof source === 'string' && isUrl(source)) {
6269
+ // Someone passed an existing image url?
6270
+ image = {
6271
+ asset: { _ref: urlToId(source) }
6272
+ };
6273
+ }
6274
+ else if (typeof source === 'string') {
6275
+ // Just an asset id
6276
+ image = {
6277
+ asset: { _ref: source }
6278
+ };
6279
+ }
6280
+ else if (isRef(source)) {
6281
+ // We just got passed an asset directly
6282
+ image = {
6283
+ asset: source
6284
+ };
6285
+ }
6286
+ else if (isAsset(source)) {
6287
+ // If we were passed an image asset document
6288
+ image = {
6289
+ asset: {
6290
+ _ref: source._id || ''
6291
+ }
6292
+ };
6293
+ }
6294
+ else if (isAssetStub(source)) {
6295
+ // If we were passed a partial asset (`url`, but no `_id`)
6296
+ image = {
6297
+ asset: {
6298
+ _ref: urlToId(source.asset.url)
6299
+ }
6300
+ };
6301
+ }
6302
+ else if (typeof source.asset === 'object') {
6303
+ // Probably an actual image with materialized asset
6304
+ image = source;
6305
+ }
6306
+ else {
6307
+ // We got something that does not look like an image, or it is an image
6308
+ // that currently isn't sporting an asset.
6309
+ return null;
6310
+ }
6311
+ var img = source;
6312
+ if (img.crop) {
6313
+ image.crop = img.crop;
6314
+ }
6315
+ if (img.hotspot) {
6316
+ image.hotspot = img.hotspot;
6317
+ }
6318
+ return applyDefaults(image);
6319
+ }
6320
+ exports.default = parseSource;
6321
+ function isUrl(url) {
6322
+ return /^https?:\/\//.test("" + url);
6323
+ }
6324
+ function urlToId(url) {
6325
+ var parts = url.split('/').slice(-1);
6326
+ return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
6327
+ }
6328
+ // Mock crop and hotspot if image lacks it
6329
+ function applyDefaults(image) {
6330
+ if (image.crop && image.hotspot) {
6331
+ return image;
6332
+ }
6333
+ // We need to pad in default values for crop or hotspot
6334
+ var result = __assign({}, image);
6335
+ if (!result.crop) {
6336
+ result.crop = {
6337
+ left: 0,
6338
+ top: 0,
6339
+ bottom: 0,
6340
+ right: 0
6341
+ };
6342
+ }
6343
+ if (!result.hotspot) {
6344
+ result.hotspot = {
6345
+ x: 0.5,
6346
+ y: 0.5,
6347
+ height: 1.0,
6348
+ width: 1.0
6349
+ };
6350
+ }
6351
+ return result;
6352
+ }
6353
+
6354
+ });
6355
+
6356
+ unwrapExports(parseSource_1);
6357
+
6358
+ var urlForImage_1 = createCommonjsModule(function (module, exports) {
6359
+ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
6360
+ __assign = Object.assign || function(t) {
6361
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6362
+ s = arguments[i];
6363
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6364
+ t[p] = s[p];
6365
+ }
6366
+ return t;
6367
+ };
6368
+ return __assign.apply(this, arguments);
6369
+ };
6370
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
6371
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6372
+ };
6373
+ Object.defineProperty(exports, "__esModule", { value: true });
6374
+ var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
6375
+ var parseSource_1$$1 = __importDefault(parseSource_1);
6376
+ exports.parseSource = parseSource_1$$1.default;
6377
+ exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
6378
+ ['width', 'w'],
6379
+ ['height', 'h'],
6380
+ ['format', 'fm'],
6381
+ ['download', 'dl'],
6382
+ ['blur', 'blur'],
6383
+ ['sharpen', 'sharp'],
6384
+ ['invert', 'invert'],
6385
+ ['orientation', 'or'],
6386
+ ['minHeight', 'min-h'],
6387
+ ['maxHeight', 'max-h'],
6388
+ ['minWidth', 'min-w'],
6389
+ ['maxWidth', 'max-w'],
6390
+ ['quality', 'q'],
6391
+ ['fit', 'fit'],
6392
+ ['crop', 'crop'],
6393
+ ['auto', 'auto'],
6394
+ ['dpr', 'dpr']
6395
+ ];
6396
+ function urlForImage(options) {
6397
+ var spec = __assign({}, (options || {}));
6398
+ var source = spec.source;
6399
+ delete spec.source;
6400
+ var image = parseSource_1$$1.default(source);
6401
+ if (!image) {
6402
+ return null;
6403
+ }
6404
+ var id = image.asset._ref || image.asset._id || '';
6405
+ var asset = parseAssetId_1$$1.default(id);
6406
+ // Compute crop rect in terms of pixel coordinates in the raw source image
6407
+ var cropLeft = Math.round(image.crop.left * asset.width);
6408
+ var cropTop = Math.round(image.crop.top * asset.height);
6409
+ var crop = {
6410
+ left: cropLeft,
6411
+ top: cropTop,
6412
+ width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
6413
+ height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
6414
+ };
6415
+ // Compute hot spot rect in terms of pixel coordinates
6416
+ var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
6417
+ var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
6418
+ var hotSpotCenterX = image.hotspot.x * asset.width;
6419
+ var hotSpotCenterY = image.hotspot.y * asset.height;
6420
+ var hotspot = {
6421
+ left: hotSpotCenterX - hotSpotHorizontalRadius,
6422
+ top: hotSpotCenterY - hotSpotVerticalRadius,
6423
+ right: hotSpotCenterX + hotSpotHorizontalRadius,
6424
+ bottom: hotSpotCenterY + hotSpotVerticalRadius
6425
+ };
6426
+ // If irrelevant, or if we are requested to: don't perform crop/fit based on
6427
+ // the crop/hotspot.
6428
+ if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
6429
+ spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
6430
+ }
6431
+ return specToImageUrl(__assign({}, spec, { asset: asset }));
6432
+ }
6433
+ exports.default = urlForImage;
6434
+ // eslint-disable-next-line complexity
6435
+ function specToImageUrl(spec) {
6436
+ var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
6437
+ var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
6438
+ var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
6439
+ var params = [];
6440
+ if (spec.rect) {
6441
+ // Only bother url with a crop if it actually crops anything
6442
+ var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
6443
+ var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
6444
+ if (isEffectiveCrop) {
6445
+ params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
6446
+ }
6447
+ }
6448
+ if (spec.bg) {
6449
+ params.push("bg=" + spec.bg);
6450
+ }
6451
+ if (spec.focalPoint) {
6452
+ params.push("fp-x=" + spec.focalPoint.x);
6453
+ params.push("fp-x=" + spec.focalPoint.y);
6454
+ }
6455
+ var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
6456
+ if (flip) {
6457
+ params.push("flip=" + flip);
6458
+ }
6459
+ // Map from spec name to url param name, and allow using the actual param name as an alternative
6460
+ exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
6461
+ var specName = mapping[0], param = mapping[1];
6462
+ if (typeof spec[specName] !== 'undefined') {
6463
+ params.push(param + "=" + encodeURIComponent(spec[specName]));
6464
+ }
6465
+ else if (typeof spec[param] !== 'undefined') {
6466
+ params.push(param + "=" + encodeURIComponent(spec[param]));
6467
+ }
6468
+ });
6469
+ if (params.length === 0) {
6470
+ return baseUrl;
6471
+ }
6472
+ return baseUrl + "?" + params.join('&');
6473
+ }
6474
+ function fit(source, spec) {
6475
+ var cropRect;
6476
+ var imgWidth = spec.width;
6477
+ var imgHeight = spec.height;
6478
+ // If we are not constraining the aspect ratio, we'll just use the whole crop
6479
+ if (!(imgWidth && imgHeight)) {
6480
+ return { width: imgWidth, height: imgHeight, rect: source.crop };
6481
+ }
6482
+ var crop = source.crop;
6483
+ var hotspot = source.hotspot;
6484
+ // If we are here, that means aspect ratio is locked and fitting will be a bit harder
6485
+ var desiredAspectRatio = imgWidth / imgHeight;
6486
+ var cropAspectRatio = crop.width / crop.height;
6487
+ if (cropAspectRatio > desiredAspectRatio) {
6488
+ // The crop is wider than the desired aspect ratio. That means we are cutting from the sides
6489
+ var height = crop.height;
6490
+ var width = height * desiredAspectRatio;
6491
+ var top_2 = crop.top;
6492
+ // Center output horizontally over hotspot
6493
+ var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
6494
+ var left = hotspotXCenter - width / 2;
6495
+ // Keep output within crop
6496
+ if (left < crop.left) {
6497
+ left = crop.left;
6498
+ }
6499
+ else if (left + width > crop.left + crop.width) {
6500
+ left = crop.left + crop.width - width;
6501
+ }
6502
+ cropRect = {
6503
+ left: Math.round(left),
6504
+ top: Math.round(top_2),
6505
+ width: Math.round(width),
6506
+ height: Math.round(height)
6507
+ };
6508
+ }
6509
+ else {
6510
+ // The crop is taller than the desired ratio, we are cutting from top and bottom
6511
+ var width = crop.width;
6512
+ var height = width / desiredAspectRatio;
6513
+ var left = crop.left;
6514
+ // Center output vertically over hotspot
6515
+ var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
6516
+ var top_3 = hotspotYCenter - height / 2;
6517
+ // Keep output rect within crop
6518
+ if (top_3 < crop.top) {
6519
+ top_3 = crop.top;
6520
+ }
6521
+ else if (top_3 + height > crop.top + crop.height) {
6522
+ top_3 = crop.top + crop.height - height;
6523
+ }
6524
+ cropRect = {
6525
+ left: Math.max(0, Math.floor(left)),
6526
+ top: Math.max(0, Math.floor(top_3)),
6527
+ width: Math.round(width),
6528
+ height: Math.round(height)
6529
+ };
6530
+ }
6531
+ return {
6532
+ width: imgWidth,
6533
+ height: imgHeight,
6534
+ rect: cropRect
6535
+ };
6536
+ }
6537
+
6538
+ });
6539
+
6540
+ unwrapExports(urlForImage_1);
6541
+ var urlForImage_2 = urlForImage_1.parseSource;
6542
+ var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
6543
+
6544
+ var builder = createCommonjsModule(function (module, exports) {
6545
+ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
6546
+ __assign = Object.assign || function(t) {
6547
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6548
+ s = arguments[i];
6549
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6550
+ t[p] = s[p];
6551
+ }
6552
+ return t;
6553
+ };
6554
+ return __assign.apply(this, arguments);
6555
+ };
6556
+ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
6557
+ if (mod && mod.__esModule) return mod;
6558
+ var result = {};
6559
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6560
+ result["default"] = mod;
6561
+ return result;
6562
+ };
6563
+ Object.defineProperty(exports, "__esModule", { value: true });
6564
+ var urlForImage_1$$1 = __importStar(urlForImage_1);
6565
+ var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
6566
+ var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
6567
+ var validAutoModes = ['format'];
6568
+ function isSanityClient(client) {
6569
+ return client ? typeof client.clientConfig === 'object' : false;
6570
+ }
6571
+ function rewriteSpecName(key) {
6572
+ var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
6573
+ for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
6574
+ var entry = specs_1[_i];
6575
+ var specName = entry[0], param = entry[1];
6576
+ if (key === specName || key === param) {
6577
+ return specName;
6578
+ }
6579
+ }
6580
+ return key;
6581
+ }
6582
+ function urlBuilder(options) {
6583
+ // Did we get a SanityClient?
6584
+ var client = options;
6585
+ if (isSanityClient(client)) {
6586
+ // Inherit config from client
6587
+ var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
6588
+ return new ImageUrlBuilder(null, {
6589
+ baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
6590
+ projectId: projectId,
6591
+ dataset: dataset
6592
+ });
6593
+ }
6594
+ // Or just accept the options as given
6595
+ return new ImageUrlBuilder(null, options);
6596
+ }
6597
+ exports.default = urlBuilder;
6598
+ var ImageUrlBuilder = /** @class */ (function () {
6599
+ function ImageUrlBuilder(parent, options) {
6600
+ this.options = parent
6601
+ ? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
6602
+ }
6603
+ ImageUrlBuilder.prototype.withOptions = function (options) {
6604
+ var baseUrl = options.baseUrl || '';
6605
+ var newOptions = { baseUrl: baseUrl };
6606
+ for (var key in options) {
6607
+ if (options.hasOwnProperty(key)) {
6608
+ var specKey = rewriteSpecName(key);
6609
+ newOptions[specKey] = options[key];
6610
+ }
6611
+ }
6612
+ return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
6613
+ };
6614
+ // The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
6615
+ // _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
6616
+ // studio, the 'image'-document must be provided.
6617
+ ImageUrlBuilder.prototype.image = function (source) {
6618
+ return this.withOptions({ source: source });
6619
+ };
6620
+ // Specify the dataset
6621
+ ImageUrlBuilder.prototype.dataset = function (dataset) {
6622
+ return this.withOptions({ dataset: dataset });
6623
+ };
6624
+ // Specify the projectId
6625
+ ImageUrlBuilder.prototype.projectId = function (projectId) {
6626
+ return this.withOptions({ projectId: projectId });
6627
+ };
6628
+ // Specify background color
6629
+ ImageUrlBuilder.prototype.bg = function (bg) {
6630
+ return this.withOptions({ bg: bg });
6631
+ };
6632
+ // Set DPR scaling factor
6633
+ ImageUrlBuilder.prototype.dpr = function (dpr) {
6634
+ return this.withOptions({ dpr: dpr });
6635
+ };
6636
+ // Specify the width of the image in pixels
6637
+ ImageUrlBuilder.prototype.width = function (width) {
6638
+ return this.withOptions({ width: width });
6639
+ };
6640
+ // Specify the height of the image in pixels
6641
+ ImageUrlBuilder.prototype.height = function (height) {
6642
+ return this.withOptions({ height: height });
6643
+ };
6644
+ // Specify focal point in fraction of image dimensions. Each component 0.0-1.0
6645
+ ImageUrlBuilder.prototype.focalPoint = function (x, y) {
6646
+ return this.withOptions({ focalPoint: { x: x, y: y } });
6647
+ };
6648
+ ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
6649
+ return this.withOptions({ maxWidth: maxWidth });
6650
+ };
6651
+ ImageUrlBuilder.prototype.minWidth = function (minWidth) {
6652
+ return this.withOptions({ minWidth: minWidth });
6653
+ };
6654
+ ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
6655
+ return this.withOptions({ maxHeight: maxHeight });
6656
+ };
6657
+ ImageUrlBuilder.prototype.minHeight = function (minHeight) {
6658
+ return this.withOptions({ minHeight: minHeight });
6659
+ };
6660
+ // Specify width and height in pixels
6661
+ ImageUrlBuilder.prototype.size = function (width, height) {
6662
+ return this.withOptions({ width: width, height: height });
6663
+ };
6664
+ // Specify blur between 0 and 100
6665
+ ImageUrlBuilder.prototype.blur = function (blur) {
6666
+ return this.withOptions({ blur: blur });
6667
+ };
6668
+ ImageUrlBuilder.prototype.sharpen = function (sharpen) {
6669
+ return this.withOptions({ sharpen: sharpen });
6670
+ };
6671
+ // Specify the desired rectangle of the image
6672
+ ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
6673
+ return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
6674
+ };
6675
+ // Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
6676
+ ImageUrlBuilder.prototype.format = function (format) {
6677
+ return this.withOptions({ format: format });
6678
+ };
6679
+ ImageUrlBuilder.prototype.invert = function (invert) {
6680
+ return this.withOptions({ invert: invert });
6681
+ };
6682
+ // Rotation in degrees 0, 90, 180, 270
6683
+ ImageUrlBuilder.prototype.orientation = function (orientation) {
6684
+ return this.withOptions({ orientation: orientation });
6685
+ };
6686
+ // Compression quality 0-100
6687
+ ImageUrlBuilder.prototype.quality = function (quality) {
6688
+ return this.withOptions({ quality: quality });
6689
+ };
6690
+ // Make it a download link. Parameter is default filename.
6691
+ ImageUrlBuilder.prototype.forceDownload = function (download) {
6692
+ return this.withOptions({ download: download });
6693
+ };
6694
+ // Flip image horizontally
6695
+ ImageUrlBuilder.prototype.flipHorizontal = function () {
6696
+ return this.withOptions({ flipHorizontal: true });
6697
+ };
6698
+ // Flip image verically
6699
+ ImageUrlBuilder.prototype.flipVertical = function () {
6700
+ return this.withOptions({ flipVertical: true });
6701
+ };
6702
+ // Ignore crop/hotspot from image record, even when present
6703
+ ImageUrlBuilder.prototype.ignoreImageParams = function () {
6704
+ return this.withOptions({ ignoreImageParams: true });
6705
+ };
6706
+ ImageUrlBuilder.prototype.fit = function (value) {
6707
+ if (validFits.indexOf(value) === -1) {
6708
+ throw new Error("Invalid fit mode \"" + value + "\"");
6709
+ }
6710
+ return this.withOptions({ fit: value });
6711
+ };
6712
+ ImageUrlBuilder.prototype.crop = function (value) {
6713
+ if (validCrops.indexOf(value) === -1) {
6714
+ throw new Error("Invalid crop mode \"" + value + "\"");
6715
+ }
6716
+ return this.withOptions({ crop: value });
6717
+ };
6718
+ ImageUrlBuilder.prototype.auto = function (value) {
6719
+ if (validAutoModes.indexOf(value) === -1) {
6720
+ throw new Error("Invalid auto mode \"" + value + "\"");
6721
+ }
6722
+ return this.withOptions({ auto: value });
6723
+ };
6724
+ // Gets the url based on the submitted parameters
6725
+ ImageUrlBuilder.prototype.url = function () {
6726
+ return urlForImage_1$$1.default(this.options);
6727
+ };
6728
+ // Synonym for url()
6729
+ ImageUrlBuilder.prototype.toString = function () {
6730
+ return this.url();
6731
+ };
6732
+ return ImageUrlBuilder;
6733
+ }());
6734
+
6735
+ });
6736
+
6737
+ unwrapExports(builder);
6738
+
6739
+ var node$1 = createCommonjsModule(function (module) {
6740
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
6741
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6742
+ };
6743
+ var builder_1 = __importDefault(builder);
6744
+ module.exports = builder_1.default;
6745
+
6746
+ });
6747
+
6748
+ var imageUrlBuilder = unwrapExports(node$1);
6749
+
6216
6750
  var urlFor = function urlFor(source, client) {
6217
6751
  return imageUrlBuilder(client).image(source);
6218
6752
  };