@mjhls/mjh-framework 1.0.20 → 1.0.21

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