@mjhls/mjh-framework 1.0.50 → 1.0.52
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/README.md +1 -1
- package/dist/index.es.js +1008 -2082
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1007 -2081
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -17,7 +17,7 @@ import FormControl from 'react-bootstrap/FormControl';
|
|
|
17
17
|
import Button from 'react-bootstrap/Button';
|
|
18
18
|
import { withRouter } from 'next/router';
|
|
19
19
|
import PropTypes from 'prop-types';
|
|
20
|
-
import { Figure, Carousel, Card as Card$1 } from 'react-bootstrap';
|
|
20
|
+
import { Figure, Carousel, Card as Card$1, Table } from 'react-bootstrap';
|
|
21
21
|
|
|
22
22
|
/*! *****************************************************************************
|
|
23
23
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -496,1523 +496,879 @@ var getYoutubeId = createCommonjsModule(function (module, exports) {
|
|
|
496
496
|
}));
|
|
497
497
|
});
|
|
498
498
|
|
|
499
|
-
var
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
function defineProperties(target, props) {
|
|
507
|
-
for (var i = 0; i < props.length; i++) {
|
|
508
|
-
var descriptor = props[i];
|
|
509
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
510
|
-
descriptor.configurable = true;
|
|
511
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
512
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
499
|
+
var parseAssetId_1 = createCommonjsModule(function (module, exports) {
|
|
500
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
501
|
+
var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
|
|
502
|
+
function parseAssetId(ref) {
|
|
503
|
+
var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
|
|
504
|
+
if (!id || !dimensionString || !format) {
|
|
505
|
+
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
513
506
|
}
|
|
514
|
-
|
|
507
|
+
var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
|
|
508
|
+
var width = +imgWidthStr;
|
|
509
|
+
var height = +imgHeightStr;
|
|
510
|
+
var isValidAssetId = isFinite(width) && isFinite(height);
|
|
511
|
+
if (!isValidAssetId) {
|
|
512
|
+
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
513
|
+
}
|
|
514
|
+
return { id: id, width: width, height: height, format: format };
|
|
515
|
+
}
|
|
516
|
+
exports.default = parseAssetId;
|
|
515
517
|
|
|
516
|
-
|
|
517
|
-
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
518
|
-
if (staticProps) defineProperties(Constructor, staticProps);
|
|
519
|
-
return Constructor;
|
|
520
|
-
};
|
|
521
|
-
}();
|
|
518
|
+
});
|
|
522
519
|
|
|
523
|
-
|
|
524
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
525
|
-
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
526
|
-
}
|
|
520
|
+
unwrapExports(parseAssetId_1);
|
|
527
521
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
522
|
+
var parseSource_1 = createCommonjsModule(function (module, exports) {
|
|
523
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
524
|
+
__assign = Object.assign || function(t) {
|
|
525
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
526
|
+
s = arguments[i];
|
|
527
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
528
|
+
t[p] = s[p];
|
|
529
|
+
}
|
|
530
|
+
return t;
|
|
531
|
+
};
|
|
532
|
+
return __assign.apply(this, arguments);
|
|
537
533
|
};
|
|
538
|
-
|
|
539
|
-
var
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
534
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
535
|
+
var isRef = function (src) {
|
|
536
|
+
var source = src;
|
|
537
|
+
return source ? typeof source._ref === 'string' : false;
|
|
545
538
|
};
|
|
546
|
-
|
|
547
|
-
var
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
var
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
}
|
|
560
|
-
} catch (err) {
|
|
561
|
-
_d = true;
|
|
562
|
-
_e = err;
|
|
563
|
-
} finally {
|
|
564
|
-
try {
|
|
565
|
-
if (!_n && _i["return"]) _i["return"]();
|
|
566
|
-
} finally {
|
|
567
|
-
if (_d) throw _e;
|
|
568
|
-
}
|
|
539
|
+
var isAsset = function (src) {
|
|
540
|
+
var source = src;
|
|
541
|
+
return source ? typeof source._id === 'string' : false;
|
|
542
|
+
};
|
|
543
|
+
var isAssetStub = function (src) {
|
|
544
|
+
var source = src;
|
|
545
|
+
return source && source.asset ? typeof source.asset.url === 'string' : false;
|
|
546
|
+
};
|
|
547
|
+
// Convert an asset-id, asset or image to an image record suitable for processing
|
|
548
|
+
// eslint-disable-next-line complexity
|
|
549
|
+
function parseSource(source) {
|
|
550
|
+
if (!source) {
|
|
551
|
+
return null;
|
|
569
552
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
return arr;
|
|
577
|
-
} else if (Symbol.iterator in Object(arr)) {
|
|
578
|
-
return sliceIterator(arr, i);
|
|
579
|
-
} else {
|
|
580
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
553
|
+
var image;
|
|
554
|
+
if (typeof source === 'string' && isUrl(source)) {
|
|
555
|
+
// Someone passed an existing image url?
|
|
556
|
+
image = {
|
|
557
|
+
asset: { _ref: urlToId(source) }
|
|
558
|
+
};
|
|
581
559
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
588
|
-
|
|
589
|
-
return arr2;
|
|
590
|
-
} else {
|
|
591
|
-
return Array.from(arr);
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
|
|
595
|
-
var DeckContent = function (_React$Component) {
|
|
596
|
-
inherits(DeckContent, _React$Component);
|
|
597
|
-
|
|
598
|
-
function DeckContent() {
|
|
599
|
-
var _ref;
|
|
600
|
-
|
|
601
|
-
var _temp, _this, _ret;
|
|
602
|
-
|
|
603
|
-
classCallCheck(this, DeckContent);
|
|
604
|
-
|
|
605
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
606
|
-
args[_key] = arguments[_key];
|
|
560
|
+
else if (typeof source === 'string') {
|
|
561
|
+
// Just an asset id
|
|
562
|
+
image = {
|
|
563
|
+
asset: { _ref: source }
|
|
564
|
+
};
|
|
607
565
|
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
}, _this.loadMore = function () {
|
|
620
|
-
setTimeout(function () {
|
|
621
|
-
_this.setState(function (state) {
|
|
622
|
-
return {
|
|
623
|
-
page: state.page + 1,
|
|
624
|
-
from: state.from + state.per,
|
|
625
|
-
to: state.to + state.per
|
|
626
|
-
};
|
|
627
|
-
}, _this.loadData);
|
|
628
|
-
}, 10);
|
|
629
|
-
}, _this.loadData = function () {
|
|
630
|
-
var _this$state = _this.state,
|
|
631
|
-
from = _this$state.from,
|
|
632
|
-
to = _this$state.to,
|
|
633
|
-
data = _this$state.data,
|
|
634
|
-
query = _this$state.query;
|
|
635
|
-
var client = _this.props.client;
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
var params = { from: from, to: to };
|
|
639
|
-
var queryUpdated = query.replace('$from', params.from).replace('$to', params.to);
|
|
640
|
-
// const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
|
|
641
|
-
|
|
642
|
-
if (_this.pointer && _this.pointerArray) {
|
|
643
|
-
var pointer = _this.pointer;
|
|
644
|
-
client.fetch(queryUpdated).then(function (dataArr) {
|
|
645
|
-
_this.setState(function (state, props) {
|
|
646
|
-
if (dataArr[_this.pointerArray][pointer].length > 0) {
|
|
647
|
-
return {
|
|
648
|
-
data: [].concat(toConsumableArray(data), toConsumableArray(dataArr[_this.pointerArray][pointer])),
|
|
649
|
-
scrolling: true
|
|
650
|
-
};
|
|
651
|
-
} else {
|
|
652
|
-
return {
|
|
653
|
-
scrolling: false
|
|
654
|
-
};
|
|
566
|
+
else if (isRef(source)) {
|
|
567
|
+
// We just got passed an asset directly
|
|
568
|
+
image = {
|
|
569
|
+
asset: source
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
else if (isAsset(source)) {
|
|
573
|
+
// If we were passed an image asset document
|
|
574
|
+
image = {
|
|
575
|
+
asset: {
|
|
576
|
+
_ref: source._id || ''
|
|
655
577
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
|
|
664
|
-
scrolling: true
|
|
665
|
-
};
|
|
666
|
-
} else {
|
|
667
|
-
return {
|
|
668
|
-
scrolling: false
|
|
669
|
-
};
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
else if (isAssetStub(source)) {
|
|
581
|
+
// If we were passed a partial asset (`url`, but no `_id`)
|
|
582
|
+
image = {
|
|
583
|
+
asset: {
|
|
584
|
+
_ref: urlToId(source.asset.url)
|
|
670
585
|
}
|
|
671
|
-
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
}, _this.renderCardImage = function (row, page) {
|
|
675
|
-
if (row.thumbnail && row.thumbnail.asset) {
|
|
676
|
-
return row.thumbnail.asset.url;
|
|
677
|
-
/*} else if (page === 'videos' && row.youtubeURL) {
|
|
678
|
-
return `https://img.youtube.com/vi/${getYouTubeId(row.youtubeURL)}/0.jpg`*/
|
|
679
|
-
} else {
|
|
680
|
-
return _this.defaultImage;
|
|
681
|
-
}
|
|
682
|
-
}, _this.cardLoader = function (page, columns, variant) {
|
|
683
|
-
var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
|
|
684
|
-
|
|
685
|
-
var itemCounter = 0;
|
|
686
|
-
var lgVar = 12;
|
|
687
|
-
return React__default.createElement(
|
|
688
|
-
Row,
|
|
689
|
-
null,
|
|
690
|
-
_this.state.data && _this.state.data.map(function (row, index) {
|
|
691
|
-
if (columns === 'rotate' && itemCounter % 3 === 0) {
|
|
692
|
-
lgVar = 12;
|
|
693
|
-
} else if (columns && columns !== 'rotate') {
|
|
694
|
-
lgVar = Math.floor(12 / columns);
|
|
695
|
-
} else {
|
|
696
|
-
lgVar = 6;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
return React__default.createElement(
|
|
700
|
-
Col,
|
|
701
|
-
{ key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
|
|
702
|
-
React__default.createElement(
|
|
703
|
-
Card,
|
|
704
|
-
{ className: 'content-card', style: { flexDirection: mode } },
|
|
705
|
-
React__default.createElement(
|
|
706
|
-
Link,
|
|
707
|
-
{ href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
|
|
708
|
-
React__default.createElement(
|
|
709
|
-
'a',
|
|
710
|
-
null,
|
|
711
|
-
React__default.createElement(Card.Img, { variant: 'top', src: _this.renderCardImage(row, page), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
|
|
712
|
-
)
|
|
713
|
-
),
|
|
714
|
-
React__default.createElement(
|
|
715
|
-
Card.Body,
|
|
716
|
-
null,
|
|
717
|
-
React__default.createElement(
|
|
718
|
-
Link,
|
|
719
|
-
{ href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
|
|
720
|
-
React__default.createElement(
|
|
721
|
-
'a',
|
|
722
|
-
null,
|
|
723
|
-
React__default.createElement(
|
|
724
|
-
Card.Title,
|
|
725
|
-
null,
|
|
726
|
-
row.title
|
|
727
|
-
),
|
|
728
|
-
React__default.createElement(
|
|
729
|
-
Card.Text,
|
|
730
|
-
null,
|
|
731
|
-
row.summary
|
|
732
|
-
)
|
|
733
|
-
)
|
|
734
|
-
)
|
|
735
|
-
)
|
|
736
|
-
)
|
|
737
|
-
);
|
|
738
|
-
})
|
|
739
|
-
);
|
|
740
|
-
}, _temp), possibleConstructorReturn(_this, _ret);
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
createClass(DeckContent, [{
|
|
744
|
-
key: 'componentDidUpdate',
|
|
745
|
-
value: function componentDidUpdate(prevProps, prevState) {
|
|
746
|
-
if (this.state.dataKeptToCompareNewDatarecord !== this.props.dataRecord) {
|
|
747
|
-
// eslint-disable-next-line react/no-did-update-set-state
|
|
748
|
-
this.setState({
|
|
749
|
-
data: this.props.dataRecord,
|
|
750
|
-
dataKeptToCompareNewDatarecord: this.props.dataRecord,
|
|
751
|
-
per: this.props.params ? this.props.params.to : 2,
|
|
752
|
-
page: 1,
|
|
753
|
-
from: this.props.params ? this.props.params.from : 0,
|
|
754
|
-
to: this.props.params ? this.props.params.to : 2,
|
|
755
|
-
total_pages: null,
|
|
756
|
-
scrolling: true,
|
|
757
|
-
query: this.props.query
|
|
758
|
-
});
|
|
759
|
-
}
|
|
586
|
+
};
|
|
760
587
|
}
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
// this.loadData();
|
|
588
|
+
else if (typeof source.asset === 'object') {
|
|
589
|
+
// Probably an actual image with materialized asset
|
|
590
|
+
image = source;
|
|
765
591
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
var _props = this.props,
|
|
772
|
-
columns = _props.columns,
|
|
773
|
-
variant = _props.variant,
|
|
774
|
-
autoScroll = _props.autoScroll,
|
|
775
|
-
page = _props.page;
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
return React__default.createElement(
|
|
779
|
-
'div',
|
|
780
|
-
{ className: 'contentDeck' },
|
|
781
|
-
autoScroll ? React__default.createElement(
|
|
782
|
-
React__default.Fragment,
|
|
783
|
-
null,
|
|
784
|
-
React__default.createElement(
|
|
785
|
-
InfiniteScroll,
|
|
786
|
-
{ dataLength: this.state.data.length, next: this.loadMore, hasMore: this.state.scrolling },
|
|
787
|
-
this.cardLoader(page, columns, variant)
|
|
788
|
-
),
|
|
789
|
-
React__default.createElement(
|
|
790
|
-
'noscript',
|
|
791
|
-
null,
|
|
792
|
-
'Manual Pagination Here'
|
|
793
|
-
)
|
|
794
|
-
) : React__default.createElement(
|
|
795
|
-
React__default.Fragment,
|
|
796
|
-
null,
|
|
797
|
-
this.cardLoader(page, columns, variant),
|
|
798
|
-
React__default.createElement(
|
|
799
|
-
'div',
|
|
800
|
-
{ style: { padding: '0px 10px' } },
|
|
801
|
-
this.state.scrolling ? React__default.createElement(
|
|
802
|
-
'button',
|
|
803
|
-
{
|
|
804
|
-
style: { margin: 'auto', width: '100%' },
|
|
805
|
-
onClick: function onClick(e) {
|
|
806
|
-
_this2.loadMore();
|
|
807
|
-
} },
|
|
808
|
-
'Load More'
|
|
809
|
-
) : React__default.createElement(
|
|
810
|
-
'p',
|
|
811
|
-
{ style: { textAlign: 'center' } },
|
|
812
|
-
React__default.createElement(
|
|
813
|
-
'b',
|
|
814
|
-
null,
|
|
815
|
-
'End of data'
|
|
816
|
-
)
|
|
817
|
-
)
|
|
818
|
-
),
|
|
819
|
-
React__default.createElement(
|
|
820
|
-
'noscript',
|
|
821
|
-
null,
|
|
822
|
-
'Manual Pagination Here'
|
|
823
|
-
)
|
|
824
|
-
)
|
|
825
|
-
);
|
|
592
|
+
else {
|
|
593
|
+
// We got something that does not look like an image, or it is an image
|
|
594
|
+
// that currently isn't sporting an asset.
|
|
595
|
+
return null;
|
|
826
596
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
/**
|
|
832
|
-
* Checks if `value` is classified as an `Array` object.
|
|
833
|
-
*
|
|
834
|
-
* @static
|
|
835
|
-
* @memberOf _
|
|
836
|
-
* @since 0.1.0
|
|
837
|
-
* @category Lang
|
|
838
|
-
* @param {*} value The value to check.
|
|
839
|
-
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
840
|
-
* @example
|
|
841
|
-
*
|
|
842
|
-
* _.isArray([1, 2, 3]);
|
|
843
|
-
* // => true
|
|
844
|
-
*
|
|
845
|
-
* _.isArray(document.body.children);
|
|
846
|
-
* // => false
|
|
847
|
-
*
|
|
848
|
-
* _.isArray('abc');
|
|
849
|
-
* // => false
|
|
850
|
-
*
|
|
851
|
-
* _.isArray(_.noop);
|
|
852
|
-
* // => false
|
|
853
|
-
*/
|
|
854
|
-
var isArray = Array.isArray;
|
|
855
|
-
|
|
856
|
-
var isArray_1 = isArray;
|
|
857
|
-
|
|
858
|
-
/** Detect free variable `global` from Node.js. */
|
|
859
|
-
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
860
|
-
|
|
861
|
-
var _freeGlobal = freeGlobal;
|
|
862
|
-
|
|
863
|
-
/** Detect free variable `self`. */
|
|
864
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
865
|
-
|
|
866
|
-
/** Used as a reference to the global object. */
|
|
867
|
-
var root = _freeGlobal || freeSelf || Function('return this')();
|
|
868
|
-
|
|
869
|
-
var _root = root;
|
|
870
|
-
|
|
871
|
-
/** Built-in value references. */
|
|
872
|
-
var Symbol$1 = _root.Symbol;
|
|
873
|
-
|
|
874
|
-
var _Symbol = Symbol$1;
|
|
875
|
-
|
|
876
|
-
/** Used for built-in method references. */
|
|
877
|
-
var objectProto = Object.prototype;
|
|
878
|
-
|
|
879
|
-
/** Used to check objects for own properties. */
|
|
880
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
881
|
-
|
|
882
|
-
/**
|
|
883
|
-
* Used to resolve the
|
|
884
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
885
|
-
* of values.
|
|
886
|
-
*/
|
|
887
|
-
var nativeObjectToString = objectProto.toString;
|
|
888
|
-
|
|
889
|
-
/** Built-in value references. */
|
|
890
|
-
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
894
|
-
*
|
|
895
|
-
* @private
|
|
896
|
-
* @param {*} value The value to query.
|
|
897
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
898
|
-
*/
|
|
899
|
-
function getRawTag(value) {
|
|
900
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
|
901
|
-
tag = value[symToStringTag];
|
|
902
|
-
|
|
903
|
-
try {
|
|
904
|
-
value[symToStringTag] = undefined;
|
|
905
|
-
} catch (e) {}
|
|
906
|
-
|
|
907
|
-
var result = nativeObjectToString.call(value);
|
|
908
|
-
{
|
|
909
|
-
if (isOwn) {
|
|
910
|
-
value[symToStringTag] = tag;
|
|
911
|
-
} else {
|
|
912
|
-
delete value[symToStringTag];
|
|
597
|
+
var img = source;
|
|
598
|
+
if (img.crop) {
|
|
599
|
+
image.crop = img.crop;
|
|
913
600
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
var _getRawTag = getRawTag;
|
|
919
|
-
|
|
920
|
-
/** Used for built-in method references. */
|
|
921
|
-
var objectProto$1 = Object.prototype;
|
|
922
|
-
|
|
923
|
-
/**
|
|
924
|
-
* Used to resolve the
|
|
925
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
926
|
-
* of values.
|
|
927
|
-
*/
|
|
928
|
-
var nativeObjectToString$1 = objectProto$1.toString;
|
|
929
|
-
|
|
930
|
-
/**
|
|
931
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
932
|
-
*
|
|
933
|
-
* @private
|
|
934
|
-
* @param {*} value The value to convert.
|
|
935
|
-
* @returns {string} Returns the converted string.
|
|
936
|
-
*/
|
|
937
|
-
function objectToString(value) {
|
|
938
|
-
return nativeObjectToString$1.call(value);
|
|
601
|
+
if (img.hotspot) {
|
|
602
|
+
image.hotspot = img.hotspot;
|
|
603
|
+
}
|
|
604
|
+
return applyDefaults(image);
|
|
939
605
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
/** `Object#toString` result references. */
|
|
944
|
-
var nullTag = '[object Null]',
|
|
945
|
-
undefinedTag = '[object Undefined]';
|
|
946
|
-
|
|
947
|
-
/** Built-in value references. */
|
|
948
|
-
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
|
949
|
-
|
|
950
|
-
/**
|
|
951
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
952
|
-
*
|
|
953
|
-
* @private
|
|
954
|
-
* @param {*} value The value to query.
|
|
955
|
-
* @returns {string} Returns the `toStringTag`.
|
|
956
|
-
*/
|
|
957
|
-
function baseGetTag(value) {
|
|
958
|
-
if (value == null) {
|
|
959
|
-
return value === undefined ? undefinedTag : nullTag;
|
|
960
|
-
}
|
|
961
|
-
return (symToStringTag$1 && symToStringTag$1 in Object(value))
|
|
962
|
-
? _getRawTag(value)
|
|
963
|
-
: _objectToString(value);
|
|
606
|
+
exports.default = parseSource;
|
|
607
|
+
function isUrl(url) {
|
|
608
|
+
return /^https?:\/\//.test("" + url);
|
|
964
609
|
}
|
|
965
|
-
|
|
966
|
-
var
|
|
967
|
-
|
|
968
|
-
/**
|
|
969
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
970
|
-
* and has a `typeof` result of "object".
|
|
971
|
-
*
|
|
972
|
-
* @static
|
|
973
|
-
* @memberOf _
|
|
974
|
-
* @since 4.0.0
|
|
975
|
-
* @category Lang
|
|
976
|
-
* @param {*} value The value to check.
|
|
977
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
978
|
-
* @example
|
|
979
|
-
*
|
|
980
|
-
* _.isObjectLike({});
|
|
981
|
-
* // => true
|
|
982
|
-
*
|
|
983
|
-
* _.isObjectLike([1, 2, 3]);
|
|
984
|
-
* // => true
|
|
985
|
-
*
|
|
986
|
-
* _.isObjectLike(_.noop);
|
|
987
|
-
* // => false
|
|
988
|
-
*
|
|
989
|
-
* _.isObjectLike(null);
|
|
990
|
-
* // => false
|
|
991
|
-
*/
|
|
992
|
-
function isObjectLike(value) {
|
|
993
|
-
return value != null && typeof value == 'object';
|
|
610
|
+
function urlToId(url) {
|
|
611
|
+
var parts = url.split('/').slice(-1);
|
|
612
|
+
return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
|
|
994
613
|
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
return typeof value == 'symbol' ||
|
|
1020
|
-
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
614
|
+
// Mock crop and hotspot if image lacks it
|
|
615
|
+
function applyDefaults(image) {
|
|
616
|
+
if (image.crop && image.hotspot) {
|
|
617
|
+
return image;
|
|
618
|
+
}
|
|
619
|
+
// We need to pad in default values for crop or hotspot
|
|
620
|
+
var result = __assign({}, image);
|
|
621
|
+
if (!result.crop) {
|
|
622
|
+
result.crop = {
|
|
623
|
+
left: 0,
|
|
624
|
+
top: 0,
|
|
625
|
+
bottom: 0,
|
|
626
|
+
right: 0
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
if (!result.hotspot) {
|
|
630
|
+
result.hotspot = {
|
|
631
|
+
x: 0.5,
|
|
632
|
+
y: 0.5,
|
|
633
|
+
height: 1.0,
|
|
634
|
+
width: 1.0
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
return result;
|
|
1021
638
|
}
|
|
1022
639
|
|
|
1023
|
-
|
|
640
|
+
});
|
|
1024
641
|
|
|
1025
|
-
|
|
1026
|
-
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
1027
|
-
reIsPlainProp = /^\w*$/;
|
|
642
|
+
unwrapExports(parseSource_1);
|
|
1028
643
|
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
return
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
644
|
+
var urlForImage_1 = createCommonjsModule(function (module, exports) {
|
|
645
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
646
|
+
__assign = Object.assign || function(t) {
|
|
647
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
648
|
+
s = arguments[i];
|
|
649
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
650
|
+
t[p] = s[p];
|
|
651
|
+
}
|
|
652
|
+
return t;
|
|
653
|
+
};
|
|
654
|
+
return __assign.apply(this, arguments);
|
|
655
|
+
};
|
|
656
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
657
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
658
|
+
};
|
|
659
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
660
|
+
var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
|
|
661
|
+
var parseSource_1$$1 = __importDefault(parseSource_1);
|
|
662
|
+
exports.parseSource = parseSource_1$$1.default;
|
|
663
|
+
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
|
|
664
|
+
['width', 'w'],
|
|
665
|
+
['height', 'h'],
|
|
666
|
+
['format', 'fm'],
|
|
667
|
+
['download', 'dl'],
|
|
668
|
+
['blur', 'blur'],
|
|
669
|
+
['sharpen', 'sharp'],
|
|
670
|
+
['invert', 'invert'],
|
|
671
|
+
['orientation', 'or'],
|
|
672
|
+
['minHeight', 'min-h'],
|
|
673
|
+
['maxHeight', 'max-h'],
|
|
674
|
+
['minWidth', 'min-w'],
|
|
675
|
+
['maxWidth', 'max-w'],
|
|
676
|
+
['quality', 'q'],
|
|
677
|
+
['fit', 'fit'],
|
|
678
|
+
['crop', 'crop'],
|
|
679
|
+
['auto', 'auto'],
|
|
680
|
+
['dpr', 'dpr']
|
|
681
|
+
];
|
|
682
|
+
function urlForImage(options) {
|
|
683
|
+
var spec = __assign({}, (options || {}));
|
|
684
|
+
var source = spec.source;
|
|
685
|
+
delete spec.source;
|
|
686
|
+
var image = parseSource_1$$1.default(source);
|
|
687
|
+
if (!image) {
|
|
688
|
+
return null;
|
|
689
|
+
}
|
|
690
|
+
var id = image.asset._ref || image.asset._id || '';
|
|
691
|
+
var asset = parseAssetId_1$$1.default(id);
|
|
692
|
+
// Compute crop rect in terms of pixel coordinates in the raw source image
|
|
693
|
+
var cropLeft = Math.round(image.crop.left * asset.width);
|
|
694
|
+
var cropTop = Math.round(image.crop.top * asset.height);
|
|
695
|
+
var crop = {
|
|
696
|
+
left: cropLeft,
|
|
697
|
+
top: cropTop,
|
|
698
|
+
width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
|
|
699
|
+
height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
|
|
700
|
+
};
|
|
701
|
+
// Compute hot spot rect in terms of pixel coordinates
|
|
702
|
+
var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
|
|
703
|
+
var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
|
|
704
|
+
var hotSpotCenterX = image.hotspot.x * asset.width;
|
|
705
|
+
var hotSpotCenterY = image.hotspot.y * asset.height;
|
|
706
|
+
var hotspot = {
|
|
707
|
+
left: hotSpotCenterX - hotSpotHorizontalRadius,
|
|
708
|
+
top: hotSpotCenterY - hotSpotVerticalRadius,
|
|
709
|
+
right: hotSpotCenterX + hotSpotHorizontalRadius,
|
|
710
|
+
bottom: hotSpotCenterY + hotSpotVerticalRadius
|
|
711
|
+
};
|
|
712
|
+
// If irrelevant, or if we are requested to: don't perform crop/fit based on
|
|
713
|
+
// the crop/hotspot.
|
|
714
|
+
if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
|
|
715
|
+
spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
|
|
716
|
+
}
|
|
717
|
+
return specToImageUrl(__assign({}, spec, { asset: asset }));
|
|
1048
718
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
719
|
+
exports.default = urlForImage;
|
|
720
|
+
// eslint-disable-next-line complexity
|
|
721
|
+
function specToImageUrl(spec) {
|
|
722
|
+
var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
|
|
723
|
+
var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
|
|
724
|
+
var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
|
|
725
|
+
var params = [];
|
|
726
|
+
if (spec.rect) {
|
|
727
|
+
// Only bother url with a crop if it actually crops anything
|
|
728
|
+
var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
|
|
729
|
+
var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
|
|
730
|
+
if (isEffectiveCrop) {
|
|
731
|
+
params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
if (spec.bg) {
|
|
735
|
+
params.push("bg=" + spec.bg);
|
|
736
|
+
}
|
|
737
|
+
if (spec.focalPoint) {
|
|
738
|
+
params.push("fp-x=" + spec.focalPoint.x);
|
|
739
|
+
params.push("fp-x=" + spec.focalPoint.y);
|
|
740
|
+
}
|
|
741
|
+
var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
|
|
742
|
+
if (flip) {
|
|
743
|
+
params.push("flip=" + flip);
|
|
744
|
+
}
|
|
745
|
+
// Map from spec name to url param name, and allow using the actual param name as an alternative
|
|
746
|
+
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
|
|
747
|
+
var specName = mapping[0], param = mapping[1];
|
|
748
|
+
if (typeof spec[specName] !== 'undefined') {
|
|
749
|
+
params.push(param + "=" + encodeURIComponent(spec[specName]));
|
|
750
|
+
}
|
|
751
|
+
else if (typeof spec[param] !== 'undefined') {
|
|
752
|
+
params.push(param + "=" + encodeURIComponent(spec[param]));
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
if (params.length === 0) {
|
|
756
|
+
return baseUrl;
|
|
757
|
+
}
|
|
758
|
+
return baseUrl + "?" + params.join('&');
|
|
1080
759
|
}
|
|
1081
|
-
|
|
1082
|
-
var
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
760
|
+
function fit(source, spec) {
|
|
761
|
+
var cropRect;
|
|
762
|
+
var imgWidth = spec.width;
|
|
763
|
+
var imgHeight = spec.height;
|
|
764
|
+
// If we are not constraining the aspect ratio, we'll just use the whole crop
|
|
765
|
+
if (!(imgWidth && imgHeight)) {
|
|
766
|
+
return { width: imgWidth, height: imgHeight, rect: source.crop };
|
|
767
|
+
}
|
|
768
|
+
var crop = source.crop;
|
|
769
|
+
var hotspot = source.hotspot;
|
|
770
|
+
// If we are here, that means aspect ratio is locked and fitting will be a bit harder
|
|
771
|
+
var desiredAspectRatio = imgWidth / imgHeight;
|
|
772
|
+
var cropAspectRatio = crop.width / crop.height;
|
|
773
|
+
if (cropAspectRatio > desiredAspectRatio) {
|
|
774
|
+
// The crop is wider than the desired aspect ratio. That means we are cutting from the sides
|
|
775
|
+
var height = crop.height;
|
|
776
|
+
var width = height * desiredAspectRatio;
|
|
777
|
+
var top_2 = crop.top;
|
|
778
|
+
// Center output horizontally over hotspot
|
|
779
|
+
var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
|
|
780
|
+
var left = hotspotXCenter - width / 2;
|
|
781
|
+
// Keep output within crop
|
|
782
|
+
if (left < crop.left) {
|
|
783
|
+
left = crop.left;
|
|
784
|
+
}
|
|
785
|
+
else if (left + width > crop.left + crop.width) {
|
|
786
|
+
left = crop.left + crop.width - width;
|
|
787
|
+
}
|
|
788
|
+
cropRect = {
|
|
789
|
+
left: Math.round(left),
|
|
790
|
+
top: Math.round(top_2),
|
|
791
|
+
width: Math.round(width),
|
|
792
|
+
height: Math.round(height)
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
// The crop is taller than the desired ratio, we are cutting from top and bottom
|
|
797
|
+
var width = crop.width;
|
|
798
|
+
var height = width / desiredAspectRatio;
|
|
799
|
+
var left = crop.left;
|
|
800
|
+
// Center output vertically over hotspot
|
|
801
|
+
var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
|
|
802
|
+
var top_3 = hotspotYCenter - height / 2;
|
|
803
|
+
// Keep output rect within crop
|
|
804
|
+
if (top_3 < crop.top) {
|
|
805
|
+
top_3 = crop.top;
|
|
806
|
+
}
|
|
807
|
+
else if (top_3 + height > crop.top + crop.height) {
|
|
808
|
+
top_3 = crop.top + crop.height - height;
|
|
809
|
+
}
|
|
810
|
+
cropRect = {
|
|
811
|
+
left: Math.max(0, Math.floor(left)),
|
|
812
|
+
top: Math.max(0, Math.floor(top_3)),
|
|
813
|
+
width: Math.round(width),
|
|
814
|
+
height: Math.round(height)
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
return {
|
|
818
|
+
width: imgWidth,
|
|
819
|
+
height: imgHeight,
|
|
820
|
+
rect: cropRect
|
|
821
|
+
};
|
|
1115
822
|
}
|
|
1116
823
|
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
/** Used to detect overreaching core-js shims. */
|
|
1120
|
-
var coreJsData = _root['__core-js_shared__'];
|
|
1121
|
-
|
|
1122
|
-
var _coreJsData = coreJsData;
|
|
824
|
+
});
|
|
1123
825
|
|
|
1124
|
-
|
|
1125
|
-
var
|
|
1126
|
-
|
|
1127
|
-
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
1128
|
-
}());
|
|
826
|
+
unwrapExports(urlForImage_1);
|
|
827
|
+
var urlForImage_2 = urlForImage_1.parseSource;
|
|
828
|
+
var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
1129
829
|
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
830
|
+
var builder = createCommonjsModule(function (module, exports) {
|
|
831
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
832
|
+
__assign = Object.assign || function(t) {
|
|
833
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
834
|
+
s = arguments[i];
|
|
835
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
836
|
+
t[p] = s[p];
|
|
837
|
+
}
|
|
838
|
+
return t;
|
|
839
|
+
};
|
|
840
|
+
return __assign.apply(this, arguments);
|
|
841
|
+
};
|
|
842
|
+
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
843
|
+
if (mod && mod.__esModule) return mod;
|
|
844
|
+
var result = {};
|
|
845
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
846
|
+
result["default"] = mod;
|
|
847
|
+
return result;
|
|
848
|
+
};
|
|
849
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
850
|
+
var urlForImage_1$$1 = __importStar(urlForImage_1);
|
|
851
|
+
var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
|
|
852
|
+
var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
|
|
853
|
+
var validAutoModes = ['format'];
|
|
854
|
+
function isSanityClient(client) {
|
|
855
|
+
return client ? typeof client.clientConfig === 'object' : false;
|
|
1139
856
|
}
|
|
1140
|
-
|
|
1141
|
-
var
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
var
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
* Converts `func` to its source code.
|
|
1151
|
-
*
|
|
1152
|
-
* @private
|
|
1153
|
-
* @param {Function} func The function to convert.
|
|
1154
|
-
* @returns {string} Returns the source code.
|
|
1155
|
-
*/
|
|
1156
|
-
function toSource(func) {
|
|
1157
|
-
if (func != null) {
|
|
1158
|
-
try {
|
|
1159
|
-
return funcToString.call(func);
|
|
1160
|
-
} catch (e) {}
|
|
1161
|
-
try {
|
|
1162
|
-
return (func + '');
|
|
1163
|
-
} catch (e) {}
|
|
1164
|
-
}
|
|
1165
|
-
return '';
|
|
857
|
+
function rewriteSpecName(key) {
|
|
858
|
+
var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
859
|
+
for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
|
|
860
|
+
var entry = specs_1[_i];
|
|
861
|
+
var specName = entry[0], param = entry[1];
|
|
862
|
+
if (key === specName || key === param) {
|
|
863
|
+
return specName;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return key;
|
|
1166
867
|
}
|
|
868
|
+
function urlBuilder(options) {
|
|
869
|
+
// Did we get a SanityClient?
|
|
870
|
+
var client = options;
|
|
871
|
+
if (isSanityClient(client)) {
|
|
872
|
+
// Inherit config from client
|
|
873
|
+
var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
|
|
874
|
+
return new ImageUrlBuilder(null, {
|
|
875
|
+
baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
|
|
876
|
+
projectId: projectId,
|
|
877
|
+
dataset: dataset
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
// Or just accept the options as given
|
|
881
|
+
return new ImageUrlBuilder(null, options);
|
|
882
|
+
}
|
|
883
|
+
exports.default = urlBuilder;
|
|
884
|
+
var ImageUrlBuilder = /** @class */ (function () {
|
|
885
|
+
function ImageUrlBuilder(parent, options) {
|
|
886
|
+
this.options = parent
|
|
887
|
+
? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
|
|
888
|
+
}
|
|
889
|
+
ImageUrlBuilder.prototype.withOptions = function (options) {
|
|
890
|
+
var baseUrl = options.baseUrl || '';
|
|
891
|
+
var newOptions = { baseUrl: baseUrl };
|
|
892
|
+
for (var key in options) {
|
|
893
|
+
if (options.hasOwnProperty(key)) {
|
|
894
|
+
var specKey = rewriteSpecName(key);
|
|
895
|
+
newOptions[specKey] = options[key];
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
|
|
899
|
+
};
|
|
900
|
+
// The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
|
|
901
|
+
// _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
|
|
902
|
+
// studio, the 'image'-document must be provided.
|
|
903
|
+
ImageUrlBuilder.prototype.image = function (source) {
|
|
904
|
+
return this.withOptions({ source: source });
|
|
905
|
+
};
|
|
906
|
+
// Specify the dataset
|
|
907
|
+
ImageUrlBuilder.prototype.dataset = function (dataset) {
|
|
908
|
+
return this.withOptions({ dataset: dataset });
|
|
909
|
+
};
|
|
910
|
+
// Specify the projectId
|
|
911
|
+
ImageUrlBuilder.prototype.projectId = function (projectId) {
|
|
912
|
+
return this.withOptions({ projectId: projectId });
|
|
913
|
+
};
|
|
914
|
+
// Specify background color
|
|
915
|
+
ImageUrlBuilder.prototype.bg = function (bg) {
|
|
916
|
+
return this.withOptions({ bg: bg });
|
|
917
|
+
};
|
|
918
|
+
// Set DPR scaling factor
|
|
919
|
+
ImageUrlBuilder.prototype.dpr = function (dpr) {
|
|
920
|
+
return this.withOptions({ dpr: dpr });
|
|
921
|
+
};
|
|
922
|
+
// Specify the width of the image in pixels
|
|
923
|
+
ImageUrlBuilder.prototype.width = function (width) {
|
|
924
|
+
return this.withOptions({ width: width });
|
|
925
|
+
};
|
|
926
|
+
// Specify the height of the image in pixels
|
|
927
|
+
ImageUrlBuilder.prototype.height = function (height) {
|
|
928
|
+
return this.withOptions({ height: height });
|
|
929
|
+
};
|
|
930
|
+
// Specify focal point in fraction of image dimensions. Each component 0.0-1.0
|
|
931
|
+
ImageUrlBuilder.prototype.focalPoint = function (x, y) {
|
|
932
|
+
return this.withOptions({ focalPoint: { x: x, y: y } });
|
|
933
|
+
};
|
|
934
|
+
ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
|
|
935
|
+
return this.withOptions({ maxWidth: maxWidth });
|
|
936
|
+
};
|
|
937
|
+
ImageUrlBuilder.prototype.minWidth = function (minWidth) {
|
|
938
|
+
return this.withOptions({ minWidth: minWidth });
|
|
939
|
+
};
|
|
940
|
+
ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
|
|
941
|
+
return this.withOptions({ maxHeight: maxHeight });
|
|
942
|
+
};
|
|
943
|
+
ImageUrlBuilder.prototype.minHeight = function (minHeight) {
|
|
944
|
+
return this.withOptions({ minHeight: minHeight });
|
|
945
|
+
};
|
|
946
|
+
// Specify width and height in pixels
|
|
947
|
+
ImageUrlBuilder.prototype.size = function (width, height) {
|
|
948
|
+
return this.withOptions({ width: width, height: height });
|
|
949
|
+
};
|
|
950
|
+
// Specify blur between 0 and 100
|
|
951
|
+
ImageUrlBuilder.prototype.blur = function (blur) {
|
|
952
|
+
return this.withOptions({ blur: blur });
|
|
953
|
+
};
|
|
954
|
+
ImageUrlBuilder.prototype.sharpen = function (sharpen) {
|
|
955
|
+
return this.withOptions({ sharpen: sharpen });
|
|
956
|
+
};
|
|
957
|
+
// Specify the desired rectangle of the image
|
|
958
|
+
ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
|
|
959
|
+
return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
|
|
960
|
+
};
|
|
961
|
+
// Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
|
|
962
|
+
ImageUrlBuilder.prototype.format = function (format) {
|
|
963
|
+
return this.withOptions({ format: format });
|
|
964
|
+
};
|
|
965
|
+
ImageUrlBuilder.prototype.invert = function (invert) {
|
|
966
|
+
return this.withOptions({ invert: invert });
|
|
967
|
+
};
|
|
968
|
+
// Rotation in degrees 0, 90, 180, 270
|
|
969
|
+
ImageUrlBuilder.prototype.orientation = function (orientation) {
|
|
970
|
+
return this.withOptions({ orientation: orientation });
|
|
971
|
+
};
|
|
972
|
+
// Compression quality 0-100
|
|
973
|
+
ImageUrlBuilder.prototype.quality = function (quality) {
|
|
974
|
+
return this.withOptions({ quality: quality });
|
|
975
|
+
};
|
|
976
|
+
// Make it a download link. Parameter is default filename.
|
|
977
|
+
ImageUrlBuilder.prototype.forceDownload = function (download) {
|
|
978
|
+
return this.withOptions({ download: download });
|
|
979
|
+
};
|
|
980
|
+
// Flip image horizontally
|
|
981
|
+
ImageUrlBuilder.prototype.flipHorizontal = function () {
|
|
982
|
+
return this.withOptions({ flipHorizontal: true });
|
|
983
|
+
};
|
|
984
|
+
// Flip image verically
|
|
985
|
+
ImageUrlBuilder.prototype.flipVertical = function () {
|
|
986
|
+
return this.withOptions({ flipVertical: true });
|
|
987
|
+
};
|
|
988
|
+
// Ignore crop/hotspot from image record, even when present
|
|
989
|
+
ImageUrlBuilder.prototype.ignoreImageParams = function () {
|
|
990
|
+
return this.withOptions({ ignoreImageParams: true });
|
|
991
|
+
};
|
|
992
|
+
ImageUrlBuilder.prototype.fit = function (value) {
|
|
993
|
+
if (validFits.indexOf(value) === -1) {
|
|
994
|
+
throw new Error("Invalid fit mode \"" + value + "\"");
|
|
995
|
+
}
|
|
996
|
+
return this.withOptions({ fit: value });
|
|
997
|
+
};
|
|
998
|
+
ImageUrlBuilder.prototype.crop = function (value) {
|
|
999
|
+
if (validCrops.indexOf(value) === -1) {
|
|
1000
|
+
throw new Error("Invalid crop mode \"" + value + "\"");
|
|
1001
|
+
}
|
|
1002
|
+
return this.withOptions({ crop: value });
|
|
1003
|
+
};
|
|
1004
|
+
ImageUrlBuilder.prototype.auto = function (value) {
|
|
1005
|
+
if (validAutoModes.indexOf(value) === -1) {
|
|
1006
|
+
throw new Error("Invalid auto mode \"" + value + "\"");
|
|
1007
|
+
}
|
|
1008
|
+
return this.withOptions({ auto: value });
|
|
1009
|
+
};
|
|
1010
|
+
// Gets the url based on the submitted parameters
|
|
1011
|
+
ImageUrlBuilder.prototype.url = function () {
|
|
1012
|
+
return urlForImage_1$$1.default(this.options);
|
|
1013
|
+
};
|
|
1014
|
+
// Synonym for url()
|
|
1015
|
+
ImageUrlBuilder.prototype.toString = function () {
|
|
1016
|
+
return this.url();
|
|
1017
|
+
};
|
|
1018
|
+
return ImageUrlBuilder;
|
|
1019
|
+
}());
|
|
1167
1020
|
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
/**
|
|
1171
|
-
* Used to match `RegExp`
|
|
1172
|
-
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
1173
|
-
*/
|
|
1174
|
-
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
1175
|
-
|
|
1176
|
-
/** Used to detect host constructors (Safari). */
|
|
1177
|
-
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
1021
|
+
});
|
|
1178
1022
|
|
|
1179
|
-
|
|
1180
|
-
var funcProto$1 = Function.prototype,
|
|
1181
|
-
objectProto$2 = Object.prototype;
|
|
1023
|
+
unwrapExports(builder);
|
|
1182
1024
|
|
|
1183
|
-
|
|
1184
|
-
var
|
|
1025
|
+
var node = createCommonjsModule(function (module) {
|
|
1026
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
1027
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1028
|
+
};
|
|
1029
|
+
var builder_1 = __importDefault(builder);
|
|
1030
|
+
module.exports = builder_1.default;
|
|
1185
1031
|
|
|
1186
|
-
|
|
1187
|
-
var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
|
|
1032
|
+
});
|
|
1188
1033
|
|
|
1189
|
-
|
|
1190
|
-
var reIsNative = RegExp('^' +
|
|
1191
|
-
funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
|
|
1192
|
-
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
1193
|
-
);
|
|
1034
|
+
var imageUrlBuilder = unwrapExports(node);
|
|
1194
1035
|
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
* @private
|
|
1199
|
-
* @param {*} value The value to check.
|
|
1200
|
-
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
1201
|
-
* else `false`.
|
|
1202
|
-
*/
|
|
1203
|
-
function baseIsNative(value) {
|
|
1204
|
-
if (!isObject_1(value) || _isMasked(value)) {
|
|
1205
|
-
return false;
|
|
1036
|
+
var classCallCheck = function (instance, Constructor) {
|
|
1037
|
+
if (!(instance instanceof Constructor)) {
|
|
1038
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1206
1039
|
}
|
|
1207
|
-
|
|
1208
|
-
return pattern.test(_toSource(value));
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
var _baseIsNative = baseIsNative;
|
|
1212
|
-
|
|
1213
|
-
/**
|
|
1214
|
-
* Gets the value at `key` of `object`.
|
|
1215
|
-
*
|
|
1216
|
-
* @private
|
|
1217
|
-
* @param {Object} [object] The object to query.
|
|
1218
|
-
* @param {string} key The key of the property to get.
|
|
1219
|
-
* @returns {*} Returns the property value.
|
|
1220
|
-
*/
|
|
1221
|
-
function getValue(object, key) {
|
|
1222
|
-
return object == null ? undefined : object[key];
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
var _getValue = getValue;
|
|
1226
|
-
|
|
1227
|
-
/**
|
|
1228
|
-
* Gets the native function at `key` of `object`.
|
|
1229
|
-
*
|
|
1230
|
-
* @private
|
|
1231
|
-
* @param {Object} object The object to query.
|
|
1232
|
-
* @param {string} key The key of the method to get.
|
|
1233
|
-
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
1234
|
-
*/
|
|
1235
|
-
function getNative(object, key) {
|
|
1236
|
-
var value = _getValue(object, key);
|
|
1237
|
-
return _baseIsNative(value) ? value : undefined;
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
var _getNative = getNative;
|
|
1040
|
+
};
|
|
1241
1041
|
|
|
1242
|
-
|
|
1243
|
-
|
|
1042
|
+
var createClass = function () {
|
|
1043
|
+
function defineProperties(target, props) {
|
|
1044
|
+
for (var i = 0; i < props.length; i++) {
|
|
1045
|
+
var descriptor = props[i];
|
|
1046
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1047
|
+
descriptor.configurable = true;
|
|
1048
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1049
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1244
1052
|
|
|
1245
|
-
|
|
1053
|
+
return function (Constructor, protoProps, staticProps) {
|
|
1054
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
1055
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
1056
|
+
return Constructor;
|
|
1057
|
+
};
|
|
1058
|
+
}();
|
|
1246
1059
|
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
* @name clear
|
|
1252
|
-
* @memberOf Hash
|
|
1253
|
-
*/
|
|
1254
|
-
function hashClear() {
|
|
1255
|
-
this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
|
|
1256
|
-
this.size = 0;
|
|
1257
|
-
}
|
|
1060
|
+
var inherits = function (subClass, superClass) {
|
|
1061
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
1062
|
+
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1063
|
+
}
|
|
1258
1064
|
|
|
1259
|
-
|
|
1065
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
1066
|
+
constructor: {
|
|
1067
|
+
value: subClass,
|
|
1068
|
+
enumerable: false,
|
|
1069
|
+
writable: true,
|
|
1070
|
+
configurable: true
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1074
|
+
};
|
|
1260
1075
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
* @name delete
|
|
1266
|
-
* @memberOf Hash
|
|
1267
|
-
* @param {Object} hash The hash to modify.
|
|
1268
|
-
* @param {string} key The key of the value to remove.
|
|
1269
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1270
|
-
*/
|
|
1271
|
-
function hashDelete(key) {
|
|
1272
|
-
var result = this.has(key) && delete this.__data__[key];
|
|
1273
|
-
this.size -= result ? 1 : 0;
|
|
1274
|
-
return result;
|
|
1275
|
-
}
|
|
1076
|
+
var possibleConstructorReturn = function (self, call) {
|
|
1077
|
+
if (!self) {
|
|
1078
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1079
|
+
}
|
|
1276
1080
|
|
|
1277
|
-
|
|
1081
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1082
|
+
};
|
|
1278
1083
|
|
|
1279
|
-
|
|
1280
|
-
|
|
1084
|
+
var slicedToArray = function () {
|
|
1085
|
+
function sliceIterator(arr, i) {
|
|
1086
|
+
var _arr = [];
|
|
1087
|
+
var _n = true;
|
|
1088
|
+
var _d = false;
|
|
1089
|
+
var _e = undefined;
|
|
1281
1090
|
|
|
1282
|
-
|
|
1283
|
-
var
|
|
1091
|
+
try {
|
|
1092
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
1093
|
+
_arr.push(_s.value);
|
|
1284
1094
|
|
|
1285
|
-
|
|
1286
|
-
|
|
1095
|
+
if (i && _arr.length === i) break;
|
|
1096
|
+
}
|
|
1097
|
+
} catch (err) {
|
|
1098
|
+
_d = true;
|
|
1099
|
+
_e = err;
|
|
1100
|
+
} finally {
|
|
1101
|
+
try {
|
|
1102
|
+
if (!_n && _i["return"]) _i["return"]();
|
|
1103
|
+
} finally {
|
|
1104
|
+
if (_d) throw _e;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1287
1107
|
|
|
1288
|
-
|
|
1289
|
-
* Gets the hash value for `key`.
|
|
1290
|
-
*
|
|
1291
|
-
* @private
|
|
1292
|
-
* @name get
|
|
1293
|
-
* @memberOf Hash
|
|
1294
|
-
* @param {string} key The key of the value to get.
|
|
1295
|
-
* @returns {*} Returns the entry value.
|
|
1296
|
-
*/
|
|
1297
|
-
function hashGet(key) {
|
|
1298
|
-
var data = this.__data__;
|
|
1299
|
-
if (_nativeCreate) {
|
|
1300
|
-
var result = data[key];
|
|
1301
|
-
return result === HASH_UNDEFINED ? undefined : result;
|
|
1108
|
+
return _arr;
|
|
1302
1109
|
}
|
|
1303
|
-
return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
var _hashGet = hashGet;
|
|
1307
|
-
|
|
1308
|
-
/** Used for built-in method references. */
|
|
1309
|
-
var objectProto$4 = Object.prototype;
|
|
1310
|
-
|
|
1311
|
-
/** Used to check objects for own properties. */
|
|
1312
|
-
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
1313
1110
|
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
var data = this.__data__;
|
|
1325
|
-
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$3.call(data, key);
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
var _hashHas = hashHas;
|
|
1329
|
-
|
|
1330
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
1331
|
-
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1332
|
-
|
|
1333
|
-
/**
|
|
1334
|
-
* Sets the hash `key` to `value`.
|
|
1335
|
-
*
|
|
1336
|
-
* @private
|
|
1337
|
-
* @name set
|
|
1338
|
-
* @memberOf Hash
|
|
1339
|
-
* @param {string} key The key of the value to set.
|
|
1340
|
-
* @param {*} value The value to set.
|
|
1341
|
-
* @returns {Object} Returns the hash instance.
|
|
1342
|
-
*/
|
|
1343
|
-
function hashSet(key, value) {
|
|
1344
|
-
var data = this.__data__;
|
|
1345
|
-
this.size += this.has(key) ? 0 : 1;
|
|
1346
|
-
data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
|
|
1347
|
-
return this;
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
var _hashSet = hashSet;
|
|
1111
|
+
return function (arr, i) {
|
|
1112
|
+
if (Array.isArray(arr)) {
|
|
1113
|
+
return arr;
|
|
1114
|
+
} else if (Symbol.iterator in Object(arr)) {
|
|
1115
|
+
return sliceIterator(arr, i);
|
|
1116
|
+
} else {
|
|
1117
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
1120
|
+
}();
|
|
1351
1121
|
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
* @private
|
|
1356
|
-
* @constructor
|
|
1357
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1358
|
-
*/
|
|
1359
|
-
function Hash(entries) {
|
|
1360
|
-
var index = -1,
|
|
1361
|
-
length = entries == null ? 0 : entries.length;
|
|
1122
|
+
var toConsumableArray = function (arr) {
|
|
1123
|
+
if (Array.isArray(arr)) {
|
|
1124
|
+
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
1362
1125
|
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
this.set(entry[0], entry[1]);
|
|
1126
|
+
return arr2;
|
|
1127
|
+
} else {
|
|
1128
|
+
return Array.from(arr);
|
|
1367
1129
|
}
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
// Add methods to `Hash`.
|
|
1371
|
-
Hash.prototype.clear = _hashClear;
|
|
1372
|
-
Hash.prototype['delete'] = _hashDelete;
|
|
1373
|
-
Hash.prototype.get = _hashGet;
|
|
1374
|
-
Hash.prototype.has = _hashHas;
|
|
1375
|
-
Hash.prototype.set = _hashSet;
|
|
1376
|
-
|
|
1377
|
-
var _Hash = Hash;
|
|
1130
|
+
};
|
|
1378
1131
|
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
*
|
|
1382
|
-
* @private
|
|
1383
|
-
* @name clear
|
|
1384
|
-
* @memberOf ListCache
|
|
1385
|
-
*/
|
|
1386
|
-
function listCacheClear() {
|
|
1387
|
-
this.__data__ = [];
|
|
1388
|
-
this.size = 0;
|
|
1389
|
-
}
|
|
1132
|
+
var DeckContent = function (_React$Component) {
|
|
1133
|
+
inherits(DeckContent, _React$Component);
|
|
1390
1134
|
|
|
1391
|
-
|
|
1135
|
+
function DeckContent() {
|
|
1136
|
+
var _ref;
|
|
1392
1137
|
|
|
1393
|
-
|
|
1394
|
-
* Performs a
|
|
1395
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
1396
|
-
* comparison between two values to determine if they are equivalent.
|
|
1397
|
-
*
|
|
1398
|
-
* @static
|
|
1399
|
-
* @memberOf _
|
|
1400
|
-
* @since 4.0.0
|
|
1401
|
-
* @category Lang
|
|
1402
|
-
* @param {*} value The value to compare.
|
|
1403
|
-
* @param {*} other The other value to compare.
|
|
1404
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
1405
|
-
* @example
|
|
1406
|
-
*
|
|
1407
|
-
* var object = { 'a': 1 };
|
|
1408
|
-
* var other = { 'a': 1 };
|
|
1409
|
-
*
|
|
1410
|
-
* _.eq(object, object);
|
|
1411
|
-
* // => true
|
|
1412
|
-
*
|
|
1413
|
-
* _.eq(object, other);
|
|
1414
|
-
* // => false
|
|
1415
|
-
*
|
|
1416
|
-
* _.eq('a', 'a');
|
|
1417
|
-
* // => true
|
|
1418
|
-
*
|
|
1419
|
-
* _.eq('a', Object('a'));
|
|
1420
|
-
* // => false
|
|
1421
|
-
*
|
|
1422
|
-
* _.eq(NaN, NaN);
|
|
1423
|
-
* // => true
|
|
1424
|
-
*/
|
|
1425
|
-
function eq(value, other) {
|
|
1426
|
-
return value === other || (value !== value && other !== other);
|
|
1427
|
-
}
|
|
1138
|
+
var _temp, _this, _ret;
|
|
1428
1139
|
|
|
1429
|
-
|
|
1140
|
+
classCallCheck(this, DeckContent);
|
|
1430
1141
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
*
|
|
1434
|
-
* @private
|
|
1435
|
-
* @param {Array} array The array to inspect.
|
|
1436
|
-
* @param {*} key The key to search for.
|
|
1437
|
-
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1438
|
-
*/
|
|
1439
|
-
function assocIndexOf(array, key) {
|
|
1440
|
-
var length = array.length;
|
|
1441
|
-
while (length--) {
|
|
1442
|
-
if (eq_1(array[length][0], key)) {
|
|
1443
|
-
return length;
|
|
1142
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
1143
|
+
args[_key] = arguments[_key];
|
|
1444
1144
|
}
|
|
1445
|
-
}
|
|
1446
|
-
return -1;
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
var _assocIndexOf = assocIndexOf;
|
|
1450
1145
|
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
}
|
|
1479
|
-
--this.size;
|
|
1480
|
-
return true;
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
var _listCacheDelete = listCacheDelete;
|
|
1484
|
-
|
|
1485
|
-
/**
|
|
1486
|
-
* Gets the list cache value for `key`.
|
|
1487
|
-
*
|
|
1488
|
-
* @private
|
|
1489
|
-
* @name get
|
|
1490
|
-
* @memberOf ListCache
|
|
1491
|
-
* @param {string} key The key of the value to get.
|
|
1492
|
-
* @returns {*} Returns the entry value.
|
|
1493
|
-
*/
|
|
1494
|
-
function listCacheGet(key) {
|
|
1495
|
-
var data = this.__data__,
|
|
1496
|
-
index = _assocIndexOf(data, key);
|
|
1146
|
+
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 = {
|
|
1147
|
+
data: _this.data,
|
|
1148
|
+
dataKeptToCompareNewDatarecord: _this.data,
|
|
1149
|
+
per: _this.params ? _this.params.to : 2,
|
|
1150
|
+
page: 1,
|
|
1151
|
+
from: _this.params ? _this.params.from : 0,
|
|
1152
|
+
to: _this.params ? _this.params.to : 2,
|
|
1153
|
+
total_pages: null,
|
|
1154
|
+
scrolling: true,
|
|
1155
|
+
query: _this.query
|
|
1156
|
+
}, _this.loadMore = function () {
|
|
1157
|
+
setTimeout(function () {
|
|
1158
|
+
_this.setState(function (state) {
|
|
1159
|
+
return {
|
|
1160
|
+
page: state.page + 1,
|
|
1161
|
+
from: state.from + state.per,
|
|
1162
|
+
to: state.to + state.per
|
|
1163
|
+
};
|
|
1164
|
+
}, _this.loadData);
|
|
1165
|
+
}, 10);
|
|
1166
|
+
}, _this.loadData = function () {
|
|
1167
|
+
var _this$state = _this.state,
|
|
1168
|
+
from = _this$state.from,
|
|
1169
|
+
to = _this$state.to,
|
|
1170
|
+
data = _this$state.data,
|
|
1171
|
+
query = _this$state.query;
|
|
1172
|
+
var client = _this.props.client;
|
|
1497
1173
|
|
|
1498
|
-
return index < 0 ? undefined : data[index][1];
|
|
1499
|
-
}
|
|
1500
1174
|
|
|
1501
|
-
var
|
|
1175
|
+
var params = { from: from, to: to };
|
|
1176
|
+
var queryUpdated = query.replace('$from', params.from).replace('$to', params.to);
|
|
1177
|
+
// const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
|
|
1502
1178
|
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1179
|
+
if (_this.pointer && _this.pointerArray) {
|
|
1180
|
+
var pointer = _this.pointer;
|
|
1181
|
+
client.fetch(queryUpdated).then(function (dataArr) {
|
|
1182
|
+
_this.setState(function (state, props) {
|
|
1183
|
+
if (dataArr[_this.pointerArray][pointer].length > 0) {
|
|
1184
|
+
return {
|
|
1185
|
+
data: [].concat(toConsumableArray(data), toConsumableArray(dataArr[_this.pointerArray][pointer])),
|
|
1186
|
+
scrolling: true
|
|
1187
|
+
};
|
|
1188
|
+
} else {
|
|
1189
|
+
return {
|
|
1190
|
+
scrolling: false
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
});
|
|
1195
|
+
} else {
|
|
1196
|
+
client.fetch(queryUpdated).then(function (dataArr) {
|
|
1197
|
+
_this.setState(function (state, props) {
|
|
1198
|
+
if (dataArr.length > 0) {
|
|
1199
|
+
return {
|
|
1200
|
+
data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
|
|
1201
|
+
scrolling: true
|
|
1202
|
+
};
|
|
1203
|
+
} else {
|
|
1204
|
+
return {
|
|
1205
|
+
scrolling: false
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
}, _this.urlFor = function (source) {
|
|
1212
|
+
var client = _this.props.client;
|
|
1515
1213
|
|
|
1516
|
-
var
|
|
1214
|
+
var builder = imageUrlBuilder(client);
|
|
1215
|
+
return builder.image(source);
|
|
1216
|
+
}, _this.renderCardImage = function (row, page) {
|
|
1217
|
+
if (row.thumbnail && row.thumbnail.asset) {
|
|
1218
|
+
return _this.urlFor(row.thumbnail.asset).url();
|
|
1219
|
+
/*} else if (page === 'videos' && row.youtubeURL) {
|
|
1220
|
+
return `https://img.youtube.com/vi/${getYouTubeId(row.youtubeURL)}/0.jpg`*/
|
|
1221
|
+
} else {
|
|
1222
|
+
return _this.defaultImage;
|
|
1223
|
+
}
|
|
1224
|
+
}, _this.cardLoader = function (page, columns, variant) {
|
|
1225
|
+
var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
|
|
1517
1226
|
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1227
|
+
var itemCounter = 0;
|
|
1228
|
+
var lgVar = 12;
|
|
1229
|
+
return React__default.createElement(
|
|
1230
|
+
Row,
|
|
1231
|
+
null,
|
|
1232
|
+
_this.state.data && _this.state.data.map(function (row, index) {
|
|
1233
|
+
if (columns === 'rotate' && itemCounter % 3 === 0) {
|
|
1234
|
+
lgVar = 12;
|
|
1235
|
+
} else if (columns && columns !== 'rotate') {
|
|
1236
|
+
lgVar = Math.floor(12 / columns);
|
|
1237
|
+
} else {
|
|
1238
|
+
lgVar = 6;
|
|
1239
|
+
}
|
|
1531
1240
|
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1241
|
+
return React__default.createElement(
|
|
1242
|
+
Col,
|
|
1243
|
+
{ key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
|
|
1244
|
+
React__default.createElement(
|
|
1245
|
+
Card,
|
|
1246
|
+
{ className: 'content-card', style: { flexDirection: mode } },
|
|
1247
|
+
React__default.createElement(
|
|
1248
|
+
Link,
|
|
1249
|
+
{ href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
|
|
1250
|
+
React__default.createElement(
|
|
1251
|
+
'a',
|
|
1252
|
+
null,
|
|
1253
|
+
React__default.createElement(Card.Img, { variant: 'top', src: _this.renderCardImage(row, page), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
|
|
1254
|
+
)
|
|
1255
|
+
),
|
|
1256
|
+
React__default.createElement(
|
|
1257
|
+
Card.Body,
|
|
1258
|
+
null,
|
|
1259
|
+
React__default.createElement(
|
|
1260
|
+
Link,
|
|
1261
|
+
{ href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
|
|
1262
|
+
React__default.createElement(
|
|
1263
|
+
'a',
|
|
1264
|
+
null,
|
|
1265
|
+
React__default.createElement(
|
|
1266
|
+
Card.Title,
|
|
1267
|
+
null,
|
|
1268
|
+
row.title
|
|
1269
|
+
),
|
|
1270
|
+
React__default.createElement(
|
|
1271
|
+
Card.Text,
|
|
1272
|
+
null,
|
|
1273
|
+
row.summary
|
|
1274
|
+
)
|
|
1275
|
+
)
|
|
1276
|
+
)
|
|
1277
|
+
)
|
|
1278
|
+
)
|
|
1279
|
+
);
|
|
1280
|
+
})
|
|
1281
|
+
);
|
|
1282
|
+
}, _temp), possibleConstructorReturn(_this, _ret);
|
|
1537
1283
|
}
|
|
1538
|
-
return this;
|
|
1539
|
-
}
|
|
1540
1284
|
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1285
|
+
createClass(DeckContent, [{
|
|
1286
|
+
key: 'componentDidUpdate',
|
|
1287
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
1288
|
+
if (this.state.dataKeptToCompareNewDatarecord !== this.props.dataRecord) {
|
|
1289
|
+
// eslint-disable-next-line react/no-did-update-set-state
|
|
1290
|
+
this.setState({
|
|
1291
|
+
data: this.props.dataRecord,
|
|
1292
|
+
dataKeptToCompareNewDatarecord: this.props.dataRecord,
|
|
1293
|
+
per: this.props.params ? this.props.params.to : 2,
|
|
1294
|
+
page: 1,
|
|
1295
|
+
from: this.props.params ? this.props.params.from : 0,
|
|
1296
|
+
to: this.props.params ? this.props.params.to : 2,
|
|
1297
|
+
total_pages: null,
|
|
1298
|
+
scrolling: true,
|
|
1299
|
+
query: this.props.query
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}, {
|
|
1304
|
+
key: 'componentDidMount',
|
|
1305
|
+
value: function componentDidMount() {
|
|
1306
|
+
// this.loadData();
|
|
1307
|
+
}
|
|
1308
|
+
}, {
|
|
1309
|
+
key: 'render',
|
|
1310
|
+
value: function render() {
|
|
1311
|
+
var _this2 = this;
|
|
1553
1312
|
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
}
|
|
1313
|
+
var _props = this.props,
|
|
1314
|
+
columns = _props.columns,
|
|
1315
|
+
variant = _props.variant,
|
|
1316
|
+
autoScroll = _props.autoScroll,
|
|
1317
|
+
page = _props.page;
|
|
1560
1318
|
|
|
1561
|
-
// Add methods to `ListCache`.
|
|
1562
|
-
ListCache.prototype.clear = _listCacheClear;
|
|
1563
|
-
ListCache.prototype['delete'] = _listCacheDelete;
|
|
1564
|
-
ListCache.prototype.get = _listCacheGet;
|
|
1565
|
-
ListCache.prototype.has = _listCacheHas;
|
|
1566
|
-
ListCache.prototype.set = _listCacheSet;
|
|
1567
1319
|
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
*/
|
|
1617
|
-
function getMapData(map, key) {
|
|
1618
|
-
var data = map.__data__;
|
|
1619
|
-
return _isKeyable(key)
|
|
1620
|
-
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1621
|
-
: data.map;
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
|
-
var _getMapData = getMapData;
|
|
1625
|
-
|
|
1626
|
-
/**
|
|
1627
|
-
* Removes `key` and its value from the map.
|
|
1628
|
-
*
|
|
1629
|
-
* @private
|
|
1630
|
-
* @name delete
|
|
1631
|
-
* @memberOf MapCache
|
|
1632
|
-
* @param {string} key The key of the value to remove.
|
|
1633
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1634
|
-
*/
|
|
1635
|
-
function mapCacheDelete(key) {
|
|
1636
|
-
var result = _getMapData(this, key)['delete'](key);
|
|
1637
|
-
this.size -= result ? 1 : 0;
|
|
1638
|
-
return result;
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
var _mapCacheDelete = mapCacheDelete;
|
|
1642
|
-
|
|
1643
|
-
/**
|
|
1644
|
-
* Gets the map value for `key`.
|
|
1645
|
-
*
|
|
1646
|
-
* @private
|
|
1647
|
-
* @name get
|
|
1648
|
-
* @memberOf MapCache
|
|
1649
|
-
* @param {string} key The key of the value to get.
|
|
1650
|
-
* @returns {*} Returns the entry value.
|
|
1651
|
-
*/
|
|
1652
|
-
function mapCacheGet(key) {
|
|
1653
|
-
return _getMapData(this, key).get(key);
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
var _mapCacheGet = mapCacheGet;
|
|
1657
|
-
|
|
1658
|
-
/**
|
|
1659
|
-
* Checks if a map value for `key` exists.
|
|
1660
|
-
*
|
|
1661
|
-
* @private
|
|
1662
|
-
* @name has
|
|
1663
|
-
* @memberOf MapCache
|
|
1664
|
-
* @param {string} key The key of the entry to check.
|
|
1665
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1666
|
-
*/
|
|
1667
|
-
function mapCacheHas(key) {
|
|
1668
|
-
return _getMapData(this, key).has(key);
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
var _mapCacheHas = mapCacheHas;
|
|
1672
|
-
|
|
1673
|
-
/**
|
|
1674
|
-
* Sets the map `key` to `value`.
|
|
1675
|
-
*
|
|
1676
|
-
* @private
|
|
1677
|
-
* @name set
|
|
1678
|
-
* @memberOf MapCache
|
|
1679
|
-
* @param {string} key The key of the value to set.
|
|
1680
|
-
* @param {*} value The value to set.
|
|
1681
|
-
* @returns {Object} Returns the map cache instance.
|
|
1682
|
-
*/
|
|
1683
|
-
function mapCacheSet(key, value) {
|
|
1684
|
-
var data = _getMapData(this, key),
|
|
1685
|
-
size = data.size;
|
|
1686
|
-
|
|
1687
|
-
data.set(key, value);
|
|
1688
|
-
this.size += data.size == size ? 0 : 1;
|
|
1689
|
-
return this;
|
|
1690
|
-
}
|
|
1691
|
-
|
|
1692
|
-
var _mapCacheSet = mapCacheSet;
|
|
1693
|
-
|
|
1694
|
-
/**
|
|
1695
|
-
* Creates a map cache object to store key-value pairs.
|
|
1696
|
-
*
|
|
1697
|
-
* @private
|
|
1698
|
-
* @constructor
|
|
1699
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1700
|
-
*/
|
|
1701
|
-
function MapCache(entries) {
|
|
1702
|
-
var index = -1,
|
|
1703
|
-
length = entries == null ? 0 : entries.length;
|
|
1704
|
-
|
|
1705
|
-
this.clear();
|
|
1706
|
-
while (++index < length) {
|
|
1707
|
-
var entry = entries[index];
|
|
1708
|
-
this.set(entry[0], entry[1]);
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
|
-
// Add methods to `MapCache`.
|
|
1713
|
-
MapCache.prototype.clear = _mapCacheClear;
|
|
1714
|
-
MapCache.prototype['delete'] = _mapCacheDelete;
|
|
1715
|
-
MapCache.prototype.get = _mapCacheGet;
|
|
1716
|
-
MapCache.prototype.has = _mapCacheHas;
|
|
1717
|
-
MapCache.prototype.set = _mapCacheSet;
|
|
1718
|
-
|
|
1719
|
-
var _MapCache = MapCache;
|
|
1720
|
-
|
|
1721
|
-
/** Error message constants. */
|
|
1722
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
1723
|
-
|
|
1724
|
-
/**
|
|
1725
|
-
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
1726
|
-
* provided, it determines the cache key for storing the result based on the
|
|
1727
|
-
* arguments provided to the memoized function. By default, the first argument
|
|
1728
|
-
* provided to the memoized function is used as the map cache key. The `func`
|
|
1729
|
-
* is invoked with the `this` binding of the memoized function.
|
|
1730
|
-
*
|
|
1731
|
-
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
1732
|
-
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
1733
|
-
* constructor with one whose instances implement the
|
|
1734
|
-
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
1735
|
-
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
1736
|
-
*
|
|
1737
|
-
* @static
|
|
1738
|
-
* @memberOf _
|
|
1739
|
-
* @since 0.1.0
|
|
1740
|
-
* @category Function
|
|
1741
|
-
* @param {Function} func The function to have its output memoized.
|
|
1742
|
-
* @param {Function} [resolver] The function to resolve the cache key.
|
|
1743
|
-
* @returns {Function} Returns the new memoized function.
|
|
1744
|
-
* @example
|
|
1745
|
-
*
|
|
1746
|
-
* var object = { 'a': 1, 'b': 2 };
|
|
1747
|
-
* var other = { 'c': 3, 'd': 4 };
|
|
1748
|
-
*
|
|
1749
|
-
* var values = _.memoize(_.values);
|
|
1750
|
-
* values(object);
|
|
1751
|
-
* // => [1, 2]
|
|
1752
|
-
*
|
|
1753
|
-
* values(other);
|
|
1754
|
-
* // => [3, 4]
|
|
1755
|
-
*
|
|
1756
|
-
* object.a = 2;
|
|
1757
|
-
* values(object);
|
|
1758
|
-
* // => [1, 2]
|
|
1759
|
-
*
|
|
1760
|
-
* // Modify the result cache.
|
|
1761
|
-
* values.cache.set(object, ['a', 'b']);
|
|
1762
|
-
* values(object);
|
|
1763
|
-
* // => ['a', 'b']
|
|
1764
|
-
*
|
|
1765
|
-
* // Replace `_.memoize.Cache`.
|
|
1766
|
-
* _.memoize.Cache = WeakMap;
|
|
1767
|
-
*/
|
|
1768
|
-
function memoize(func, resolver) {
|
|
1769
|
-
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
1770
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
1771
|
-
}
|
|
1772
|
-
var memoized = function() {
|
|
1773
|
-
var args = arguments,
|
|
1774
|
-
key = resolver ? resolver.apply(this, args) : args[0],
|
|
1775
|
-
cache = memoized.cache;
|
|
1776
|
-
|
|
1777
|
-
if (cache.has(key)) {
|
|
1778
|
-
return cache.get(key);
|
|
1779
|
-
}
|
|
1780
|
-
var result = func.apply(this, args);
|
|
1781
|
-
memoized.cache = cache.set(key, result) || cache;
|
|
1782
|
-
return result;
|
|
1783
|
-
};
|
|
1784
|
-
memoized.cache = new (memoize.Cache || _MapCache);
|
|
1785
|
-
return memoized;
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
// Expose `MapCache`.
|
|
1789
|
-
memoize.Cache = _MapCache;
|
|
1790
|
-
|
|
1791
|
-
var memoize_1 = memoize;
|
|
1792
|
-
|
|
1793
|
-
/** Used as the maximum memoize cache size. */
|
|
1794
|
-
var MAX_MEMOIZE_SIZE = 500;
|
|
1795
|
-
|
|
1796
|
-
/**
|
|
1797
|
-
* A specialized version of `_.memoize` which clears the memoized function's
|
|
1798
|
-
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
1799
|
-
*
|
|
1800
|
-
* @private
|
|
1801
|
-
* @param {Function} func The function to have its output memoized.
|
|
1802
|
-
* @returns {Function} Returns the new memoized function.
|
|
1803
|
-
*/
|
|
1804
|
-
function memoizeCapped(func) {
|
|
1805
|
-
var result = memoize_1(func, function(key) {
|
|
1806
|
-
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
1807
|
-
cache.clear();
|
|
1320
|
+
return React__default.createElement(
|
|
1321
|
+
'div',
|
|
1322
|
+
{ className: 'contentDeck' },
|
|
1323
|
+
autoScroll ? React__default.createElement(
|
|
1324
|
+
React__default.Fragment,
|
|
1325
|
+
null,
|
|
1326
|
+
React__default.createElement(
|
|
1327
|
+
InfiniteScroll,
|
|
1328
|
+
{ dataLength: this.state.data.length, next: this.loadMore, hasMore: this.state.scrolling },
|
|
1329
|
+
this.cardLoader(page, columns, variant)
|
|
1330
|
+
),
|
|
1331
|
+
React__default.createElement(
|
|
1332
|
+
'noscript',
|
|
1333
|
+
null,
|
|
1334
|
+
'Manual Pagination Here'
|
|
1335
|
+
)
|
|
1336
|
+
) : React__default.createElement(
|
|
1337
|
+
React__default.Fragment,
|
|
1338
|
+
null,
|
|
1339
|
+
this.cardLoader(page, columns, variant),
|
|
1340
|
+
React__default.createElement(
|
|
1341
|
+
'div',
|
|
1342
|
+
{ style: { padding: '0px 10px' } },
|
|
1343
|
+
this.state.scrolling ? React__default.createElement(
|
|
1344
|
+
'button',
|
|
1345
|
+
{
|
|
1346
|
+
style: { margin: 'auto', width: '100%' },
|
|
1347
|
+
onClick: function onClick(e) {
|
|
1348
|
+
_this2.loadMore();
|
|
1349
|
+
} },
|
|
1350
|
+
'Load More'
|
|
1351
|
+
) : React__default.createElement(
|
|
1352
|
+
'p',
|
|
1353
|
+
{ style: { textAlign: 'center' } },
|
|
1354
|
+
React__default.createElement(
|
|
1355
|
+
'b',
|
|
1356
|
+
null,
|
|
1357
|
+
'End of data'
|
|
1358
|
+
)
|
|
1359
|
+
)
|
|
1360
|
+
),
|
|
1361
|
+
React__default.createElement(
|
|
1362
|
+
'noscript',
|
|
1363
|
+
null,
|
|
1364
|
+
'Manual Pagination Here'
|
|
1365
|
+
)
|
|
1366
|
+
)
|
|
1367
|
+
);
|
|
1808
1368
|
}
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
var cache = result.cache;
|
|
1813
|
-
return result;
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
var _memoizeCapped = memoizeCapped;
|
|
1817
|
-
|
|
1818
|
-
/** Used to match property names within property paths. */
|
|
1819
|
-
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
1820
|
-
|
|
1821
|
-
/** Used to match backslashes in property paths. */
|
|
1822
|
-
var reEscapeChar = /\\(\\)?/g;
|
|
1823
|
-
|
|
1824
|
-
/**
|
|
1825
|
-
* Converts `string` to a property path array.
|
|
1826
|
-
*
|
|
1827
|
-
* @private
|
|
1828
|
-
* @param {string} string The string to convert.
|
|
1829
|
-
* @returns {Array} Returns the property path array.
|
|
1830
|
-
*/
|
|
1831
|
-
var stringToPath = _memoizeCapped(function(string) {
|
|
1832
|
-
var result = [];
|
|
1833
|
-
if (string.charCodeAt(0) === 46 /* . */) {
|
|
1834
|
-
result.push('');
|
|
1835
|
-
}
|
|
1836
|
-
string.replace(rePropName, function(match, number, quote, subString) {
|
|
1837
|
-
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
1838
|
-
});
|
|
1839
|
-
return result;
|
|
1840
|
-
});
|
|
1841
|
-
|
|
1842
|
-
var _stringToPath = stringToPath;
|
|
1843
|
-
|
|
1844
|
-
/**
|
|
1845
|
-
* A specialized version of `_.map` for arrays without support for iteratee
|
|
1846
|
-
* shorthands.
|
|
1847
|
-
*
|
|
1848
|
-
* @private
|
|
1849
|
-
* @param {Array} [array] The array to iterate over.
|
|
1850
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
1851
|
-
* @returns {Array} Returns the new mapped array.
|
|
1852
|
-
*/
|
|
1853
|
-
function arrayMap(array, iteratee) {
|
|
1854
|
-
var index = -1,
|
|
1855
|
-
length = array == null ? 0 : array.length,
|
|
1856
|
-
result = Array(length);
|
|
1857
|
-
|
|
1858
|
-
while (++index < length) {
|
|
1859
|
-
result[index] = iteratee(array[index], index, array);
|
|
1860
|
-
}
|
|
1861
|
-
return result;
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
|
-
var _arrayMap = arrayMap;
|
|
1865
|
-
|
|
1866
|
-
/** Used as references for various `Number` constants. */
|
|
1867
|
-
var INFINITY = 1 / 0;
|
|
1868
|
-
|
|
1869
|
-
/** Used to convert symbols to primitives and strings. */
|
|
1870
|
-
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
1871
|
-
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
1872
|
-
|
|
1873
|
-
/**
|
|
1874
|
-
* The base implementation of `_.toString` which doesn't convert nullish
|
|
1875
|
-
* values to empty strings.
|
|
1876
|
-
*
|
|
1877
|
-
* @private
|
|
1878
|
-
* @param {*} value The value to process.
|
|
1879
|
-
* @returns {string} Returns the string.
|
|
1880
|
-
*/
|
|
1881
|
-
function baseToString(value) {
|
|
1882
|
-
// Exit early for strings to avoid a performance hit in some environments.
|
|
1883
|
-
if (typeof value == 'string') {
|
|
1884
|
-
return value;
|
|
1885
|
-
}
|
|
1886
|
-
if (isArray_1(value)) {
|
|
1887
|
-
// Recursively convert values (susceptible to call stack limits).
|
|
1888
|
-
return _arrayMap(value, baseToString) + '';
|
|
1889
|
-
}
|
|
1890
|
-
if (isSymbol_1(value)) {
|
|
1891
|
-
return symbolToString ? symbolToString.call(value) : '';
|
|
1892
|
-
}
|
|
1893
|
-
var result = (value + '');
|
|
1894
|
-
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
var _baseToString = baseToString;
|
|
1898
|
-
|
|
1899
|
-
/**
|
|
1900
|
-
* Converts `value` to a string. An empty string is returned for `null`
|
|
1901
|
-
* and `undefined` values. The sign of `-0` is preserved.
|
|
1902
|
-
*
|
|
1903
|
-
* @static
|
|
1904
|
-
* @memberOf _
|
|
1905
|
-
* @since 4.0.0
|
|
1906
|
-
* @category Lang
|
|
1907
|
-
* @param {*} value The value to convert.
|
|
1908
|
-
* @returns {string} Returns the converted string.
|
|
1909
|
-
* @example
|
|
1910
|
-
*
|
|
1911
|
-
* _.toString(null);
|
|
1912
|
-
* // => ''
|
|
1913
|
-
*
|
|
1914
|
-
* _.toString(-0);
|
|
1915
|
-
* // => '-0'
|
|
1916
|
-
*
|
|
1917
|
-
* _.toString([1, 2, 3]);
|
|
1918
|
-
* // => '1,2,3'
|
|
1919
|
-
*/
|
|
1920
|
-
function toString(value) {
|
|
1921
|
-
return value == null ? '' : _baseToString(value);
|
|
1922
|
-
}
|
|
1923
|
-
|
|
1924
|
-
var toString_1 = toString;
|
|
1925
|
-
|
|
1926
|
-
/**
|
|
1927
|
-
* Casts `value` to a path array if it's not one.
|
|
1928
|
-
*
|
|
1929
|
-
* @private
|
|
1930
|
-
* @param {*} value The value to inspect.
|
|
1931
|
-
* @param {Object} [object] The object to query keys on.
|
|
1932
|
-
* @returns {Array} Returns the cast property path array.
|
|
1933
|
-
*/
|
|
1934
|
-
function castPath(value, object) {
|
|
1935
|
-
if (isArray_1(value)) {
|
|
1936
|
-
return value;
|
|
1937
|
-
}
|
|
1938
|
-
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
var _castPath = castPath;
|
|
1942
|
-
|
|
1943
|
-
/** Used as references for various `Number` constants. */
|
|
1944
|
-
var INFINITY$1 = 1 / 0;
|
|
1945
|
-
|
|
1946
|
-
/**
|
|
1947
|
-
* Converts `value` to a string key if it's not a string or symbol.
|
|
1948
|
-
*
|
|
1949
|
-
* @private
|
|
1950
|
-
* @param {*} value The value to inspect.
|
|
1951
|
-
* @returns {string|symbol} Returns the key.
|
|
1952
|
-
*/
|
|
1953
|
-
function toKey(value) {
|
|
1954
|
-
if (typeof value == 'string' || isSymbol_1(value)) {
|
|
1955
|
-
return value;
|
|
1956
|
-
}
|
|
1957
|
-
var result = (value + '');
|
|
1958
|
-
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
1959
|
-
}
|
|
1960
|
-
|
|
1961
|
-
var _toKey = toKey;
|
|
1962
|
-
|
|
1963
|
-
/**
|
|
1964
|
-
* The base implementation of `_.get` without support for default values.
|
|
1965
|
-
*
|
|
1966
|
-
* @private
|
|
1967
|
-
* @param {Object} object The object to query.
|
|
1968
|
-
* @param {Array|string} path The path of the property to get.
|
|
1969
|
-
* @returns {*} Returns the resolved value.
|
|
1970
|
-
*/
|
|
1971
|
-
function baseGet(object, path) {
|
|
1972
|
-
path = _castPath(path, object);
|
|
1973
|
-
|
|
1974
|
-
var index = 0,
|
|
1975
|
-
length = path.length;
|
|
1976
|
-
|
|
1977
|
-
while (object != null && index < length) {
|
|
1978
|
-
object = object[_toKey(path[index++])];
|
|
1979
|
-
}
|
|
1980
|
-
return (index && index == length) ? object : undefined;
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
var _baseGet = baseGet;
|
|
1984
|
-
|
|
1985
|
-
/**
|
|
1986
|
-
* Gets the value at `path` of `object`. If the resolved value is
|
|
1987
|
-
* `undefined`, the `defaultValue` is returned in its place.
|
|
1988
|
-
*
|
|
1989
|
-
* @static
|
|
1990
|
-
* @memberOf _
|
|
1991
|
-
* @since 3.7.0
|
|
1992
|
-
* @category Object
|
|
1993
|
-
* @param {Object} object The object to query.
|
|
1994
|
-
* @param {Array|string} path The path of the property to get.
|
|
1995
|
-
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
1996
|
-
* @returns {*} Returns the resolved value.
|
|
1997
|
-
* @example
|
|
1998
|
-
*
|
|
1999
|
-
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
2000
|
-
*
|
|
2001
|
-
* _.get(object, 'a[0].b.c');
|
|
2002
|
-
* // => 3
|
|
2003
|
-
*
|
|
2004
|
-
* _.get(object, ['a', '0', 'b', 'c']);
|
|
2005
|
-
* // => 3
|
|
2006
|
-
*
|
|
2007
|
-
* _.get(object, 'a.b.c', 'default');
|
|
2008
|
-
* // => 'default'
|
|
2009
|
-
*/
|
|
2010
|
-
function get$1(object, path, defaultValue) {
|
|
2011
|
-
var result = object == null ? undefined : _baseGet(object, path);
|
|
2012
|
-
return result === undefined ? defaultValue : result;
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2015
|
-
var get_1 = get$1;
|
|
1369
|
+
}]);
|
|
1370
|
+
return DeckContent;
|
|
1371
|
+
}(React__default.Component);
|
|
2016
1372
|
|
|
2017
1373
|
var DeckQueue = function (_React$Component) {
|
|
2018
1374
|
inherits(DeckQueue, _React$Component);
|
|
@@ -2091,6 +1447,11 @@ var DeckQueue = function (_React$Component) {
|
|
|
2091
1447
|
});
|
|
2092
1448
|
});
|
|
2093
1449
|
}
|
|
1450
|
+
}, _this.urlFor = function (source) {
|
|
1451
|
+
var client = _this.props.client;
|
|
1452
|
+
|
|
1453
|
+
var builder = imageUrlBuilder(client);
|
|
1454
|
+
return builder.image(source);
|
|
2094
1455
|
}, _temp), possibleConstructorReturn(_this, _ret);
|
|
2095
1456
|
}
|
|
2096
1457
|
|
|
@@ -2106,7 +1467,8 @@ var DeckQueue = function (_React$Component) {
|
|
|
2106
1467
|
Row,
|
|
2107
1468
|
null,
|
|
2108
1469
|
this.state.data && this.state.data.map(function (row, index) {
|
|
2109
|
-
|
|
1470
|
+
// const thumbnailURL = get(row, 'thumbnail.asset.url', this.props.defaultImage)
|
|
1471
|
+
var thumbnailURL = row.thumbnail && row.thumbnail.asset ? _this2.urlFor(row.thumbnail.asset).url() : _this2.props.defaultImage;
|
|
2110
1472
|
return React__default.createElement(
|
|
2111
1473
|
Col,
|
|
2112
1474
|
{ key: index, md: 12, lg: lgVar, style: { display: 'flex', flex: '1 0 auto' } },
|
|
@@ -2206,7 +1568,15 @@ var DeckQueue = function (_React$Component) {
|
|
|
2206
1568
|
|
|
2207
1569
|
var ThumbnailCard = function ThumbnailCard(_ref) {
|
|
2208
1570
|
var size = _ref.size,
|
|
2209
|
-
mediaData = _ref.mediaData
|
|
1571
|
+
mediaData = _ref.mediaData,
|
|
1572
|
+
client = _ref.client,
|
|
1573
|
+
defaultImage = _ref.defaultImage;
|
|
1574
|
+
|
|
1575
|
+
var builder = imageUrlBuilder(client);
|
|
1576
|
+
|
|
1577
|
+
var urlFor = function urlFor(source) {
|
|
1578
|
+
return builder.image(source);
|
|
1579
|
+
};
|
|
2210
1580
|
|
|
2211
1581
|
return React__default.createElement(
|
|
2212
1582
|
'div',
|
|
@@ -2215,7 +1585,13 @@ var ThumbnailCard = function ThumbnailCard(_ref) {
|
|
|
2215
1585
|
return React__default.createElement(
|
|
2216
1586
|
Media,
|
|
2217
1587
|
{ className: 'mb-3 thumbnail-card' },
|
|
2218
|
-
React__default.createElement('img', {
|
|
1588
|
+
React__default.createElement('img', {
|
|
1589
|
+
width: size,
|
|
1590
|
+
height: size,
|
|
1591
|
+
className: 'mr-3',
|
|
1592
|
+
src: item.thumbnail && item.thumbnail.asset ? urlFor(item.thumbnail.asset).url() : defaultImage,
|
|
1593
|
+
alt: 'Generic placeholder'
|
|
1594
|
+
}),
|
|
2219
1595
|
React__default.createElement(
|
|
2220
1596
|
Media.Body,
|
|
2221
1597
|
null,
|
|
@@ -2241,8 +1617,15 @@ var TaxonomyCard = function TaxonomyCard(props) {
|
|
|
2241
1617
|
_props$icon = props.icon,
|
|
2242
1618
|
icon = _props$icon === undefined ? false : _props$icon,
|
|
2243
1619
|
data = props.dataRecord,
|
|
2244
|
-
defaultImage = props.defaultImage
|
|
1620
|
+
defaultImage = props.defaultImage,
|
|
1621
|
+
client = props.client;
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
var builder = imageUrlBuilder(client);
|
|
2245
1625
|
|
|
1626
|
+
var urlFor = function urlFor(source) {
|
|
1627
|
+
return builder.image(source);
|
|
1628
|
+
};
|
|
2246
1629
|
|
|
2247
1630
|
var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
|
|
2248
1631
|
|
|
@@ -2263,8 +1646,7 @@ var TaxonomyCard = function TaxonomyCard(props) {
|
|
|
2263
1646
|
} else {
|
|
2264
1647
|
lgVar = 6;
|
|
2265
1648
|
}
|
|
2266
|
-
var thumbnailURL =
|
|
2267
|
-
|
|
1649
|
+
var thumbnailURL = row.thumbnail && row.thumbnail.asset ? urlFor(row.thumbnail.asset).url() : defaultImage;
|
|
2268
1650
|
return React__default.createElement(
|
|
2269
1651
|
Col,
|
|
2270
1652
|
{ key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
|
|
@@ -2319,7 +1701,8 @@ var TaxonomyCard = function TaxonomyCard(props) {
|
|
|
2319
1701
|
top: '50%',
|
|
2320
1702
|
transform: 'translateY(-50%) translateX(50px)',
|
|
2321
1703
|
transition: 'all .25s',
|
|
2322
|
-
pointerEvents: 'none'
|
|
1704
|
+
pointerEvents: 'none'
|
|
1705
|
+
} },
|
|
2323
1706
|
'\u2192'
|
|
2324
1707
|
)
|
|
2325
1708
|
)
|
|
@@ -3076,7 +2459,7 @@ var NavDvm = function NavDvm(props) {
|
|
|
3076
2459
|
),
|
|
3077
2460
|
React__default.createElement(
|
|
3078
2461
|
Navbar,
|
|
3079
|
-
{ className: 'bottom-nav', variant: 'dark', expand: '
|
|
2462
|
+
{ className: 'bottom-nav', variant: 'dark', expand: 'xl', bg: 'primary', sticky: 'top' },
|
|
3080
2463
|
React__default.createElement(
|
|
3081
2464
|
Container,
|
|
3082
2465
|
{ className: 'position-relative' },
|
|
@@ -3139,7 +2522,7 @@ var NavDvm = function NavDvm(props) {
|
|
|
3139
2522
|
React__default.createElement(
|
|
3140
2523
|
'style',
|
|
3141
2524
|
{ jsx: true },
|
|
3142
|
-
'\n .mobile-logo{\n display: none;\n position: absolute;\n left: 50%;\n top: 0;\n height: 40px;\n transform: translateX(-50%);\n }\n .mobile-logo img{\n height: 100%;\n }\n @media screen and (max-width:
|
|
2525
|
+
'\n .mobile-logo{\n display: none;\n position: absolute;\n left: 50%;\n top: 0;\n height: 40px;\n transform: translateX(-50%);\n }\n .mobile-logo img{\n height: 100%;\n }\n @media screen and (max-width: 1199px){\n .mobile-logo{\n display: block;\n }\n .top-nav{\n display: none;\n }\n }\n '
|
|
3143
2526
|
)
|
|
3144
2527
|
);
|
|
3145
2528
|
};
|
|
@@ -5796,30 +5179,40 @@ var AD300x250x600 = function AD300x250x600(_ref) {
|
|
|
5796
5179
|
|
|
5797
5180
|
var FigureComponent = function FigureComponent(_ref) {
|
|
5798
5181
|
var caption = _ref.caption,
|
|
5799
|
-
asset = _ref.asset
|
|
5182
|
+
asset = _ref.asset,
|
|
5183
|
+
client = _ref.client;
|
|
5800
5184
|
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5185
|
+
var builder = imageUrlBuilder(client);
|
|
5186
|
+
|
|
5187
|
+
var urlFor = function urlFor(source) {
|
|
5188
|
+
return builder.image(source);
|
|
5189
|
+
};
|
|
5190
|
+
|
|
5191
|
+
return React__default.createElement(
|
|
5192
|
+
'div',
|
|
5193
|
+
{ style: { textAlign: 'center', marginTop: '1em', marginBottom: '1em' } },
|
|
5194
|
+
React__default.createElement(
|
|
5195
|
+
Figure,
|
|
5196
|
+
null,
|
|
5197
|
+
React__default.createElement(Figure.Image, { src: urlFor(asset).url() }),
|
|
5198
|
+
caption && React__default.createElement(
|
|
5199
|
+
Figure.Caption,
|
|
5807
5200
|
null,
|
|
5808
|
-
|
|
5809
|
-
caption && React__default.createElement(
|
|
5810
|
-
Figure.Caption,
|
|
5811
|
-
null,
|
|
5812
|
-
caption
|
|
5813
|
-
)
|
|
5201
|
+
caption
|
|
5814
5202
|
)
|
|
5815
|
-
)
|
|
5816
|
-
|
|
5817
|
-
return null;
|
|
5203
|
+
)
|
|
5204
|
+
);
|
|
5818
5205
|
};
|
|
5819
5206
|
|
|
5820
5207
|
var Slideshow = function Slideshow(_ref) {
|
|
5821
|
-
var slides = _ref.slides
|
|
5208
|
+
var slides = _ref.slides,
|
|
5209
|
+
client = _ref.client;
|
|
5210
|
+
|
|
5211
|
+
var builder = imageUrlBuilder(client);
|
|
5822
5212
|
|
|
5213
|
+
var urlFor = function urlFor(source) {
|
|
5214
|
+
return builder.image(source);
|
|
5215
|
+
};
|
|
5823
5216
|
return React__default.createElement(
|
|
5824
5217
|
'div',
|
|
5825
5218
|
{ style: { marginTop: '1em', marginBottom: '1em' } },
|
|
@@ -5830,14 +5223,14 @@ var Slideshow = function Slideshow(_ref) {
|
|
|
5830
5223
|
return React__default.createElement(
|
|
5831
5224
|
Carousel.Item,
|
|
5832
5225
|
{ key: slide._key },
|
|
5833
|
-
React__default.createElement('img', {
|
|
5226
|
+
React__default.createElement('img', { src: urlFor(slide.asset).url(), style: { width: '100%' } })
|
|
5834
5227
|
);
|
|
5835
5228
|
})
|
|
5836
5229
|
)
|
|
5837
5230
|
);
|
|
5838
5231
|
};
|
|
5839
5232
|
|
|
5840
|
-
var isArray
|
|
5233
|
+
var isArray = Array.isArray;
|
|
5841
5234
|
var keyList = Object.keys;
|
|
5842
5235
|
var hasProp = Object.prototype.hasOwnProperty;
|
|
5843
5236
|
|
|
@@ -5845,8 +5238,8 @@ var fastDeepEqual = function equal(a, b) {
|
|
|
5845
5238
|
if (a === b) return true;
|
|
5846
5239
|
|
|
5847
5240
|
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
5848
|
-
var arrA = isArray
|
|
5849
|
-
, arrB = isArray
|
|
5241
|
+
var arrA = isArray(a)
|
|
5242
|
+
, arrB = isArray(b)
|
|
5850
5243
|
, i
|
|
5851
5244
|
, length
|
|
5852
5245
|
, key;
|
|
@@ -6928,7 +6321,7 @@ function format(f) {
|
|
|
6928
6321
|
}
|
|
6929
6322
|
});
|
|
6930
6323
|
for (var x = args[i]; i < len; x = args[++i]) {
|
|
6931
|
-
if (isNull(x) || !isObject
|
|
6324
|
+
if (isNull(x) || !isObject(x)) {
|
|
6932
6325
|
str += ' ' + x;
|
|
6933
6326
|
} else {
|
|
6934
6327
|
str += ' ' + inspect(x);
|
|
@@ -7079,7 +6472,7 @@ function formatValue(ctx, value, recurseTimes) {
|
|
|
7079
6472
|
// Check that value is an object with an inspect function on it
|
|
7080
6473
|
if (ctx.customInspect &&
|
|
7081
6474
|
value &&
|
|
7082
|
-
isFunction
|
|
6475
|
+
isFunction(value.inspect) &&
|
|
7083
6476
|
// Filter out the util module, it's inspect function is special
|
|
7084
6477
|
value.inspect !== inspect &&
|
|
7085
6478
|
// Also filter out any prototype objects using the circular check.
|
|
@@ -7114,7 +6507,7 @@ function formatValue(ctx, value, recurseTimes) {
|
|
|
7114
6507
|
|
|
7115
6508
|
// Some type of object without properties can be shortcutted.
|
|
7116
6509
|
if (keys.length === 0) {
|
|
7117
|
-
if (isFunction
|
|
6510
|
+
if (isFunction(value)) {
|
|
7118
6511
|
var name = value.name ? ': ' + value.name : '';
|
|
7119
6512
|
return ctx.stylize('[Function' + name + ']', 'special');
|
|
7120
6513
|
}
|
|
@@ -7132,13 +6525,13 @@ function formatValue(ctx, value, recurseTimes) {
|
|
|
7132
6525
|
var base = '', array = false, braces = ['{', '}'];
|
|
7133
6526
|
|
|
7134
6527
|
// Make Array say that they are Array
|
|
7135
|
-
if (isArray$
|
|
6528
|
+
if (isArray$1(value)) {
|
|
7136
6529
|
array = true;
|
|
7137
6530
|
braces = ['[', ']'];
|
|
7138
6531
|
}
|
|
7139
6532
|
|
|
7140
6533
|
// Make functions say that they are functions
|
|
7141
|
-
if (isFunction
|
|
6534
|
+
if (isFunction(value)) {
|
|
7142
6535
|
var n = value.name ? ': ' + value.name : '';
|
|
7143
6536
|
base = ' [Function' + n + ']';
|
|
7144
6537
|
}
|
|
@@ -7214,7 +6607,7 @@ function formatError(value) {
|
|
|
7214
6607
|
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
|
7215
6608
|
var output = [];
|
|
7216
6609
|
for (var i = 0, l = value.length; i < l; ++i) {
|
|
7217
|
-
if (hasOwnProperty
|
|
6610
|
+
if (hasOwnProperty(value, String(i))) {
|
|
7218
6611
|
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
|
7219
6612
|
String(i), true));
|
|
7220
6613
|
} else {
|
|
@@ -7245,7 +6638,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
|
|
7245
6638
|
str = ctx.stylize('[Setter]', 'special');
|
|
7246
6639
|
}
|
|
7247
6640
|
}
|
|
7248
|
-
if (!hasOwnProperty
|
|
6641
|
+
if (!hasOwnProperty(visibleKeys, key)) {
|
|
7249
6642
|
name = '[' + key + ']';
|
|
7250
6643
|
}
|
|
7251
6644
|
if (!str) {
|
|
@@ -7311,7 +6704,7 @@ function reduceToSingleString(output, base, braces) {
|
|
|
7311
6704
|
|
|
7312
6705
|
// NOTE: These type checking functions intentionally don't use `instanceof`
|
|
7313
6706
|
// because it is fragile and can be easily faked with `Object.create()`.
|
|
7314
|
-
function isArray$
|
|
6707
|
+
function isArray$1(ar) {
|
|
7315
6708
|
return Array.isArray(ar);
|
|
7316
6709
|
}
|
|
7317
6710
|
|
|
@@ -7335,7 +6728,7 @@ function isString(arg) {
|
|
|
7335
6728
|
return typeof arg === 'string';
|
|
7336
6729
|
}
|
|
7337
6730
|
|
|
7338
|
-
function isSymbol
|
|
6731
|
+
function isSymbol(arg) {
|
|
7339
6732
|
return typeof arg === 'symbol';
|
|
7340
6733
|
}
|
|
7341
6734
|
|
|
@@ -7344,23 +6737,23 @@ function isUndefined(arg) {
|
|
|
7344
6737
|
}
|
|
7345
6738
|
|
|
7346
6739
|
function isRegExp(re) {
|
|
7347
|
-
return isObject
|
|
6740
|
+
return isObject(re) && objectToString(re) === '[object RegExp]';
|
|
7348
6741
|
}
|
|
7349
6742
|
|
|
7350
|
-
function isObject
|
|
6743
|
+
function isObject(arg) {
|
|
7351
6744
|
return typeof arg === 'object' && arg !== null;
|
|
7352
6745
|
}
|
|
7353
6746
|
|
|
7354
6747
|
function isDate(d) {
|
|
7355
|
-
return isObject
|
|
6748
|
+
return isObject(d) && objectToString(d) === '[object Date]';
|
|
7356
6749
|
}
|
|
7357
6750
|
|
|
7358
6751
|
function isError(e) {
|
|
7359
|
-
return isObject
|
|
7360
|
-
(objectToString
|
|
6752
|
+
return isObject(e) &&
|
|
6753
|
+
(objectToString(e) === '[object Error]' || e instanceof Error);
|
|
7361
6754
|
}
|
|
7362
6755
|
|
|
7363
|
-
function isFunction
|
|
6756
|
+
function isFunction(arg) {
|
|
7364
6757
|
return typeof arg === 'function';
|
|
7365
6758
|
}
|
|
7366
6759
|
|
|
@@ -7377,7 +6770,7 @@ function isBuffer(maybeBuf) {
|
|
|
7377
6770
|
return Buffer.isBuffer(maybeBuf);
|
|
7378
6771
|
}
|
|
7379
6772
|
|
|
7380
|
-
function objectToString
|
|
6773
|
+
function objectToString(o) {
|
|
7381
6774
|
return Object.prototype.toString.call(o);
|
|
7382
6775
|
}
|
|
7383
6776
|
|
|
@@ -7407,7 +6800,7 @@ function log() {
|
|
|
7407
6800
|
|
|
7408
6801
|
function _extend(origin, add) {
|
|
7409
6802
|
// Don't do anything if add isn't an object
|
|
7410
|
-
if (!add || !isObject
|
|
6803
|
+
if (!add || !isObject(add)) return origin;
|
|
7411
6804
|
|
|
7412
6805
|
var keys = Object.keys(add);
|
|
7413
6806
|
var i = keys.length;
|
|
@@ -7416,7 +6809,7 @@ function _extend(origin, add) {
|
|
|
7416
6809
|
}
|
|
7417
6810
|
return origin;
|
|
7418
6811
|
}
|
|
7419
|
-
function hasOwnProperty
|
|
6812
|
+
function hasOwnProperty(obj, prop) {
|
|
7420
6813
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
7421
6814
|
}
|
|
7422
6815
|
|
|
@@ -7426,19 +6819,19 @@ var util = {
|
|
|
7426
6819
|
log: log,
|
|
7427
6820
|
isBuffer: isBuffer,
|
|
7428
6821
|
isPrimitive: isPrimitive,
|
|
7429
|
-
isFunction: isFunction
|
|
6822
|
+
isFunction: isFunction,
|
|
7430
6823
|
isError: isError,
|
|
7431
6824
|
isDate: isDate,
|
|
7432
|
-
isObject: isObject
|
|
6825
|
+
isObject: isObject,
|
|
7433
6826
|
isRegExp: isRegExp,
|
|
7434
6827
|
isUndefined: isUndefined,
|
|
7435
|
-
isSymbol: isSymbol
|
|
6828
|
+
isSymbol: isSymbol,
|
|
7436
6829
|
isString: isString,
|
|
7437
6830
|
isNumber: isNumber,
|
|
7438
6831
|
isNullOrUndefined: isNullOrUndefined,
|
|
7439
6832
|
isNull: isNull,
|
|
7440
6833
|
isBoolean: isBoolean,
|
|
7441
|
-
isArray: isArray$
|
|
6834
|
+
isArray: isArray$1,
|
|
7442
6835
|
inspect: inspect,
|
|
7443
6836
|
deprecate: deprecate,
|
|
7444
6837
|
format: format,
|
|
@@ -7447,7 +6840,7 @@ var util = {
|
|
|
7447
6840
|
|
|
7448
6841
|
var require$$2 = {};
|
|
7449
6842
|
|
|
7450
|
-
var node = createCommonjsModule(function (module, exports) {
|
|
6843
|
+
var node$1 = createCommonjsModule(function (module, exports) {
|
|
7451
6844
|
/**
|
|
7452
6845
|
* Module dependencies.
|
|
7453
6846
|
*/
|
|
@@ -7697,14 +7090,14 @@ function init (debug$$1) {
|
|
|
7697
7090
|
|
|
7698
7091
|
exports.enable(load());
|
|
7699
7092
|
});
|
|
7700
|
-
var node_1 = node.init;
|
|
7701
|
-
var node_2 = node.log;
|
|
7702
|
-
var node_3 = node.formatArgs;
|
|
7703
|
-
var node_4 = node.save;
|
|
7704
|
-
var node_5 = node.load;
|
|
7705
|
-
var node_6 = node.useColors;
|
|
7706
|
-
var node_7 = node.colors;
|
|
7707
|
-
var node_8 = node.inspectOpts;
|
|
7093
|
+
var node_1 = node$1.init;
|
|
7094
|
+
var node_2 = node$1.log;
|
|
7095
|
+
var node_3 = node$1.formatArgs;
|
|
7096
|
+
var node_4 = node$1.save;
|
|
7097
|
+
var node_5 = node$1.load;
|
|
7098
|
+
var node_6 = node$1.useColors;
|
|
7099
|
+
var node_7 = node$1.colors;
|
|
7100
|
+
var node_8 = node$1.inspectOpts;
|
|
7708
7101
|
|
|
7709
7102
|
var src = createCommonjsModule(function (module) {
|
|
7710
7103
|
/**
|
|
@@ -7715,7 +7108,7 @@ var src = createCommonjsModule(function (module) {
|
|
|
7715
7108
|
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
|
7716
7109
|
module.exports = browser;
|
|
7717
7110
|
} else {
|
|
7718
|
-
module.exports = node;
|
|
7111
|
+
module.exports = node$1;
|
|
7719
7112
|
}
|
|
7720
7113
|
});
|
|
7721
7114
|
|
|
@@ -8467,7 +7860,7 @@ object-assign
|
|
|
8467
7860
|
*/
|
|
8468
7861
|
/* eslint-disable no-unused-vars */
|
|
8469
7862
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
8470
|
-
var hasOwnProperty$
|
|
7863
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
8471
7864
|
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
8472
7865
|
|
|
8473
7866
|
function toObject(val) {
|
|
@@ -8517,580 +7910,43 @@ function shouldUseNative() {
|
|
|
8517
7910
|
|
|
8518
7911
|
return true;
|
|
8519
7912
|
} catch (err) {
|
|
8520
|
-
// We don't expect any of the above to throw, but better to be safe.
|
|
8521
|
-
return false;
|
|
8522
|
-
}
|
|
8523
|
-
}
|
|
8524
|
-
|
|
8525
|
-
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
8526
|
-
var from;
|
|
8527
|
-
var to = toObject(target);
|
|
8528
|
-
var symbols;
|
|
8529
|
-
|
|
8530
|
-
for (var s = 1; s < arguments.length; s++) {
|
|
8531
|
-
from = Object(arguments[s]);
|
|
8532
|
-
|
|
8533
|
-
for (var key in from) {
|
|
8534
|
-
if (hasOwnProperty$5.call(from, key)) {
|
|
8535
|
-
to[key] = from[key];
|
|
8536
|
-
}
|
|
8537
|
-
}
|
|
8538
|
-
|
|
8539
|
-
if (getOwnPropertySymbols) {
|
|
8540
|
-
symbols = getOwnPropertySymbols(from);
|
|
8541
|
-
for (var i = 0; i < symbols.length; i++) {
|
|
8542
|
-
if (propIsEnumerable.call(from, symbols[i])) {
|
|
8543
|
-
to[symbols[i]] = from[symbols[i]];
|
|
8544
|
-
}
|
|
8545
|
-
}
|
|
8546
|
-
}
|
|
8547
|
-
}
|
|
8548
|
-
|
|
8549
|
-
return to;
|
|
8550
|
-
};
|
|
8551
|
-
|
|
8552
|
-
var baseUrl = 'https://docs.sanity.io/help/';
|
|
8553
|
-
|
|
8554
|
-
var generateHelpUrl = function generateHelpUrl(slug) {
|
|
8555
|
-
return baseUrl + slug
|
|
8556
|
-
};
|
|
8557
|
-
|
|
8558
|
-
var parseAssetId_1 = createCommonjsModule(function (module, exports) {
|
|
8559
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8560
|
-
var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
|
|
8561
|
-
function parseAssetId(ref) {
|
|
8562
|
-
var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
|
|
8563
|
-
if (!id || !dimensionString || !format) {
|
|
8564
|
-
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
8565
|
-
}
|
|
8566
|
-
var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
|
|
8567
|
-
var width = +imgWidthStr;
|
|
8568
|
-
var height = +imgHeightStr;
|
|
8569
|
-
var isValidAssetId = isFinite(width) && isFinite(height);
|
|
8570
|
-
if (!isValidAssetId) {
|
|
8571
|
-
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
8572
|
-
}
|
|
8573
|
-
return { id: id, width: width, height: height, format: format };
|
|
8574
|
-
}
|
|
8575
|
-
exports.default = parseAssetId;
|
|
8576
|
-
|
|
8577
|
-
});
|
|
8578
|
-
|
|
8579
|
-
unwrapExports(parseAssetId_1);
|
|
8580
|
-
|
|
8581
|
-
var parseSource_1 = createCommonjsModule(function (module, exports) {
|
|
8582
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
8583
|
-
__assign = Object.assign || function(t) {
|
|
8584
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8585
|
-
s = arguments[i];
|
|
8586
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8587
|
-
t[p] = s[p];
|
|
8588
|
-
}
|
|
8589
|
-
return t;
|
|
8590
|
-
};
|
|
8591
|
-
return __assign.apply(this, arguments);
|
|
8592
|
-
};
|
|
8593
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8594
|
-
var isRef = function (src) {
|
|
8595
|
-
var source = src;
|
|
8596
|
-
return source ? typeof source._ref === 'string' : false;
|
|
8597
|
-
};
|
|
8598
|
-
var isAsset = function (src) {
|
|
8599
|
-
var source = src;
|
|
8600
|
-
return source ? typeof source._id === 'string' : false;
|
|
8601
|
-
};
|
|
8602
|
-
var isAssetStub = function (src) {
|
|
8603
|
-
var source = src;
|
|
8604
|
-
return source && source.asset ? typeof source.asset.url === 'string' : false;
|
|
8605
|
-
};
|
|
8606
|
-
// Convert an asset-id, asset or image to an image record suitable for processing
|
|
8607
|
-
// eslint-disable-next-line complexity
|
|
8608
|
-
function parseSource(source) {
|
|
8609
|
-
if (!source) {
|
|
8610
|
-
return null;
|
|
8611
|
-
}
|
|
8612
|
-
var image;
|
|
8613
|
-
if (typeof source === 'string' && isUrl(source)) {
|
|
8614
|
-
// Someone passed an existing image url?
|
|
8615
|
-
image = {
|
|
8616
|
-
asset: { _ref: urlToId(source) }
|
|
8617
|
-
};
|
|
8618
|
-
}
|
|
8619
|
-
else if (typeof source === 'string') {
|
|
8620
|
-
// Just an asset id
|
|
8621
|
-
image = {
|
|
8622
|
-
asset: { _ref: source }
|
|
8623
|
-
};
|
|
8624
|
-
}
|
|
8625
|
-
else if (isRef(source)) {
|
|
8626
|
-
// We just got passed an asset directly
|
|
8627
|
-
image = {
|
|
8628
|
-
asset: source
|
|
8629
|
-
};
|
|
8630
|
-
}
|
|
8631
|
-
else if (isAsset(source)) {
|
|
8632
|
-
// If we were passed an image asset document
|
|
8633
|
-
image = {
|
|
8634
|
-
asset: {
|
|
8635
|
-
_ref: source._id || ''
|
|
8636
|
-
}
|
|
8637
|
-
};
|
|
8638
|
-
}
|
|
8639
|
-
else if (isAssetStub(source)) {
|
|
8640
|
-
// If we were passed a partial asset (`url`, but no `_id`)
|
|
8641
|
-
image = {
|
|
8642
|
-
asset: {
|
|
8643
|
-
_ref: urlToId(source.asset.url)
|
|
8644
|
-
}
|
|
8645
|
-
};
|
|
8646
|
-
}
|
|
8647
|
-
else if (typeof source.asset === 'object') {
|
|
8648
|
-
// Probably an actual image with materialized asset
|
|
8649
|
-
image = source;
|
|
8650
|
-
}
|
|
8651
|
-
else {
|
|
8652
|
-
// We got something that does not look like an image, or it is an image
|
|
8653
|
-
// that currently isn't sporting an asset.
|
|
8654
|
-
return null;
|
|
8655
|
-
}
|
|
8656
|
-
var img = source;
|
|
8657
|
-
if (img.crop) {
|
|
8658
|
-
image.crop = img.crop;
|
|
8659
|
-
}
|
|
8660
|
-
if (img.hotspot) {
|
|
8661
|
-
image.hotspot = img.hotspot;
|
|
8662
|
-
}
|
|
8663
|
-
return applyDefaults(image);
|
|
8664
|
-
}
|
|
8665
|
-
exports.default = parseSource;
|
|
8666
|
-
function isUrl(url) {
|
|
8667
|
-
return /^https?:\/\//.test("" + url);
|
|
8668
|
-
}
|
|
8669
|
-
function urlToId(url) {
|
|
8670
|
-
var parts = url.split('/').slice(-1);
|
|
8671
|
-
return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
|
|
8672
|
-
}
|
|
8673
|
-
// Mock crop and hotspot if image lacks it
|
|
8674
|
-
function applyDefaults(image) {
|
|
8675
|
-
if (image.crop && image.hotspot) {
|
|
8676
|
-
return image;
|
|
8677
|
-
}
|
|
8678
|
-
// We need to pad in default values for crop or hotspot
|
|
8679
|
-
var result = __assign({}, image);
|
|
8680
|
-
if (!result.crop) {
|
|
8681
|
-
result.crop = {
|
|
8682
|
-
left: 0,
|
|
8683
|
-
top: 0,
|
|
8684
|
-
bottom: 0,
|
|
8685
|
-
right: 0
|
|
8686
|
-
};
|
|
8687
|
-
}
|
|
8688
|
-
if (!result.hotspot) {
|
|
8689
|
-
result.hotspot = {
|
|
8690
|
-
x: 0.5,
|
|
8691
|
-
y: 0.5,
|
|
8692
|
-
height: 1.0,
|
|
8693
|
-
width: 1.0
|
|
8694
|
-
};
|
|
8695
|
-
}
|
|
8696
|
-
return result;
|
|
8697
|
-
}
|
|
8698
|
-
|
|
8699
|
-
});
|
|
8700
|
-
|
|
8701
|
-
unwrapExports(parseSource_1);
|
|
8702
|
-
|
|
8703
|
-
var urlForImage_1 = createCommonjsModule(function (module, exports) {
|
|
8704
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
8705
|
-
__assign = Object.assign || function(t) {
|
|
8706
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8707
|
-
s = arguments[i];
|
|
8708
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8709
|
-
t[p] = s[p];
|
|
8710
|
-
}
|
|
8711
|
-
return t;
|
|
8712
|
-
};
|
|
8713
|
-
return __assign.apply(this, arguments);
|
|
8714
|
-
};
|
|
8715
|
-
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
8716
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8717
|
-
};
|
|
8718
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8719
|
-
var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
|
|
8720
|
-
var parseSource_1$$1 = __importDefault(parseSource_1);
|
|
8721
|
-
exports.parseSource = parseSource_1$$1.default;
|
|
8722
|
-
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
|
|
8723
|
-
['width', 'w'],
|
|
8724
|
-
['height', 'h'],
|
|
8725
|
-
['format', 'fm'],
|
|
8726
|
-
['download', 'dl'],
|
|
8727
|
-
['blur', 'blur'],
|
|
8728
|
-
['sharpen', 'sharp'],
|
|
8729
|
-
['invert', 'invert'],
|
|
8730
|
-
['orientation', 'or'],
|
|
8731
|
-
['minHeight', 'min-h'],
|
|
8732
|
-
['maxHeight', 'max-h'],
|
|
8733
|
-
['minWidth', 'min-w'],
|
|
8734
|
-
['maxWidth', 'max-w'],
|
|
8735
|
-
['quality', 'q'],
|
|
8736
|
-
['fit', 'fit'],
|
|
8737
|
-
['crop', 'crop'],
|
|
8738
|
-
['auto', 'auto'],
|
|
8739
|
-
['dpr', 'dpr']
|
|
8740
|
-
];
|
|
8741
|
-
function urlForImage(options) {
|
|
8742
|
-
var spec = __assign({}, (options || {}));
|
|
8743
|
-
var source = spec.source;
|
|
8744
|
-
delete spec.source;
|
|
8745
|
-
var image = parseSource_1$$1.default(source);
|
|
8746
|
-
if (!image) {
|
|
8747
|
-
return null;
|
|
8748
|
-
}
|
|
8749
|
-
var id = image.asset._ref || image.asset._id || '';
|
|
8750
|
-
var asset = parseAssetId_1$$1.default(id);
|
|
8751
|
-
// Compute crop rect in terms of pixel coordinates in the raw source image
|
|
8752
|
-
var cropLeft = Math.round(image.crop.left * asset.width);
|
|
8753
|
-
var cropTop = Math.round(image.crop.top * asset.height);
|
|
8754
|
-
var crop = {
|
|
8755
|
-
left: cropLeft,
|
|
8756
|
-
top: cropTop,
|
|
8757
|
-
width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
|
|
8758
|
-
height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
|
|
8759
|
-
};
|
|
8760
|
-
// Compute hot spot rect in terms of pixel coordinates
|
|
8761
|
-
var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
|
|
8762
|
-
var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
|
|
8763
|
-
var hotSpotCenterX = image.hotspot.x * asset.width;
|
|
8764
|
-
var hotSpotCenterY = image.hotspot.y * asset.height;
|
|
8765
|
-
var hotspot = {
|
|
8766
|
-
left: hotSpotCenterX - hotSpotHorizontalRadius,
|
|
8767
|
-
top: hotSpotCenterY - hotSpotVerticalRadius,
|
|
8768
|
-
right: hotSpotCenterX + hotSpotHorizontalRadius,
|
|
8769
|
-
bottom: hotSpotCenterY + hotSpotVerticalRadius
|
|
8770
|
-
};
|
|
8771
|
-
// If irrelevant, or if we are requested to: don't perform crop/fit based on
|
|
8772
|
-
// the crop/hotspot.
|
|
8773
|
-
if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
|
|
8774
|
-
spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
|
|
8775
|
-
}
|
|
8776
|
-
return specToImageUrl(__assign({}, spec, { asset: asset }));
|
|
8777
|
-
}
|
|
8778
|
-
exports.default = urlForImage;
|
|
8779
|
-
// eslint-disable-next-line complexity
|
|
8780
|
-
function specToImageUrl(spec) {
|
|
8781
|
-
var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
|
|
8782
|
-
var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
|
|
8783
|
-
var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
|
|
8784
|
-
var params = [];
|
|
8785
|
-
if (spec.rect) {
|
|
8786
|
-
// Only bother url with a crop if it actually crops anything
|
|
8787
|
-
var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
|
|
8788
|
-
var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
|
|
8789
|
-
if (isEffectiveCrop) {
|
|
8790
|
-
params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
|
|
8791
|
-
}
|
|
8792
|
-
}
|
|
8793
|
-
if (spec.bg) {
|
|
8794
|
-
params.push("bg=" + spec.bg);
|
|
8795
|
-
}
|
|
8796
|
-
if (spec.focalPoint) {
|
|
8797
|
-
params.push("fp-x=" + spec.focalPoint.x);
|
|
8798
|
-
params.push("fp-x=" + spec.focalPoint.y);
|
|
8799
|
-
}
|
|
8800
|
-
var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
|
|
8801
|
-
if (flip) {
|
|
8802
|
-
params.push("flip=" + flip);
|
|
8803
|
-
}
|
|
8804
|
-
// Map from spec name to url param name, and allow using the actual param name as an alternative
|
|
8805
|
-
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
|
|
8806
|
-
var specName = mapping[0], param = mapping[1];
|
|
8807
|
-
if (typeof spec[specName] !== 'undefined') {
|
|
8808
|
-
params.push(param + "=" + encodeURIComponent(spec[specName]));
|
|
8809
|
-
}
|
|
8810
|
-
else if (typeof spec[param] !== 'undefined') {
|
|
8811
|
-
params.push(param + "=" + encodeURIComponent(spec[param]));
|
|
8812
|
-
}
|
|
8813
|
-
});
|
|
8814
|
-
if (params.length === 0) {
|
|
8815
|
-
return baseUrl;
|
|
8816
|
-
}
|
|
8817
|
-
return baseUrl + "?" + params.join('&');
|
|
8818
|
-
}
|
|
8819
|
-
function fit(source, spec) {
|
|
8820
|
-
var cropRect;
|
|
8821
|
-
var imgWidth = spec.width;
|
|
8822
|
-
var imgHeight = spec.height;
|
|
8823
|
-
// If we are not constraining the aspect ratio, we'll just use the whole crop
|
|
8824
|
-
if (!(imgWidth && imgHeight)) {
|
|
8825
|
-
return { width: imgWidth, height: imgHeight, rect: source.crop };
|
|
8826
|
-
}
|
|
8827
|
-
var crop = source.crop;
|
|
8828
|
-
var hotspot = source.hotspot;
|
|
8829
|
-
// If we are here, that means aspect ratio is locked and fitting will be a bit harder
|
|
8830
|
-
var desiredAspectRatio = imgWidth / imgHeight;
|
|
8831
|
-
var cropAspectRatio = crop.width / crop.height;
|
|
8832
|
-
if (cropAspectRatio > desiredAspectRatio) {
|
|
8833
|
-
// The crop is wider than the desired aspect ratio. That means we are cutting from the sides
|
|
8834
|
-
var height = crop.height;
|
|
8835
|
-
var width = height * desiredAspectRatio;
|
|
8836
|
-
var top_2 = crop.top;
|
|
8837
|
-
// Center output horizontally over hotspot
|
|
8838
|
-
var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
|
|
8839
|
-
var left = hotspotXCenter - width / 2;
|
|
8840
|
-
// Keep output within crop
|
|
8841
|
-
if (left < crop.left) {
|
|
8842
|
-
left = crop.left;
|
|
8843
|
-
}
|
|
8844
|
-
else if (left + width > crop.left + crop.width) {
|
|
8845
|
-
left = crop.left + crop.width - width;
|
|
8846
|
-
}
|
|
8847
|
-
cropRect = {
|
|
8848
|
-
left: Math.round(left),
|
|
8849
|
-
top: Math.round(top_2),
|
|
8850
|
-
width: Math.round(width),
|
|
8851
|
-
height: Math.round(height)
|
|
8852
|
-
};
|
|
8853
|
-
}
|
|
8854
|
-
else {
|
|
8855
|
-
// The crop is taller than the desired ratio, we are cutting from top and bottom
|
|
8856
|
-
var width = crop.width;
|
|
8857
|
-
var height = width / desiredAspectRatio;
|
|
8858
|
-
var left = crop.left;
|
|
8859
|
-
// Center output vertically over hotspot
|
|
8860
|
-
var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
|
|
8861
|
-
var top_3 = hotspotYCenter - height / 2;
|
|
8862
|
-
// Keep output rect within crop
|
|
8863
|
-
if (top_3 < crop.top) {
|
|
8864
|
-
top_3 = crop.top;
|
|
8865
|
-
}
|
|
8866
|
-
else if (top_3 + height > crop.top + crop.height) {
|
|
8867
|
-
top_3 = crop.top + crop.height - height;
|
|
8868
|
-
}
|
|
8869
|
-
cropRect = {
|
|
8870
|
-
left: Math.max(0, Math.floor(left)),
|
|
8871
|
-
top: Math.max(0, Math.floor(top_3)),
|
|
8872
|
-
width: Math.round(width),
|
|
8873
|
-
height: Math.round(height)
|
|
8874
|
-
};
|
|
8875
|
-
}
|
|
8876
|
-
return {
|
|
8877
|
-
width: imgWidth,
|
|
8878
|
-
height: imgHeight,
|
|
8879
|
-
rect: cropRect
|
|
8880
|
-
};
|
|
7913
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
7914
|
+
return false;
|
|
7915
|
+
}
|
|
8881
7916
|
}
|
|
8882
7917
|
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
var
|
|
8887
|
-
var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
7918
|
+
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
7919
|
+
var from;
|
|
7920
|
+
var to = toObject(target);
|
|
7921
|
+
var symbols;
|
|
8888
7922
|
|
|
8889
|
-
var
|
|
8890
|
-
|
|
8891
|
-
__assign = Object.assign || function(t) {
|
|
8892
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8893
|
-
s = arguments[i];
|
|
8894
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8895
|
-
t[p] = s[p];
|
|
8896
|
-
}
|
|
8897
|
-
return t;
|
|
8898
|
-
};
|
|
8899
|
-
return __assign.apply(this, arguments);
|
|
8900
|
-
};
|
|
8901
|
-
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
8902
|
-
if (mod && mod.__esModule) return mod;
|
|
8903
|
-
var result = {};
|
|
8904
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
8905
|
-
result["default"] = mod;
|
|
8906
|
-
return result;
|
|
8907
|
-
};
|
|
8908
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8909
|
-
var urlForImage_1$$1 = __importStar(urlForImage_1);
|
|
8910
|
-
var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
|
|
8911
|
-
var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
|
|
8912
|
-
var validAutoModes = ['format'];
|
|
8913
|
-
function isSanityClient(client) {
|
|
8914
|
-
return client ? typeof client.clientConfig === 'object' : false;
|
|
8915
|
-
}
|
|
8916
|
-
function rewriteSpecName(key) {
|
|
8917
|
-
var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
8918
|
-
for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
|
|
8919
|
-
var entry = specs_1[_i];
|
|
8920
|
-
var specName = entry[0], param = entry[1];
|
|
8921
|
-
if (key === specName || key === param) {
|
|
8922
|
-
return specName;
|
|
8923
|
-
}
|
|
8924
|
-
}
|
|
8925
|
-
return key;
|
|
8926
|
-
}
|
|
8927
|
-
function urlBuilder(options) {
|
|
8928
|
-
// Did we get a SanityClient?
|
|
8929
|
-
var client = options;
|
|
8930
|
-
if (isSanityClient(client)) {
|
|
8931
|
-
// Inherit config from client
|
|
8932
|
-
var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
|
|
8933
|
-
return new ImageUrlBuilder(null, {
|
|
8934
|
-
baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
|
|
8935
|
-
projectId: projectId,
|
|
8936
|
-
dataset: dataset
|
|
8937
|
-
});
|
|
8938
|
-
}
|
|
8939
|
-
// Or just accept the options as given
|
|
8940
|
-
return new ImageUrlBuilder(null, options);
|
|
8941
|
-
}
|
|
8942
|
-
exports.default = urlBuilder;
|
|
8943
|
-
var ImageUrlBuilder = /** @class */ (function () {
|
|
8944
|
-
function ImageUrlBuilder(parent, options) {
|
|
8945
|
-
this.options = parent
|
|
8946
|
-
? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
|
|
8947
|
-
}
|
|
8948
|
-
ImageUrlBuilder.prototype.withOptions = function (options) {
|
|
8949
|
-
var baseUrl = options.baseUrl || '';
|
|
8950
|
-
var newOptions = { baseUrl: baseUrl };
|
|
8951
|
-
for (var key in options) {
|
|
8952
|
-
if (options.hasOwnProperty(key)) {
|
|
8953
|
-
var specKey = rewriteSpecName(key);
|
|
8954
|
-
newOptions[specKey] = options[key];
|
|
8955
|
-
}
|
|
8956
|
-
}
|
|
8957
|
-
return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
|
|
8958
|
-
};
|
|
8959
|
-
// The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
|
|
8960
|
-
// _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
|
|
8961
|
-
// studio, the 'image'-document must be provided.
|
|
8962
|
-
ImageUrlBuilder.prototype.image = function (source) {
|
|
8963
|
-
return this.withOptions({ source: source });
|
|
8964
|
-
};
|
|
8965
|
-
// Specify the dataset
|
|
8966
|
-
ImageUrlBuilder.prototype.dataset = function (dataset) {
|
|
8967
|
-
return this.withOptions({ dataset: dataset });
|
|
8968
|
-
};
|
|
8969
|
-
// Specify the projectId
|
|
8970
|
-
ImageUrlBuilder.prototype.projectId = function (projectId) {
|
|
8971
|
-
return this.withOptions({ projectId: projectId });
|
|
8972
|
-
};
|
|
8973
|
-
// Specify background color
|
|
8974
|
-
ImageUrlBuilder.prototype.bg = function (bg) {
|
|
8975
|
-
return this.withOptions({ bg: bg });
|
|
8976
|
-
};
|
|
8977
|
-
// Set DPR scaling factor
|
|
8978
|
-
ImageUrlBuilder.prototype.dpr = function (dpr) {
|
|
8979
|
-
return this.withOptions({ dpr: dpr });
|
|
8980
|
-
};
|
|
8981
|
-
// Specify the width of the image in pixels
|
|
8982
|
-
ImageUrlBuilder.prototype.width = function (width) {
|
|
8983
|
-
return this.withOptions({ width: width });
|
|
8984
|
-
};
|
|
8985
|
-
// Specify the height of the image in pixels
|
|
8986
|
-
ImageUrlBuilder.prototype.height = function (height) {
|
|
8987
|
-
return this.withOptions({ height: height });
|
|
8988
|
-
};
|
|
8989
|
-
// Specify focal point in fraction of image dimensions. Each component 0.0-1.0
|
|
8990
|
-
ImageUrlBuilder.prototype.focalPoint = function (x, y) {
|
|
8991
|
-
return this.withOptions({ focalPoint: { x: x, y: y } });
|
|
8992
|
-
};
|
|
8993
|
-
ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
|
|
8994
|
-
return this.withOptions({ maxWidth: maxWidth });
|
|
8995
|
-
};
|
|
8996
|
-
ImageUrlBuilder.prototype.minWidth = function (minWidth) {
|
|
8997
|
-
return this.withOptions({ minWidth: minWidth });
|
|
8998
|
-
};
|
|
8999
|
-
ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
|
|
9000
|
-
return this.withOptions({ maxHeight: maxHeight });
|
|
9001
|
-
};
|
|
9002
|
-
ImageUrlBuilder.prototype.minHeight = function (minHeight) {
|
|
9003
|
-
return this.withOptions({ minHeight: minHeight });
|
|
9004
|
-
};
|
|
9005
|
-
// Specify width and height in pixels
|
|
9006
|
-
ImageUrlBuilder.prototype.size = function (width, height) {
|
|
9007
|
-
return this.withOptions({ width: width, height: height });
|
|
9008
|
-
};
|
|
9009
|
-
// Specify blur between 0 and 100
|
|
9010
|
-
ImageUrlBuilder.prototype.blur = function (blur) {
|
|
9011
|
-
return this.withOptions({ blur: blur });
|
|
9012
|
-
};
|
|
9013
|
-
ImageUrlBuilder.prototype.sharpen = function (sharpen) {
|
|
9014
|
-
return this.withOptions({ sharpen: sharpen });
|
|
9015
|
-
};
|
|
9016
|
-
// Specify the desired rectangle of the image
|
|
9017
|
-
ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
|
|
9018
|
-
return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
|
|
9019
|
-
};
|
|
9020
|
-
// Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
|
|
9021
|
-
ImageUrlBuilder.prototype.format = function (format) {
|
|
9022
|
-
return this.withOptions({ format: format });
|
|
9023
|
-
};
|
|
9024
|
-
ImageUrlBuilder.prototype.invert = function (invert) {
|
|
9025
|
-
return this.withOptions({ invert: invert });
|
|
9026
|
-
};
|
|
9027
|
-
// Rotation in degrees 0, 90, 180, 270
|
|
9028
|
-
ImageUrlBuilder.prototype.orientation = function (orientation) {
|
|
9029
|
-
return this.withOptions({ orientation: orientation });
|
|
9030
|
-
};
|
|
9031
|
-
// Compression quality 0-100
|
|
9032
|
-
ImageUrlBuilder.prototype.quality = function (quality) {
|
|
9033
|
-
return this.withOptions({ quality: quality });
|
|
9034
|
-
};
|
|
9035
|
-
// Make it a download link. Parameter is default filename.
|
|
9036
|
-
ImageUrlBuilder.prototype.forceDownload = function (download) {
|
|
9037
|
-
return this.withOptions({ download: download });
|
|
9038
|
-
};
|
|
9039
|
-
// Flip image horizontally
|
|
9040
|
-
ImageUrlBuilder.prototype.flipHorizontal = function () {
|
|
9041
|
-
return this.withOptions({ flipHorizontal: true });
|
|
9042
|
-
};
|
|
9043
|
-
// Flip image verically
|
|
9044
|
-
ImageUrlBuilder.prototype.flipVertical = function () {
|
|
9045
|
-
return this.withOptions({ flipVertical: true });
|
|
9046
|
-
};
|
|
9047
|
-
// Ignore crop/hotspot from image record, even when present
|
|
9048
|
-
ImageUrlBuilder.prototype.ignoreImageParams = function () {
|
|
9049
|
-
return this.withOptions({ ignoreImageParams: true });
|
|
9050
|
-
};
|
|
9051
|
-
ImageUrlBuilder.prototype.fit = function (value) {
|
|
9052
|
-
if (validFits.indexOf(value) === -1) {
|
|
9053
|
-
throw new Error("Invalid fit mode \"" + value + "\"");
|
|
9054
|
-
}
|
|
9055
|
-
return this.withOptions({ fit: value });
|
|
9056
|
-
};
|
|
9057
|
-
ImageUrlBuilder.prototype.crop = function (value) {
|
|
9058
|
-
if (validCrops.indexOf(value) === -1) {
|
|
9059
|
-
throw new Error("Invalid crop mode \"" + value + "\"");
|
|
9060
|
-
}
|
|
9061
|
-
return this.withOptions({ crop: value });
|
|
9062
|
-
};
|
|
9063
|
-
ImageUrlBuilder.prototype.auto = function (value) {
|
|
9064
|
-
if (validAutoModes.indexOf(value) === -1) {
|
|
9065
|
-
throw new Error("Invalid auto mode \"" + value + "\"");
|
|
9066
|
-
}
|
|
9067
|
-
return this.withOptions({ auto: value });
|
|
9068
|
-
};
|
|
9069
|
-
// Gets the url based on the submitted parameters
|
|
9070
|
-
ImageUrlBuilder.prototype.url = function () {
|
|
9071
|
-
return urlForImage_1$$1.default(this.options);
|
|
9072
|
-
};
|
|
9073
|
-
// Synonym for url()
|
|
9074
|
-
ImageUrlBuilder.prototype.toString = function () {
|
|
9075
|
-
return this.url();
|
|
9076
|
-
};
|
|
9077
|
-
return ImageUrlBuilder;
|
|
9078
|
-
}());
|
|
7923
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
7924
|
+
from = Object(arguments[s]);
|
|
9079
7925
|
|
|
9080
|
-
|
|
7926
|
+
for (var key in from) {
|
|
7927
|
+
if (hasOwnProperty$1.call(from, key)) {
|
|
7928
|
+
to[key] = from[key];
|
|
7929
|
+
}
|
|
7930
|
+
}
|
|
9081
7931
|
|
|
9082
|
-
|
|
7932
|
+
if (getOwnPropertySymbols) {
|
|
7933
|
+
symbols = getOwnPropertySymbols(from);
|
|
7934
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
7935
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
7936
|
+
to[symbols[i]] = from[symbols[i]];
|
|
7937
|
+
}
|
|
7938
|
+
}
|
|
7939
|
+
}
|
|
7940
|
+
}
|
|
9083
7941
|
|
|
9084
|
-
|
|
9085
|
-
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
9086
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7942
|
+
return to;
|
|
9087
7943
|
};
|
|
9088
|
-
var builder_1 = __importDefault(builder);
|
|
9089
|
-
module.exports = builder_1.default;
|
|
9090
7944
|
|
|
9091
|
-
|
|
7945
|
+
var baseUrl = 'https://docs.sanity.io/help/';
|
|
9092
7946
|
|
|
9093
|
-
|
|
7947
|
+
var generateHelpUrl = function generateHelpUrl(slug) {
|
|
7948
|
+
return baseUrl + slug
|
|
7949
|
+
};
|
|
9094
7950
|
|
|
9095
7951
|
var enc = encodeURIComponent;
|
|
9096
7952
|
var materializeError = "You must either:\n - Pass `projectId` and `dataset` to the block renderer\n - Materialize images to include the `url` field.\n\nFor more information, see ".concat(generateHelpUrl('block-content-image-materializing'));
|
|
@@ -9110,11 +7966,11 @@ var getQueryString = function getQueryString(options) {
|
|
|
9110
7966
|
};
|
|
9111
7967
|
|
|
9112
7968
|
var buildUrl = function buildUrl(props) {
|
|
9113
|
-
var node = props.node,
|
|
7969
|
+
var node$$1 = props.node,
|
|
9114
7970
|
options = props.options;
|
|
9115
7971
|
var projectId = options.projectId,
|
|
9116
7972
|
dataset = options.dataset;
|
|
9117
|
-
var asset = node.asset;
|
|
7973
|
+
var asset = node$$1.asset;
|
|
9118
7974
|
|
|
9119
7975
|
if (!asset) {
|
|
9120
7976
|
throw new Error('Image does not have required `asset` property');
|
|
@@ -9134,10 +7990,10 @@ var buildUrl = function buildUrl(props) {
|
|
|
9134
7990
|
throw new Error('Invalid image reference in block, no `_ref` found on `asset`');
|
|
9135
7991
|
}
|
|
9136
7992
|
|
|
9137
|
-
return node
|
|
7993
|
+
return node(objectAssign({
|
|
9138
7994
|
projectId: projectId,
|
|
9139
7995
|
dataset: dataset
|
|
9140
|
-
}, options.imageOptions || {})).image(node).toString();
|
|
7996
|
+
}, options.imageOptions || {})).image(node$$1).toString();
|
|
9141
7997
|
};
|
|
9142
7998
|
|
|
9143
7999
|
var getImageUrl = buildUrl;
|
|
@@ -9907,7 +8763,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
9907
8763
|
|
|
9908
8764
|
return React__default.createElement(
|
|
9909
8765
|
Card$1,
|
|
9910
|
-
{
|
|
8766
|
+
{ className: 'sidebar' },
|
|
9911
8767
|
React__default.createElement(
|
|
9912
8768
|
Card$1.Body,
|
|
9913
8769
|
null,
|
|
@@ -9921,6 +8777,61 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
9921
8777
|
);
|
|
9922
8778
|
};
|
|
9923
8779
|
|
|
8780
|
+
var TableShow = function TableShow(_ref) {
|
|
8781
|
+
var rows = _ref.rows;
|
|
8782
|
+
|
|
8783
|
+
return React__default.createElement(
|
|
8784
|
+
Table,
|
|
8785
|
+
{ bordered: true, hover: true, responsive: true },
|
|
8786
|
+
React__default.createElement(
|
|
8787
|
+
'tbody',
|
|
8788
|
+
null,
|
|
8789
|
+
rows && rows.map(function (row) {
|
|
8790
|
+
return React__default.createElement(
|
|
8791
|
+
'tr',
|
|
8792
|
+
{ key: row._key },
|
|
8793
|
+
row.cells && row.cells.map(function (cell, index) {
|
|
8794
|
+
return React__default.createElement(
|
|
8795
|
+
'td',
|
|
8796
|
+
{ key: index },
|
|
8797
|
+
cell
|
|
8798
|
+
);
|
|
8799
|
+
})
|
|
8800
|
+
);
|
|
8801
|
+
})
|
|
8802
|
+
)
|
|
8803
|
+
);
|
|
8804
|
+
};
|
|
8805
|
+
|
|
8806
|
+
var Media$1 = function Media$$1(_ref) {
|
|
8807
|
+
var uploadDoc = _ref.uploadDoc,
|
|
8808
|
+
poster = _ref.poster,
|
|
8809
|
+
client = _ref.client,
|
|
8810
|
+
blank = _ref.blank,
|
|
8811
|
+
caption = _ref.caption;
|
|
8812
|
+
|
|
8813
|
+
var builder = imageUrlBuilder(client);
|
|
8814
|
+
|
|
8815
|
+
var urlFor = function urlFor(source) {
|
|
8816
|
+
return builder.image(source);
|
|
8817
|
+
};
|
|
8818
|
+
|
|
8819
|
+
return React__default.createElement(
|
|
8820
|
+
Figure,
|
|
8821
|
+
null,
|
|
8822
|
+
uploadDoc ? React__default.createElement(
|
|
8823
|
+
'a',
|
|
8824
|
+
{ href: urlFor(poster.asset).url(), target: blank ? '_blank' : '_self' },
|
|
8825
|
+
React__default.createElement(Figure.Image, { src: urlFor(poster.asset).url() })
|
|
8826
|
+
) : React__default.createElement(Figure.Image, { src: urlFor(poster.asset).url() }),
|
|
8827
|
+
caption && React__default.createElement(
|
|
8828
|
+
Figure.Caption,
|
|
8829
|
+
null,
|
|
8830
|
+
caption
|
|
8831
|
+
)
|
|
8832
|
+
);
|
|
8833
|
+
};
|
|
8834
|
+
|
|
9924
8835
|
var getSerializers$1 = function getSerializers(client) {
|
|
9925
8836
|
return {
|
|
9926
8837
|
types: {
|
|
@@ -9935,13 +8846,13 @@ var getSerializers$1 = function getSerializers(client) {
|
|
|
9935
8846
|
var asset = node.asset,
|
|
9936
8847
|
caption = node.caption;
|
|
9937
8848
|
|
|
9938
|
-
return React__default.createElement(FigureComponent, { caption: caption, asset: asset });
|
|
8849
|
+
return React__default.createElement(FigureComponent, { caption: caption, asset: asset, client: client });
|
|
9939
8850
|
},
|
|
9940
8851
|
slideshow: function slideshow(_ref3) {
|
|
9941
8852
|
var node = _ref3.node;
|
|
9942
8853
|
var slides = node.slides;
|
|
9943
8854
|
|
|
9944
|
-
return React__default.createElement(Slideshow, { slides: slides });
|
|
8855
|
+
return React__default.createElement(Slideshow, { slides: slides, client: client });
|
|
9945
8856
|
},
|
|
9946
8857
|
sidebar: function sidebar(_ref4) {
|
|
9947
8858
|
var node = _ref4.node;
|
|
@@ -9949,6 +8860,21 @@ var getSerializers$1 = function getSerializers(client) {
|
|
|
9949
8860
|
content = node.content;
|
|
9950
8861
|
|
|
9951
8862
|
return React__default.createElement(Sidebar, { caption: caption, content: content });
|
|
8863
|
+
},
|
|
8864
|
+
table: function table(_ref5) {
|
|
8865
|
+
var node = _ref5.node;
|
|
8866
|
+
var rows = node.rows;
|
|
8867
|
+
|
|
8868
|
+
return React__default.createElement(TableShow, { rows: rows });
|
|
8869
|
+
},
|
|
8870
|
+
media: function media(_ref6) {
|
|
8871
|
+
var node = _ref6.node;
|
|
8872
|
+
var upload_doc = node.upload_doc,
|
|
8873
|
+
poster = node.poster,
|
|
8874
|
+
caption = node.caption,
|
|
8875
|
+
blank = node.blank;
|
|
8876
|
+
|
|
8877
|
+
return React__default.createElement(Media$1, { uploadDoc: upload_doc, poster: poster, blank: blank, client: client, caption: caption });
|
|
9952
8878
|
}
|
|
9953
8879
|
}
|
|
9954
8880
|
};
|