@mjhls/mjh-framework 1.0.21 → 1.0.23

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