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